Commit 4a4fd91a authored by Joost van Amersfoort's avatar Joost van Amersfoort Committed by Davis E. King

remove linking to libpython on linux/OSX (#703)

* remove linking to libpython on linux

* add OSX libpython free building

* add automatic discovery of include python dir back in

* make the libs non required for building on manylinux
parent be8b5cd0
...@@ -69,10 +69,10 @@ if (PYTHON3) ...@@ -69,10 +69,10 @@ if (PYTHON3)
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python) FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
endif() endif()
set(Python_ADDITIONAL_VERSIONS 3.5 3.6) set(Python_ADDITIONAL_VERSIONS 3.5 3.6)
FIND_PACKAGE(PythonLibs 3.4 REQUIRED) FIND_PACKAGE(PythonLibs 3.4)
else() else()
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python) FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
FIND_PACKAGE(PythonLibs 2.6 REQUIRED) FIND_PACKAGE(PythonLibs 2.6)
endif() endif()
if (NOT Boost_FOUND) if (NOT Boost_FOUND)
...@@ -126,7 +126,6 @@ else() ...@@ -126,7 +126,6 @@ else()
endif() endif()
message(STATUS "USING BOOST_LIBS: ${Boost_LIBRARIES}") message(STATUS "USING BOOST_LIBS: ${Boost_LIBRARIES}")
message(STATUS "USING PYTHON_LIBS: ${PYTHON_LIBRARIES}")
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
# Just setting CMAKE_POSITION_INDEPENDENT_CODE should be enough to set # Just setting CMAKE_POSITION_INDEPENDENT_CODE should be enough to set
...@@ -148,7 +147,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/../cmake) ...@@ -148,7 +147,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/../cmake)
# output name is set to what the user asked for (i.e. no _). # output name is set to what the user asked for (i.e. no _).
macro(add_python_module module_name module_sources ) macro(add_python_module module_name module_sources )
ADD_LIBRARY(${module_name}_ SHARED ${module_sources} ${ARGN} ) ADD_LIBRARY(${module_name}_ SHARED ${module_sources} ${ARGN} )
TARGET_LINK_LIBRARIES(${module_name}_ ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} dlib::dlib) TARGET_LINK_LIBRARIES(${module_name}_ ${Boost_LIBRARIES} dlib::dlib)
if(WIN32 AND NOT CYGWIN) if(WIN32 AND NOT CYGWIN)
SET_TARGET_PROPERTIES( ${module_name}_ SET_TARGET_PROPERTIES( ${module_name}_
PROPERTIES PROPERTIES
...@@ -163,9 +163,18 @@ macro(add_python_module module_name module_sources ) ...@@ -163,9 +163,18 @@ macro(add_python_module module_name module_sources )
SUFFIX ".dll" SUFFIX ".dll"
OUTPUT_NAME ${module_name} OUTPUT_NAME ${module_name}
) )
elseif(APPLE)
SET_TARGET_PROPERTIES( ${module_name}_
PROPERTIES
LINK_FLAGS "-undefined dynamic_lookup"
PREFIX ""
SUFFIX ".so"
OUTPUT_NAME ${module_name}
)
else() else()
SET_TARGET_PROPERTIES( ${module_name}_ SET_TARGET_PROPERTIES( ${module_name}_
PROPERTIES PROPERTIES
LINK_FLAGS "-shared"
PREFIX "" PREFIX ""
SUFFIX ".so" SUFFIX ".so"
OUTPUT_NAME ${module_name} OUTPUT_NAME ${module_name}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment