mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-17 00:10:34 +05:00
make dynamic linking of python optional
This commit is contained in:
parent
f7a91121a8
commit
339f8a1934
@ -29,6 +29,7 @@ option( USE_SPDLOG "Enable spd log logging" OFF)
|
|||||||
option( DEBUG_LOG "Enable more debug output (may increase computation time) - only works with USE_SPDLOG=ON" OFF)
|
option( DEBUG_LOG "Enable more debug output (may increase computation time) - only works with USE_SPDLOG=ON" OFF)
|
||||||
option( CHECK_RANGE "Check array range access, automatically enabled if built in debug mode" OFF)
|
option( CHECK_RANGE "Check array range access, automatically enabled if built in debug mode" OFF)
|
||||||
option( BUILD_WITH_CONDA "set this to on if the library is compiled with conda-buid" OFF)
|
option( BUILD_WITH_CONDA "set this to on if the library is compiled with conda-buid" OFF)
|
||||||
|
option( DYNAMIC_LINK_PYTHON "set this to OFF for static linking to python" ON)
|
||||||
|
|
||||||
option( USE_SUPERBUILD "use ccache" ON)
|
option( USE_SUPERBUILD "use ccache" ON)
|
||||||
|
|
||||||
|
@ -28,8 +28,9 @@ install(TARGETS ngcore DESTINATION ${NG_INSTALL_DIR} COMPONENT netgen)
|
|||||||
|
|
||||||
if(USE_PYTHON)
|
if(USE_PYTHON)
|
||||||
target_compile_definitions(ngcore PUBLIC NETGEN_PYTHON)
|
target_compile_definitions(ngcore PUBLIC NETGEN_PYTHON)
|
||||||
target_include_directories(ngcore PUBLIC ${PYTHON_INCLUDE_DIRS})
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
target_link_libraries(ngcore PUBLIC ${PYTHON_LIBRARIES})
|
target_include_directories(ngcore PUBLIC ${PYTHON_INCLUDE_DIRS})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
endif(USE_PYTHON)
|
endif(USE_PYTHON)
|
||||||
|
|
||||||
install(FILES ngcore.hpp archive.hpp type_traits.hpp version.hpp ngcore_api.hpp logging.hpp
|
install(FILES ngcore.hpp archive.hpp type_traits.hpp version.hpp ngcore_api.hpp logging.hpp
|
||||||
@ -42,7 +43,9 @@ endif(ENABLE_CPP_CORE_GUIDELINES_CHECK)
|
|||||||
|
|
||||||
if(USE_PYTHON)
|
if(USE_PYTHON)
|
||||||
pybind11_add_module(pyngcore SHARED python_ngcore.cpp)
|
pybind11_add_module(pyngcore SHARED python_ngcore.cpp)
|
||||||
target_link_libraries(pyngcore PUBLIC ngcore ${PYTHON_LIBRARIES})
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries(pyngcore PUBLIC ngcore ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
set_target_properties(pyngcore PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/${NETGEN_PYTHON_RPATH}")
|
set_target_properties(pyngcore PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/${NETGEN_PYTHON_RPATH}")
|
||||||
install(TARGETS pyngcore DESTINATION ${NG_INSTALL_DIR_PYTHON} COMPONENT netgen)
|
install(TARGETS pyngcore DESTINATION ${NG_INSTALL_DIR_PYTHON} COMPONENT netgen)
|
||||||
endif(USE_PYTHON)
|
endif(USE_PYTHON)
|
||||||
|
@ -11,7 +11,10 @@ if(APPLE)
|
|||||||
set_target_properties( csg PROPERTIES SUFFIX ".so")
|
set_target_properties( csg PROPERTIES SUFFIX ".so")
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
target_link_libraries(csg PUBLIC mesh ${PYTHON_LIBRARIES})
|
target_link_libraries(csg PUBLIC mesh)
|
||||||
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries(csg PUBLIC ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
install( TARGETS csg ${NG_INSTALL_DIR})
|
install( TARGETS csg ${NG_INSTALL_DIR})
|
||||||
|
|
||||||
target_link_libraries(csg PUBLIC ngcore)
|
target_link_libraries(csg PUBLIC ngcore)
|
||||||
|
@ -4,7 +4,10 @@ if(APPLE)
|
|||||||
set_target_properties( geom2d PROPERTIES SUFFIX ".so")
|
set_target_properties( geom2d PROPERTIES SUFFIX ".so")
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
target_link_libraries(geom2d mesh ${PYTHON_LIBRARIES})
|
target_link_libraries(geom2d mesh)
|
||||||
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries(geom2d ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
install( TARGETS geom2d ${NG_INSTALL_DIR})
|
install( TARGETS geom2d ${NG_INSTALL_DIR})
|
||||||
|
|
||||||
target_link_libraries(geom2d ngcore)
|
target_link_libraries(geom2d ngcore)
|
||||||
|
@ -22,8 +22,11 @@ if(APPLE)
|
|||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
target_link_libraries( mesh PUBLIC ngcore PRIVATE gprim la gen )
|
target_link_libraries( mesh PUBLIC ngcore PRIVATE gprim la gen )
|
||||||
|
target_link_libraries( mesh PUBLIC ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${METIS_LIBRARY})
|
||||||
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries(mesh PUBLIC ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
|
|
||||||
target_link_libraries( mesh PUBLIC ${ZLIB_LIBRARIES} ${MPI_CXX_LIBRARIES} ${PYTHON_LIBRARIES} ${METIS_LIBRARY})
|
|
||||||
install( TARGETS mesh ${NG_INSTALL_DIR})
|
install( TARGETS mesh ${NG_INSTALL_DIR})
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
|
@ -11,7 +11,10 @@ endif(USE_GUI)
|
|||||||
target_link_libraries(occ PUBLIC ngcore)
|
target_link_libraries(occ PUBLIC ngcore)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
target_link_libraries( occ PUBLIC ${OCC_LIBRARIES} ${PYTHON_LIBRARIES})
|
target_link_libraries( occ PUBLIC ${OCC_LIBRARIES})
|
||||||
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries(occ PUBLIC ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
install( TARGETS occ ${NG_INSTALL_DIR})
|
install( TARGETS occ ${NG_INSTALL_DIR})
|
||||||
if (USE_GUI)
|
if (USE_GUI)
|
||||||
target_link_libraries( occvis PUBLIC occ )
|
target_link_libraries( occvis PUBLIC occ )
|
||||||
|
@ -4,7 +4,10 @@ add_library(stl ${NG_LIB_TYPE}
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
target_link_libraries( stl mesh ${PYTHON_LIBRARIES})
|
target_link_libraries( stl mesh )
|
||||||
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries( stl ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
install( TARGETS stl ${NG_INSTALL_DIR})
|
install( TARGETS stl ${NG_INSTALL_DIR})
|
||||||
endif(NOT WIN32)
|
endif(NOT WIN32)
|
||||||
|
|
||||||
|
@ -9,7 +9,10 @@ endif(USE_GUI)
|
|||||||
|
|
||||||
add_library(visual ${NG_LIB_TYPE} ${LIB_VISUAL_SOURCES})
|
add_library(visual ${NG_LIB_TYPE} ${LIB_VISUAL_SOURCES})
|
||||||
|
|
||||||
target_link_libraries( visual ngcore ${PYTHON_LIBRARIES} ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} )
|
target_link_libraries( visual ngcore ${MPI_CXX_LIBRARIES} ${OPENGL_LIBRARIES} )
|
||||||
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries( visual ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
install( TARGETS visual ${NG_INSTALL_DIR})
|
install( TARGETS visual ${NG_INSTALL_DIR})
|
||||||
|
|
||||||
install(FILES
|
install(FILES
|
||||||
|
@ -51,7 +51,10 @@ endif(USE_GUI)
|
|||||||
|
|
||||||
if(USE_PYTHON)
|
if(USE_PYTHON)
|
||||||
add_library(ngpy SHARED netgenpy.cpp)
|
add_library(ngpy SHARED netgenpy.cpp)
|
||||||
target_link_libraries( ngpy PUBLIC nglib PRIVATE ${PYTHON_LIBRARIES})
|
target_link_libraries( ngpy PUBLIC nglib)
|
||||||
|
if(DYNAMIC_LINK_PYTHON)
|
||||||
|
target_link_libraries(ngpy PRIVATE ${PYTHON_LIBRARIES})
|
||||||
|
endif(DYNAMIC_LINK_PYTHON)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set_target_properties( ngpy PROPERTIES SUFFIX ".so")
|
set_target_properties( ngpy PROPERTIES SUFFIX ".so")
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
|
@ -38,9 +38,9 @@ if(USE_OCC AND NOT WIN32)
|
|||||||
target_link_libraries(nglib PUBLIC occ)
|
target_link_libraries(nglib PUBLIC occ)
|
||||||
endif(USE_OCC AND NOT WIN32)
|
endif(USE_OCC AND NOT WIN32)
|
||||||
|
|
||||||
if(USE_PYTHON)
|
if(USE_PYTHON AND DYNAMIC_LINK_PYTHON)
|
||||||
target_link_libraries(nglib PRIVATE ${PYTHON_LIBRARIES})
|
target_link_libraries(nglib PRIVATE ${PYTHON_LIBRARIES})
|
||||||
endif(USE_PYTHON)
|
endif(USE_PYTHON AND DYNAMIC_LINK_PYTHON)
|
||||||
|
|
||||||
install(TARGETS nglib ${NG_INSTALL_DIR})
|
install(TARGETS nglib ${NG_INSTALL_DIR})
|
||||||
install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)
|
install(FILES nglib.h DESTINATION ${NG_INSTALL_DIR_INCLUDE} COMPONENT netgen_devel)
|
||||||
|
Loading…
Reference in New Issue
Block a user