diff --git a/PyIlmBase/CMakeLists.txt b/PyIlmBase/CMakeLists.txt index d7d2b113..0ee305a8 100644 --- a/PyIlmBase/CMakeLists.txt +++ b/PyIlmBase/CMakeLists.txt @@ -140,6 +140,10 @@ include(config/ModuleDefine.cmake) ########################## add_subdirectory(config) +if(NOT BUILD_SHARED_LIBS) + message(WARNING "Forcing python bindings to be built with dynamic libraries") +endif() + add_subdirectory( PyIex ) add_subdirectory( PyImath ) if(TARGET Python2::IlmBaseNumPy OR TARGET Python3::IlmBaseNumPy) diff --git a/PyIlmBase/config/ModuleDefine.cmake b/PyIlmBase/config/ModuleDefine.cmake index abf3f06a..85ff0565 100644 --- a/PyIlmBase/config/ModuleDefine.cmake +++ b/PyIlmBase/config/ModuleDefine.cmake @@ -8,15 +8,17 @@ function(PYILMBASE_ADD_LIBRARY_PRIV libname) cmake_parse_arguments(PYILMBASE_CURLIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - # let the default behaviour BUILD_SHARED_LIBS control the - # disposition of the default library... - add_library(${libname} ${PYILMBASE_CURLIB_SOURCE}) - if(BUILD_SHARED_LIBS) - set_target_properties(${libname} PROPERTIES - SOVERSION ${PYILMBASE_SOVERSION} - VERSION ${PYILMBASE_LIB_VERSION} - ) - endif() + # Currently, the python bindings REQUIRE a shared library for + # the Iex stuff to be initialized correctly. As such, force that + # here + # TODO Change this back when these bindings are refactored + add_library(${libname} SHARED ${PYILMBASE_CURLIB_SOURCE}) + #if(BUILD_SHARED_LIBS) + set_target_properties(${libname} PROPERTIES + SOVERSION ${PYILMBASE_SOVERSION} + VERSION ${PYILMBASE_LIB_VERSION} + ) + #endif() set_target_properties(${libname} PROPERTIES OUTPUT_NAME "${PYILMBASE_CURLIB_OUTROOT}${libname}${PYILMBASE_LIB_SUFFIX}" )