mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-15 07:30:32 +05:00
b82796e58d
Add explicit defaults where missing for clarity. Support passing in NETGEN_GIT_VERSION for use when building, eg, RPM packages using rpkg, which requires building from an untagged source bundle, that is, not directly from a git checkout. Add option to choose build against internal or external Pybind11; add cmake module to find and configure against system Pybind. re-add versioning of shared library files. Add section for GCC-specific options setting (right now, to turn off harmless warnings). Warn if pybind11_stubgen is not found. Adjust stubgen paths to work when build is not in-place in the source tree.
79 lines
3.0 KiB
CMake
79 lines
3.0 KiB
CMake
if(USE_INTERNAL_TCL)
|
|
add_definitions(-DINTERNAL_TCL_DEFAULT=1)
|
|
else()
|
|
add_definitions(-DINTERNAL_TCL_DEFAULT=0)
|
|
endif()
|
|
|
|
if(WIN32)
|
|
# add icon and version info to netgen executable
|
|
enable_language(RC)
|
|
# Don't use ccache here due to incompatibility with the resource compiler
|
|
set_directory_properties(PROPERTIES RULE_LAUNCH_COMPILE "")
|
|
endif(WIN32)
|
|
|
|
target_sources(nglib PRIVATE onetcl.cpp)
|
|
|
|
if(USE_GUI)
|
|
target_sources(nggui PRIVATE
|
|
gui.cpp ngpkg.cpp demoview.cpp parallelfunc.cpp ngtcl.cpp
|
|
)
|
|
|
|
if(NOT BUILD_FOR_CONDA)
|
|
add_executable(netgen ngappinit.cpp)
|
|
set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen-mesher)
|
|
if(WIN32)
|
|
target_sources(netgen PRIVATE ../windows/netgen.rc)
|
|
endif(WIN32)
|
|
target_link_libraries( netgen nglib nggui netgen_python netgen_gui)
|
|
install(TARGETS netgen ${NG_INSTALL_DIR})
|
|
if(APPLE)
|
|
set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen)
|
|
endif(APPLE)
|
|
target_link_libraries( netgen ${PYTHON_LIBRARIES} ${TCL_LIBRARY} ${TK_LIBRARY} ${JPEG_LIBRARIES})
|
|
endif(NOT BUILD_FOR_CONDA)
|
|
|
|
install(TARGETS nggui ${NG_INSTALL_DIR})
|
|
endif(USE_GUI)
|
|
|
|
if(USE_PYTHON)
|
|
add_library(ngpy SHARED netgenpy.cpp)
|
|
set_target_properties(ngpy PROPERTIES VERSION "${NETGEN_LIBRARY_VERSION}")
|
|
target_link_libraries( ngpy PUBLIC nglib PRIVATE "$<BUILD_INTERFACE:netgen_python>" )
|
|
if(APPLE)
|
|
set_target_properties( ngpy PROPERTIES SUFFIX ".so")
|
|
elseif(WIN32)
|
|
set_target_properties( ngpy PROPERTIES SUFFIX ".pyd")
|
|
set_target_properties( ngpy PROPERTIES OUTPUT_NAME "libngpy")
|
|
endif()
|
|
set_target_properties(ngpy PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/../${NETGEN_PYTHON_RPATH}")
|
|
install(TARGETS ngpy DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen COMPONENT netgen)
|
|
|
|
if(USE_GUI)
|
|
add_library(ngguipy SHARED ngguipy.cpp)
|
|
set_target_properties(ngguipy PROPERTIES VERSION "${NETGEN_LIBRARY_VERSION}")
|
|
target_link_libraries( ngguipy PUBLIC nglib nggui PRIVATE "$<BUILD_INTERFACE:netgen_python>" $<BUILD_INTERFACE:netgen_gui>)
|
|
if(APPLE)
|
|
set_target_properties( ngguipy PROPERTIES SUFFIX ".so")
|
|
elseif(WIN32)
|
|
set_target_properties( ngguipy PROPERTIES SUFFIX ".pyd")
|
|
set_target_properties( ngguipy PROPERTIES OUTPUT_NAME "libngguipy")
|
|
endif()
|
|
set_target_properties(ngguipy PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/../${NETGEN_PYTHON_RPATH}")
|
|
install(TARGETS ngguipy DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen COMPONENT netgen)
|
|
endif(USE_GUI)
|
|
endif(USE_PYTHON)
|
|
|
|
if(USE_GUI)
|
|
if(NOT USE_INTERNAL_TCL)
|
|
install(FILES
|
|
dialog.tcl menustat.tcl ngicon.tcl ng.tcl
|
|
ngvisual.tcl sockets.tcl nghelp.tcl ngshell.tcl
|
|
ngtesting.tcl parameters.tcl variables.tcl csgeom.tcl stlgeom.tcl
|
|
occgeom.tcl acisgeom.tcl netgen.ocf drawing.tcl
|
|
DESTINATION ${NG_INSTALL_DIR_BIN} COMPONENT netgen)
|
|
endif()
|
|
|
|
add_subdirectory(Togl2.1)
|
|
endif(USE_GUI)
|
|
|