Skip to content

Commit

Permalink
Simplified configuration on a Mac (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
william-dawson authored Nov 16, 2020
1 parent d7d0193 commit 67d28ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
9 changes: 4 additions & 5 deletions Source/Swig/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ if(NOT DEFINED PYTHON_EXECUTABLE)
endif()

include(ConfigPython.cmake)
if (APPLE)
get_py_lib()
message(STATUS "Using Python Library Path:" ${PYTHON_LIBRARIES})
endif()
get_py_include()
message(STATUS "Using Python Include Path:" ${PYTHON_INCLUDE_PATH})

Expand All @@ -33,8 +29,11 @@ if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
else()
swig_add_library(NTPolySwig LANGUAGE python SOURCES ${Swigsrc})
endif()
if (APPLE)
set(APPLE_SUPRESS "-flat_namespace -undefined suppress")
endif()
swig_link_libraries(NTPolySwig NTPolyCPP NTPolyWrapper NTPoly
${PYTHON_LIBRARIES} ${TOOLCHAIN_LIBS})
${TOOLCHAIN_LIBS} ${APPLE_SUPRESS})
set_target_properties(_NTPolySwig PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/python
Expand Down
12 changes: 0 additions & 12 deletions Source/Swig/ConfigPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,3 @@ macro(get_py_include)
"from distutils.sysconfig import get_python_inc; print(get_python_inc())"
OUTPUT_VARIABLE PYTHON_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
endmacro()

################################################################################
# Determine Python Library Path
macro(get_py_lib)
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c
"
from distutils.sysconfig import get_python_lib
path=get_python_lib(standard_lib=True)+\"/../../Python\"
print(path)"
OUTPUT_VARIABLE PYTHON_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
endmacro()

0 comments on commit 67d28ef

Please sign in to comment.