diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c88c27..17b1122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,10 +83,10 @@ pmm( # DEBUG VCPKG # REVISION e37cc662ee29852f45e85961124f62d91acb488a - REVISION 56fffbe49dfb4dd8fae0940f272c5fd2b86be991 + REVISION 6185aa76504a5025f36754324abf307cc776f3da TRIPLET ${VCPKG_TARGET_TRIPLET} - REQUIRES range-v3 catch2 cxxopts fmt hdf5[cpp] eigen3-head highfive-head pybind11 ${TBBPKG} ${BOOSTREGEX} - PORTS "${PROJECT_SOURCE_DIR}/eigen3-head" "${PROJECT_SOURCE_DIR}/highfive-head" + REQUIRES range-v3 catch2 cxxopts fmt hdf5[cpp] eigen3-head highfive pybind11 ${TBBPKG} ${BOOSTREGEX} + PORTS "${PROJECT_SOURCE_DIR}/eigen3-head" ) if(MAKE_STATIC_EXE) @@ -107,17 +107,15 @@ if(MAKE_STATIC_EXE) else() set(MAKE_STATIC_FLAG_EXE "-static") -if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - message("USING Clang, checking libc++..") - include(CheckCXXSourceCompiles) - check_cxx_source_compiles("#include - int main() { return _LIBCPP_VERSION; }" USES_LIBCXX) - if(USES_LIBCXX) - message("USING libc++") - link_libraries(c++ c++abi) - endif() -endif() - + if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") + message("USING Clang, checking libc++..") + include(CheckCXXSourceCompiles) + check_cxx_source_compiles("#include + int main() { return _LIBCPP_VERSION; }" USES_LIBCXX) + if(USES_LIBCXX) + message("USING libc++") + endif() + endif() endif() endif() @@ -170,3 +168,6 @@ add_subdirectory(testpy) add_executable(abcranger ${ABCRANGER_SOURCE_DIR}/ModelChoice.cpp ${ABCRANGER_SOURCE_DIR}/EstimParam.cpp abcranger.cpp) target_link_libraries(abcranger ${MAKE_STATIC_FLAG_EXE} ${TBBLIB} cxxopts::cxxopts abcrangerlib) +if(USE_LIBCXX) + target_link_libraries(abcranger PRIVATE c++ c++abi) +endif() \ No newline at end of file diff --git a/setup.py b/setup.py index e672e4a..69a74a9 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,15 @@ from cmaketools import setup import os +os.environ["CC"] = "clang" +os.environ["CXX"] = "clang++" +os.environ["CXXFLAGS"] = "-stdlib=libc++" os.environ["VCPKG_KEEP_ENV_VARS"] = "CC;CXX;CXXFLAGS" os.environ["VCPKG_FORCE_SYSTEM_BINARIES"] = "1" setup( name="pyabcranger", - version="0.0.7", + version="0.0.17", author="François-David Collin", author_email="fradav@gmail.com", description="ABC random forests for model choice and parameter estimation, python wrapper", diff --git a/src/pyabcranger/CMakeLists.txt b/src/pyabcranger/CMakeLists.txt index 8b1662e..b0a734e 100644 --- a/src/pyabcranger/CMakeLists.txt +++ b/src/pyabcranger/CMakeLists.txt @@ -9,6 +9,10 @@ pybind11_add_module(pyabcranger ${ABCRANGER_SOURCE_DIR}/ModelChoice.cpp ${ABCRAN target_link_libraries(pyabcranger PRIVATE ${TBBLIB} Python::Python fmt::fmt cxxopts::cxxopts) target_compile_definitions(pyabcranger PRIVATE PYTHON_OUTPUT=1) +if (USES_LIBCXX) + target_link_options(pyabcranger PRIVATE -nodefaultlibs) + target_link_libraries(pyabcranger PRIVATE libc++.a libc++abi.a libgcc_eh.a libgcc.a) +endif() # install pyd files one directory structure UP in the destination as # CMAKE_CURRENT_SOURCE_DIR is holding the source files of the MODULE