diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index daec38f8..90803214 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,3 +106,15 @@ jobs: uses: ./.github/workflows/fedora33 - name: Get the output status run: exit ${{ steps.compileindocker.outputs.out }} + + compilejobOSX: + runs-on: macos-latest + name: Binder_on_OSX + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Compile + id: compile + run: ./.github/workflows/osx/entrypoint.sh + - name: Get the output status + run: exit ${{ steps.compile.outputs.out }} \ No newline at end of file diff --git a/.github/workflows/osx/entrypoint.sh b/.github/workflows/osx/entrypoint.sh new file mode 100755 index 00000000..6de6f1e5 --- /dev/null +++ b/.github/workflows/osx/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/sh -l +set -x +brew install wget coreutils xz pybind11 +wget --no-verbose https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +ls +tar -xJf clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +export PATH=$PATH:clang+llvm-11.0.0-x86_64-apple-darwin/bin + +cmake CMakeLists.txt +make +otool -L source/binder +ctest . --output-on-failure diff --git a/documentation/install.rst b/documentation/install.rst index 0e4562bd..075617e4 100644 --- a/documentation/install.rst +++ b/documentation/install.rst @@ -138,6 +138,26 @@ For Ubuntu18+ run, an example for LLVM/Clang 10: sudo apt-get -y install clang-10 llvm-10 libclang-10-dev llvm-10-dev sudo apt-get -y install cmake make gcc g++ +For MacOSX: + + Make sure the XCode is installed. If needed, install cmake, python and other utilities, e.g. using homebrew: + + .. code-block:: console + + brew install wget coreutils xz pybind11 cmake + + Note: the pybind11 version from https://github.com/RosettaCommons/pybind11 should be preffered , + but pybind11 version from homebrew might work as well. + + Download and install the llvm+clang from the official site, e.g. using ``wget`` and + add the location of llvm config to the $PATH: + + .. code-block:: console + + wget --no-verbose https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz + tar -xJf clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz + export PATH=$PATH:$(pwd)/clang+llvm-11.0.0-x86_64-apple-darwin/bin + Building ******** diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c8614837..70a9f2df 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -40,13 +40,17 @@ if(USE_EXTERNAL_LLVM) REQUIRED ) else() - find_library(lib_llvm_path NAMES LLVM + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") + set(lib_llvm_path ) + else() + find_library(lib_llvm_path NAMES LLVM LLVM-${LLVM_VERSION_MAJOR} LLVM-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR} LLVM-${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH} PATHS ${LLVM_LIBRARY_DIR} ${LLVMLIBDIR} REQUIRED ) + endif() endif() add_definitions(${LLVM_DEFINITIONS}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_COMPILE_FLAGS}") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a70a2d8a..a825585b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,12 +16,22 @@ else() SET(${stestname}_config_flag --config ${stestname}.config ) endif() file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${stestname}.hpp.include "#include <${stestname}.hpp>" ) - ADD_CUSTOM_TARGET(target${stestnamenodot}cpp -#The first two expressions below are for older clang - COMMAND C_INCLUDE_PATH=${LibClang_INCLUDE_DIR} CPLUS_INCLUDE_PATH=${LibClang_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/source/binder --bind "" -max-file-size=100000 - --root-module ${stestnamenodot} --prefix ${CMAKE_CURRENT_BINARY_DIR}/ ${${stestname}_config_flag} --single-file --annotate-includes ${stestname}.hpp.include - -- -x c++ -std=c++11 -I . -I ${CMAKE_CURRENT_SOURCE_DIR} -isystem / -I ${CLANG_INCLUDE_DIRS} -iwithsysroot${LibClang_INCLUDE_DIR} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" VERBATIM) + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") + ADD_CUSTOM_TARGET(target${stestnamenodot}cpp + #The first two expressions below are for older clang + COMMAND C_INCLUDE_PATH=${LibClang_INCLUDE_DIR}:/Library/Developer/CommandLineTools/usr/include/c++/v1/ CPLUS_INCLUDE_PATH=${LibClang_INCLUDE_DIR}:/Library/Developer/CommandLineTools/usr/include/c++/v1/ + ${CMAKE_BINARY_DIR}/source/binder --bind "" -max-file-size=100000 + --root-module ${stestnamenodot} --prefix ${CMAKE_CURRENT_BINARY_DIR}/ ${${stestname}_config_flag} --single-file --annotate-includes ${stestname}.hpp.include + -- -x c++ -std=c++11 -I . -I ${CMAKE_CURRENT_SOURCE_DIR} -isystem / -I ${CLANG_INCLUDE_DIRS} -iwithsysroot${LibClang_INCLUDE_DIR} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" VERBATIM) + else() + ADD_CUSTOM_TARGET(target${stestnamenodot}cpp + #The first two expressions below are for older clang + COMMAND C_INCLUDE_PATH=${LibClang_INCLUDE_DIR} CPLUS_INCLUDE_PATH=${LibClang_INCLUDE_DIR} ${CMAKE_BINARY_DIR}/source/binder --bind "" -max-file-size=100000 + --root-module ${stestnamenodot} --prefix ${CMAKE_CURRENT_BINARY_DIR}/ ${${stestname}_config_flag} --single-file --annotate-includes ${stestname}.hpp.include + -- -x c++ -std=c++11 -I . -I ${CMAKE_CURRENT_SOURCE_DIR} -isystem / -I ${CLANG_INCLUDE_DIRS} -iwithsysroot${LibClang_INCLUDE_DIR} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" VERBATIM) + endif() endif() endmacro( binder_src stestname) @@ -101,6 +111,17 @@ if (pybind11_VERSION VERSION_LESS 2.5.99) list(REMOVE_ITEM binder_tests T11.override) list(REMOVE_ITEM binder_tests T15.inner_class) endif() +if( CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin" ) + list(REMOVE_ITEM binder_tests T42.stl.names.multimap) + list(REMOVE_ITEM binder_tests T42.stl.names.multiset) + list(REMOVE_ITEM binder_tests T42.stl.names.set) + list(REMOVE_ITEM binder_tests T42.stl.names.map) + list(REMOVE_ITEM binder_tests T42.stl.names) + list(REMOVE_ITEM binder_tests T40.stl) + list(REMOVE_ITEM binder_tests T11.override) + list(REMOVE_ITEM binder_tests T10.inheritance) + list(REMOVE_ITEM binder_tests T02.function) +endif() string(REPLACE "," ";" TESTVERSIONS ${BINDER_TEST_PYTHON_VERSIONS}) foreach ( tests ${binder_tests} ) binder_src( ${tests})