From 1f339736154ea588144f917fa5eac61cdff82331 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 07:57:52 -0700 Subject: [PATCH 01/11] Prepare for mac --- source/CMakeLists.txt | 6 +++++- test/CMakeLists.txt | 22 ++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index c8614837..31a3fa2f 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 (APPLE) + 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 4fb5546a..111b124e 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 (APPLE) + 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) + 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) From a8fc653aa53b43cf809771370cdd1bb281e30d0f Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 08:17:52 -0700 Subject: [PATCH 02/11] added OSX CI --- .github/workflows/main.yml | 12 ++++++++++++ .github/workflows/osx/entrypoint.sh | 11 +++++++++++ test/CMakeLists.txt | 13 ++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 .github/workflows/osx/entrypoint.sh 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..b31ec4cf --- /dev/null +++ b/.github/workflows/osx/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/sh -l +set -x +brew install wget coreutils +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 -Jxo 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/test/CMakeLists.txt b/test/CMakeLists.txt index 9ab129ea..dd75d280 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,7 +19,7 @@ else() if (APPLE) 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} + 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} @@ -111,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 (APPLE) + 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}) From fe1125d7a40737eafaad73401d50fca1e6fa2453 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 08:25:20 -0700 Subject: [PATCH 03/11] Try to fix CI --- .github/workflows/osx/entrypoint.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/osx/entrypoint.sh b/.github/workflows/osx/entrypoint.sh index b31ec4cf..d7bdee3b 100755 --- a/.github/workflows/osx/entrypoint.sh +++ b/.github/workflows/osx/entrypoint.sh @@ -1,8 +1,9 @@ #!/bin/sh -l set -x -brew install wget coreutils +brew install wget coreutils xz 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 -Jxo clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +xz -d clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +tar -x clang+llvm-11.0.0-x86_64-apple-darwin.tar export PATH=$PATH:clang+llvm-11.0.0-x86_64-apple-darwin/bin cmake CMakeLists.txt From a1944d8241fb53cf33a8ce0722eb1ea896df4549 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 08:31:06 -0700 Subject: [PATCH 04/11] Try to fix CI --- .github/workflows/osx/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/osx/entrypoint.sh b/.github/workflows/osx/entrypoint.sh index d7bdee3b..b48d0ad7 100755 --- a/.github/workflows/osx/entrypoint.sh +++ b/.github/workflows/osx/entrypoint.sh @@ -2,7 +2,9 @@ set -x brew install wget coreutils xz 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 xz -d clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +ls tar -x clang+llvm-11.0.0-x86_64-apple-darwin.tar export PATH=$PATH:clang+llvm-11.0.0-x86_64-apple-darwin/bin From ce900a70103ea34346fe28ffbd849a6f74a0c944 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 08:34:21 -0700 Subject: [PATCH 05/11] Try to fix CI --- .github/workflows/osx/entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/osx/entrypoint.sh b/.github/workflows/osx/entrypoint.sh index b48d0ad7..a7f35089 100755 --- a/.github/workflows/osx/entrypoint.sh +++ b/.github/workflows/osx/entrypoint.sh @@ -3,9 +3,10 @@ set -x brew install wget coreutils xz 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 -xz -d clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz -ls -tar -x clang+llvm-11.0.0-x86_64-apple-darwin.tar +tar -xJvf clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +#xz -d clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +#ls +#tar -x clang+llvm-11.0.0-x86_64-apple-darwin.tar export PATH=$PATH:clang+llvm-11.0.0-x86_64-apple-darwin/bin cmake CMakeLists.txt From 70bca932e250723778bb0245edb1dd57c7b5458b Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 08:35:37 -0700 Subject: [PATCH 06/11] Try to fix CI --- .github/workflows/osx/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osx/entrypoint.sh b/.github/workflows/osx/entrypoint.sh index a7f35089..2a03a363 100755 --- a/.github/workflows/osx/entrypoint.sh +++ b/.github/workflows/osx/entrypoint.sh @@ -3,7 +3,7 @@ set -x brew install wget coreutils xz 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 -xJvf clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz +tar -xJf clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz #xz -d clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz #ls #tar -x clang+llvm-11.0.0-x86_64-apple-darwin.tar From b1e429cce0d922821cf21fb73a70368f71e091ab Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 08:35:55 -0700 Subject: [PATCH 07/11] Try to fix CI --- .github/workflows/osx/entrypoint.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/osx/entrypoint.sh b/.github/workflows/osx/entrypoint.sh index 2a03a363..7178368d 100755 --- a/.github/workflows/osx/entrypoint.sh +++ b/.github/workflows/osx/entrypoint.sh @@ -4,9 +4,6 @@ brew install wget coreutils xz 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 -#xz -d clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz -#ls -#tar -x clang+llvm-11.0.0-x86_64-apple-darwin.tar export PATH=$PATH:clang+llvm-11.0.0-x86_64-apple-darwin/bin cmake CMakeLists.txt From 22afcb5825448b5e25dd77d1d616281218c7b914 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 08:46:11 -0700 Subject: [PATCH 08/11] Try to fix CI --- .github/workflows/osx/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/osx/entrypoint.sh b/.github/workflows/osx/entrypoint.sh index 7178368d..6de6f1e5 100755 --- a/.github/workflows/osx/entrypoint.sh +++ b/.github/workflows/osx/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/sh -l set -x -brew install wget coreutils xz +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 From 0295b38c1c45e7ab558be599afdd868ec0038cb4 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 09:13:45 -0700 Subject: [PATCH 09/11] Check Darwin --- source/CMakeLists.txt | 2 +- test/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 31a3fa2f..70a9f2df 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -40,7 +40,7 @@ if(USE_EXTERNAL_LLVM) REQUIRED ) else() - if (APPLE) + if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") set(lib_llvm_path ) else() find_library(lib_llvm_path NAMES LLVM diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dd75d280..a825585b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -16,7 +16,7 @@ else() SET(${stestname}_config_flag --config ${stestname}.config ) endif() file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${stestname}.hpp.include "#include <${stestname}.hpp>" ) - if (APPLE) + 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/ @@ -111,7 +111,7 @@ 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 (APPLE) +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) From 5f489cb25f9dd39efb3d1c1944528b55faa199e6 Mon Sep 17 00:00:00 2001 From: Andrii Verbytskyi Date: Sat, 24 Oct 2020 09:22:45 -0700 Subject: [PATCH 10/11] Added docs --- documentation/install.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/documentation/install.rst b/documentation/install.rst index 0e4562bd..1f6aa165 100644 --- a/documentation/install.rst +++ b/documentation/install.rst @@ -138,6 +138,24 @@ 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 + + + 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 ******** From c1d56c4b06158d30d21a486a6d80b6aaf8bd68ce Mon Sep 17 00:00:00 2001 From: andriish Date: Tue, 27 Oct 2020 22:51:20 +0100 Subject: [PATCH 11/11] Update install.rst --- documentation/install.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/documentation/install.rst b/documentation/install.rst index 1f6aa165..075617e4 100644 --- a/documentation/install.rst +++ b/documentation/install.rst @@ -146,7 +146,9 @@ For MacOSX: 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: