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
This commit is contained in:
Joost van Amersfoort 2017-07-15 02:12:00 +01:00 committed by Davis E. King
parent be8b5cd01b
commit 4a4fd91a26
1 changed files with 13 additions and 4 deletions

View File

@ -69,10 +69,10 @@ if (PYTHON3)
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
endif()
set(Python_ADDITIONAL_VERSIONS 3.5 3.6)
FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
FIND_PACKAGE(PythonLibs 3.4)
else()
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
FIND_PACKAGE(PythonLibs 2.6 REQUIRED)
FIND_PACKAGE(PythonLibs 2.6)
endif()
if (NOT Boost_FOUND)
@ -126,7 +126,6 @@ else()
endif()
message(STATUS "USING BOOST_LIBS: ${Boost_LIBRARIES}")
message(STATUS "USING PYTHON_LIBS: ${PYTHON_LIBRARIES}")
if (CMAKE_COMPILER_IS_GNUCXX)
# Just setting CMAKE_POSITION_INDEPENDENT_CODE should be enough to set
@ -148,7 +147,8 @@ include(${CMAKE_CURRENT_LIST_DIR}/../cmake)
# output name is set to what the user asked for (i.e. no _).
macro(add_python_module module_name module_sources )
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)
SET_TARGET_PROPERTIES( ${module_name}_
PROPERTIES
@ -163,9 +163,18 @@ macro(add_python_module module_name module_sources )
SUFFIX ".dll"
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()
SET_TARGET_PROPERTIES( ${module_name}_
PROPERTIES
LINK_FLAGS "-shared"
PREFIX ""
SUFFIX ".so"
OUTPUT_NAME ${module_name}