@@ -10,8 +10,6 @@ OPTION(ENABLE_TESTS "Enable tests." ON)
10
10
OPTION (USE_BUILD_SCRIPT_OUTPUT "Use the ifcopenshell nix/build-all.py or win/build-all.cmd build script output to find dependencies." ON )
11
11
OPTION (ENABLE_PYTHON_WRAPPER "Enable Python wrapper." OFF )
12
12
13
- cmake_policy (SET CMP0148 OLD )
14
-
15
13
include (CTest )
16
14
17
15
if (CMAKE_SIZEOF_VOID_P EQUAL 8 )
@@ -318,17 +316,14 @@ if (ENABLE_PYTHON_WRAPPER)
318
316
MESSAGE (FATAL_ERROR "ENABLE_PYTHON_WRAPPER enabled, but unable to find SWIG. Disable ENABLE_PYTHON_WRAPPER or fix SWIG paths to proceed." )
319
317
ENDIF ()
320
318
INCLUDE (${SWIG_USE_FILE} )
321
- find_package (PythonLibs )
322
- IF (NOT PYTHONLIBS_FOUND OR "$PYTHON_INCLUDE_DIRS}" STREQUAL "" )
319
+ find_package (Python COMPONENTS Interpreter Development )
320
+ IF (NOT Python_FOUND )
323
321
MESSAGE (FATAL_ERROR "ENABLE_PYTHON_WRAPPER enabled, but unable to find Python lib or header. Disable ENABLE_PYTHON_WRAPPER or fix Python paths to proceed." )
324
322
ENDIF ()
325
- find_package (PythonInterp )
326
- IF (NOT PYTHONINTERP_FOUND OR "${PYTHON_EXECUTABLE} " STREQUAL "" )
327
- MESSAGE (FATAL_ERROR "ENABLE_PYTHON_WRAPPER enabled, but unable to find Python interpreter. Disable ENABLE_PYTHON_WRAPPER or fix Python paths to proceed." )
328
- ENDIF ()
329
-
330
- INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_DIRS} )
323
+
324
+ INCLUDE_DIRECTORIES (${Python_INCLUDE_DIRS} )
331
325
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} )
326
+ link_directories (${Python_LIBRARY_DIRS} )
332
327
333
328
SET (CMAKE_SWIG_FLAGS ${SWIG_DEFINES} )
334
329
SET_SOURCE_FILES_PROPERTIES (wrap/wrapper.i PROPERTIES CPLUSPLUS ON )
@@ -337,40 +332,26 @@ if (ENABLE_PYTHON_WRAPPER)
337
332
# On osx there is some state in the python dylib. With `-Wl,undefined,suppress` we can ignore the missing symbols at compile time.
338
333
SWIG_LINK_LIBRARIES (voxec libvoxec )
339
334
else ()
340
- SWIG_LINK_LIBRARIES (voxec libvoxec ${PYTHON_LIBRARIES } )
335
+ SWIG_LINK_LIBRARIES (voxec libvoxec ${Python_LIBRARIES } )
341
336
endif ()
342
337
343
- EXECUTE_PROCESS (
344
- COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
345
- OUTPUT_VARIABLE PYTHON_EXTENSION_SUFFIX
346
- OUTPUT_STRIP_TRAILING_WHITESPACE
347
- )
348
- MESSAGE (STATUS "${PYTHON_EXTENSION_SUFFIX} " )
349
- SET_TARGET_PROPERTIES (${SWIG_MODULE_voxec_REAL_NAME} PROPERTIES SUFFIX ${PYTHON_EXTENSION_SUFFIX} )
350
-
351
- EXECUTE_PROCESS (
352
- COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'))"
353
- OUTPUT_VARIABLE PYTHON_PLATLIB
354
- OUTPUT_STRIP_TRAILING_WHITESPACE
355
- )
356
-
357
- INSTALL (FILES "${CMAKE_BINARY_DIR} /voxec.py" "${CMAKE_CURRENT_SOURCE_DIR} /module/__init__.py"
358
- DESTINATION "${PYTHON_PLATLIB} /voxec/" )
359
- INSTALL (TARGETS ${SWIG_MODULE_voxec_REAL_NAME}
360
- DESTINATION "${PYTHON_PLATLIB} /voxec/" )
338
+ INSTALL (FILES "${CMAKE_BINARY_DIR} /voxec.py" "${CMAKE_CURRENT_SOURCE_DIR} /module/__init__.py"
339
+ DESTINATION "${Python_SITEARCH} /voxec/" )
340
+ INSTALL (TARGETS ${SWIG_MODULE_voxec_REAL_NAME}
341
+ DESTINATION "${Python_SITEARCH} /voxec/" )
361
342
endif ()
362
343
363
344
if (ENABLE_TESTS )
364
345
file (GLOB test_filenames tests/*.cpp )
365
346
foreach (filename ${test_filenames} )
366
- get_filename_component (test_name ${filename} NAME_WE )
367
- add_executable ("${test_name} " ${filename} )
368
- SET (libvoxec_IF_USED "" )
369
- if ("${test_name} " MATCHES "parser" )
370
- SET (libvoxec_IF_USED libvoxec )
371
- endif ()
372
- target_link_libraries ("${test_name} " gtest_main libvoxel ${libvoxec_IF_USED} ${IFC_LIBRARIES} ${ICU_LIBRARIES} ${Boost_LIBRARIES} ${OCC_LIBRARIES} ${LIB_RT} ${dl} ${CMAKE_THREAD_LIBS_INIT} )
373
- add_test (NAME "${test_name} " COMMAND "${test_name} " )
347
+ get_filename_component (test_name ${filename} NAME_WE )
348
+ add_executable ("${test_name} " ${filename} )
349
+ SET (libvoxec_IF_USED "" )
350
+ if ("${test_name} " MATCHES "parser" )
351
+ SET (libvoxec_IF_USED libvoxec )
352
+ endif ()
353
+ target_link_libraries ("${test_name} " gtest_main libvoxel ${libvoxec_IF_USED} ${IFC_LIBRARIES} ${ICU_LIBRARIES} ${Boost_LIBRARIES} ${OCC_LIBRARIES} ${LIB_RT} ${dl} ${CMAKE_THREAD_LIBS_INIT} )
354
+ add_test (NAME "${test_name} " COMMAND "${test_name} " )
374
355
endforeach ()
375
356
endif ()
376
357
@@ -382,8 +363,8 @@ target_link_libraries(voxec_exe libvoxec)
382
363
set_property (TARGET voxec_exe PROPERTY OUTPUT_NAME voxec )
383
364
384
365
install (TARGETS voxec_exe libvoxel libvoxec
385
- RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} /bin
386
- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} /lib
387
- ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX} /lib )
366
+ RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX} /bin
367
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} /lib
368
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX} /lib )
388
369
389
370
install (FILES ${LIBVOXELIZER_HEADER_FILES} ${LIBVOXEC_HEADER_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} /include/voxel )
0 commit comments