Skip to content

Commit

Permalink
working python wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
fradav committed Sep 23, 2020
1 parent ee70b14 commit 9e69c87
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
29 changes: 15 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 <iostream>
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 <iostream>
int main() { return _LIBCPP_VERSION; }" USES_LIBCXX)
if(USES_LIBCXX)
message("USING libc++")
endif()
endif()

endif()
endif()
Expand Down Expand Up @@ -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()
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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="[email protected]",
description="ABC random forests for model choice and parameter estimation, python wrapper",
Expand Down
4 changes: 4 additions & 0 deletions src/pyabcranger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9e69c87

Please sign in to comment.