Skip to content

Commit

Permalink
feat: Build with Python support for MacOS (#391)
Browse files Browse the repository at this point in the history
* feat: Build with Python support for MacOS

* set python paths

* fix build with python [skip ci]

* Update metacall-environment-macos.sh

---------

Co-authored-by: Vicente Eduardo Ferrer Garcia <[email protected]>
  • Loading branch information
ahmedihabb2 and viferga authored Mar 1, 2023
1 parent e625393 commit bb79a77
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/macos-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:
push:
tags:
- 'v*.*.*'
- "v*.*.*"
branches:
- master
- develop
Expand All @@ -18,25 +18,25 @@ jobs:
strategy:
matrix:
buildtype: [debug] # TODO: [debug, release]

env:
LTTNG_UST_REGISTER_TIMEOUT: 0
NUGET_XMLDOC_MODE: skip
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
DOTNET_CLI_TELEMETRY_OPTOUT: "true"

steps:
- name: Check out the repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Uninstall NodeJS and NPM
- name: Uninstall NodeJS and NPM
run: |
npm uninstall npm -g
rm -rf /usr/local/lib/node_modules/npm
# TODO: This must go in metacall-environment-macos.sh as base dependencies
- name: Configure Clang
- name: Configure Clang
run: |
brew install llvm cmake git wget gnupg ca-certificates
Expand All @@ -51,13 +51,18 @@ jobs:
cd build
bash ../tools/metacall-configure.sh $METACALL_CONFIGURE_OPTIONS
env:
METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage
METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer python # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage

- name: Build
working-directory: ./build
# TODO: Remove the disable option for fork safe once funchook problem is solved
run: |
cmake -DOPTION_FORK_SAFE=OFF ..
cmake -DOPTION_FORK_SAFE=OFF \
-DPython_INCLUDE_DIRS="$HOME/.pyenv/versions/3.11.1/include/python3.11" \
-DPython_LIBRARY="$HOME/.pyenv/versions/3.11.1/lib/libpython3.11.dylib" \
-DPython_EXECUTABLE="$HOME/.pyenv/versions/3.11.1/bin/python3.11" \
-DPython_ROOT="$HOME/.pyenv/versions/3.11.1" \
-DPython_VERSION="3.11.1" ..
bash ../tools/metacall-build.sh $METACALL_BUILD_OPTIONS
env:
METACALL_BUILD_OPTIONS: ${{ matrix.buildtype }} tests
12 changes: 10 additions & 2 deletions tools/metacall-environment-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,16 @@ sub_swig() {

# Python
sub_python() {
echo "configuring python"
brew install python3 python3-pip
echo "configuring python"
brew install pyenv openssl
export PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig
export PYTHON_CONFIGURE_OPTS="--enable-shared"
pyenv install 3.11.1
pyenv global 3.11.1
pyenv rehash
echo -e '\nif command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
source ~/.bash_profile
which python3
pip3 install requests
pip3 install setuptools
pip3 install wheel
Expand Down

0 comments on commit bb79a77

Please sign in to comment.