diff --git a/CMakeLists.txt b/CMakeLists.txt index fb314755..c889b676 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,7 @@ set(model-GENERATED_UHDM ${GENDIR}/src/UHDM.capnp) set_source_files_properties(${model-GENERATED_UHDM} PROPERTIES GENERATED TRUE) file(GLOB py_SRC ${PROJECT_SOURCE_DIR}/scripts/*.py) +if(NOT EXISTS ${model-GENERATED_UHDM}) add_custom_command( OUTPUT ${model-GENERATED_UHDM} COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/generate.py --source-dirpath=${UHDM_SOURCE_DIR} -output-dirpath=${GENDIR} @@ -138,6 +139,7 @@ add_custom_command( ${yaml_SRC} ${templates_SRC} ${include_SRC}) +endif() set(model-GENERATED_SRC ${GENDIR}/src/UHDM.capnp.h ${GENDIR}/src/UHDM.capnp.c++) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 4ab5a784..f16eca77 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -23,8 +23,13 @@ swig_add_library(py_uhdm ${PROJECT_NAME}.i swig_test.cpp ) target_link_libraries(py_uhdm - PRIVATE uhdm ${Python3_LIBRARIES} + PRIVATE uhdm ) +IF(APPLE) + set_property(TARGET py_uhdm APPEND_STRING PROPERTY + LINK_FLAGS "-undefined dynamic_lookup") +ENDIF() + set_target_properties(py_uhdm PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/ ) @@ -38,11 +43,11 @@ execute_process( install( FILES ${CMAKE_CURRENT_BINARY_DIR}/uhdm.py - DESTINATION ${CMAKE_INSTALL_PREFIX}/${Python_site_packages} + DESTINATION ${Python_site_packages} ) install( - TARGETS ${SWIG_MODULE_py_udhm_REAL_NAME} - LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES} + TARGETS py_uhdm + LIBRARY DESTINATION ${Python_site_packages} ) add_test(