2015-03-06 18:59:14 +05:00
if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING INTERNAL )
endif ( NOT CMAKE_BUILD_TYPE )
2023-08-30 20:59:24 +05:00
cmake_minimum_required ( VERSION 3.16 )
cmake_policy ( VERSION 3.16 )
2023-07-25 17:41:01 +05:00
if ( ${ CMAKE_VERSION } VERSION_GREATER_EQUAL "3.24.0" )
cmake_policy ( SET CMP0135 NEW )
endif ( )
2021-10-27 19:50:07 +05:00
2022-07-06 20:20:53 +05:00
include ( CMakeDependentOption )
2019-12-20 22:07:54 +05:00
option ( USE_NATIVE_ARCH "build for native cpu architecture" ON )
2015-03-06 18:59:14 +05:00
2022-04-27 16:42:04 +05:00
option ( USE_GUI "build with GUI" ON )
2016-12-22 23:12:11 +05:00
option ( USE_PYTHON "build with python interface" ON )
2022-11-14 15:27:26 +05:00
cmake_dependent_option ( PREFER_SYSTEM_PYBIND11 "Use system wide PyBind11" OFF "USE_PYTHON" OFF )
2015-03-06 18:59:14 +05:00
option ( USE_MPI "enable mpi parallelization" OFF )
2020-07-29 20:18:12 +05:00
option ( USE_MPI4PY "enable mpi4py interface" ON )
2023-07-26 02:14:58 +05:00
option ( USE_OCC "build with OpenCascade geometry kernel interface" ON )
2022-04-27 16:42:04 +05:00
option ( USE_STLGEOM "build with STL geometry support" ON )
option ( USE_CSG "build with CSG kernel" ON )
option ( USE_INTERFACE "build nginterface" ON )
option ( USE_GEOM2D "build 2d geometry kernels" ON )
2015-03-06 18:59:14 +05:00
option ( USE_JPEG "enable snapshots using library libjpeg" OFF )
option ( USE_MPEG "enable video recording with FFmpeg, uses libavcodec" OFF )
2020-03-11 15:48:05 +05:00
option ( USE_CGNS "enable CGNS file read/write support" OFF )
2020-03-25 14:40:12 +05:00
option ( USE_NUMA "compile with NUMA-aware code" )
2015-03-06 18:59:14 +05:00
option ( INTEL_MIC "cross compile for intel xeon phi" )
option ( INSTALL_PROFILES "install environment variable settings to /etc/profile.d" OFF )
2015-11-19 18:24:36 +05:00
option ( USE_CCACHE "use ccache" )
2017-05-30 00:19:34 +05:00
option ( USE_INTERNAL_TCL "Compile tcl files into the code and don't install them" ON )
2018-12-03 20:28:04 +05:00
option ( ENABLE_UNIT_TESTS "Enable Catch unit tests" )
2018-12-08 20:10:29 +05:00
option ( ENABLE_CPP_CORE_GUIDELINES_CHECK "Enable cpp core guideline checks on ngcore" OFF )
2018-12-28 17:43:15 +05:00
option ( DEBUG_LOG "Enable more debug output (may increase computation time) - only works with USE_SPDLOG=ON" OFF )
2019-01-02 20:30:55 +05:00
option ( CHECK_RANGE "Check array range access, automatically enabled if built in debug mode" OFF )
2019-06-29 23:01:05 +05:00
option ( BUILD_STUB_FILES "Build stub files for better autocompletion" ON )
2019-11-27 00:26:18 +05:00
option ( BUILD_FOR_CONDA "Link python libraries only to executables" OFF )
2015-11-19 18:24:36 +05:00
2022-04-27 16:42:04 +05:00
option ( USE_SUPERBUILD "build dependencies automatically" ON )
2020-11-21 19:49:07 +05:00
option ( TRACE_MEMORY "Enable memory tracing" OFF )
2016-12-22 23:12:11 +05:00
2020-10-01 16:35:53 +05:00
set ( NG_COMPILE_FLAGS "" CACHE STRING "Additional compile flags" )
2022-04-27 16:42:04 +05:00
set ( NGLIB_LIBRARY_TYPE SHARED CACHE STRING "nglib library type" )
set ( NGCORE_LIBRARY_TYPE SHARED CACHE STRING "ngcore library type" )
set ( NGGUI_LIBRARY_TYPE SHARED CACHE STRING "nggui library type" )
2017-02-23 18:45:25 +05:00
set ( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_modules" )
2017-05-30 00:19:34 +05:00
if ( APPLE )
set ( INSTALL_DIR_DEFAULT /Applications/Netgen.app )
else ( APPLE )
if ( WIN32 )
set ( INSTALL_DIR_DEFAULT "C:/netgen" )
else ( WIN32 )
set ( INSTALL_DIR_DEFAULT /opt/netgen )
endif ( WIN32 )
endif ( APPLE )
if ( INSTALL_DIR )
message ( WARNING "INSTALL_DIR is deprecated, use CMAKE_INSTALL_PREFIX instead" )
set ( INSTALL_DIR_DEFAULT ${ INSTALL_DIR } )
endif ( INSTALL_DIR )
2021-03-02 13:27:14 +05:00
if ( UNIX AND USE_SUPERBUILD )
2017-05-30 00:19:34 +05:00
message ( "Checking for write permissions in install directory..." )
execute_process ( COMMAND mkdir -p ${ CMAKE_INSTALL_PREFIX } )
execute_process ( COMMAND test -w ${ CMAKE_INSTALL_PREFIX } RESULT_VARIABLE res )
if ( res )
message ( WARNING "No write access at install directory, please set correct permissions" )
endif ( )
2021-03-02 13:27:14 +05:00
endif ( UNIX AND USE_SUPERBUILD )
2017-05-30 00:19:34 +05:00
2016-12-22 23:12:11 +05:00
if ( USE_SUPERBUILD )
project ( SUPERBUILD )
else ( )
project ( Netgen )
endif ( )
2023-06-23 15:03:14 +05:00
if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
set ( CMAKE_INSTALL_PREFIX "${INSTALL_DIR_DEFAULT}" CACHE PATH "Install directory" FORCE )
endif ( )
2015-03-06 18:59:14 +05:00
2023-06-23 15:03:14 +05:00
set ( NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directories (project name)" )
2016-02-08 19:53:16 +05:00
2017-11-13 17:41:15 +05:00
if ( USE_PYTHON )
2023-08-30 23:25:11 +05:00
if ( ${ CMAKE_VERSION } VERSION_GREATER_EQUAL 3.18 )
2023-09-14 13:49:25 +05:00
find_package ( Python3 REQUIRED COMPONENTS Development.Module )
2024-02-05 14:02:39 +05:00
if ( NOT EMSCRIPTEN )
find_package ( Python3 COMPONENTS Interpreter Development.Embed )
endif ( )
2023-08-30 23:25:11 +05:00
else ( )
find_package ( Python3 REQUIRED COMPONENTS Interpreter Development )
endif ( )
2017-11-13 17:41:15 +05:00
2023-09-14 13:49:25 +05:00
if ( NOT CMAKE_CROSSCOMPILING )
2024-02-05 14:02:39 +05:00
find_package ( Python3 REQUIRED COMPONENTS Interpreter )
2023-10-03 16:05:22 +05:00
execute_process ( COMMAND ${ Python3_EXECUTABLE } -c "import os.path, sysconfig;print(os.path.relpath(sysconfig.get_path('platlib'), sysconfig.get_path('data')))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE )
2023-09-14 13:49:25 +05:00
file ( TO_CMAKE_PATH ${ PYTHON_PACKAGES_INSTALL_DIR } PYTHON_PACKAGES_INSTALL_DIR )
endif ( NOT CMAKE_CROSSCOMPILING )
2017-11-13 17:41:15 +05:00
endif ( USE_PYTHON )
2023-07-28 16:01:41 +05:00
if ( APPLE AND NOT EMSCRIPTEN )
2017-05-30 00:19:34 +05:00
set ( NG_INSTALL_DIR_BIN_DEFAULT Contents/MacOS )
set ( NG_INSTALL_DIR_LIB_DEFAULT Contents/MacOS )
2017-05-30 11:38:48 +05:00
set ( NG_INSTALL_DIR_CMAKE_DEFAULT Contents/Resources/CMake )
2017-05-30 00:19:34 +05:00
set ( NG_INSTALL_DIR_PYTHON_DEFAULT Contents/Resources/ ${ PYTHON_PACKAGES_INSTALL_DIR } )
set ( NG_INSTALL_DIR_RES_DEFAULT Contents/Resources/share )
set ( NG_INSTALL_DIR_INCLUDE_DEFAULT Contents/Resources/include )
set ( NG_RPATH_TOKEN "@loader_path" )
2023-07-28 16:01:41 +05:00
else ( APPLE AND NOT EMSCRIPTEN )
2017-05-30 00:19:34 +05:00
set ( NG_INSTALL_DIR_BIN_DEFAULT bin )
set ( NG_INSTALL_DIR_LIB_DEFAULT lib )
2017-05-30 11:38:48 +05:00
if ( WIN32 )
set ( NG_INSTALL_DIR_CMAKE_DEFAULT cmake )
else ( WIN32 )
set ( NG_INSTALL_DIR_CMAKE_DEFAULT lib/cmake/ ${ NG_INSTALL_SUFFIX } )
endif ( WIN32 )
2017-05-30 00:19:34 +05:00
set ( NG_INSTALL_DIR_PYTHON_DEFAULT ${ PYTHON_PACKAGES_INSTALL_DIR } )
set ( NG_INSTALL_DIR_RES_DEFAULT share )
set ( NG_INSTALL_DIR_INCLUDE_DEFAULT include )
set ( NG_RPATH_TOKEN "\$ORIGIN" )
2023-07-28 16:01:41 +05:00
endif ( APPLE AND NOT EMSCRIPTEN )
2017-05-30 00:19:34 +05:00
set ( NG_INSTALL_DIR_PYTHON ${ NG_INSTALL_DIR_PYTHON_DEFAULT } CACHE STRING "Install directory for Python files" )
set ( NG_INSTALL_DIR_BIN ${ NG_INSTALL_DIR_BIN_DEFAULT } CACHE STRING "Install directory for executables" )
set ( NG_INSTALL_DIR_LIB ${ NG_INSTALL_DIR_LIB_DEFAULT } CACHE STRING "Install directory for libraries" )
set ( NG_INSTALL_DIR_INCLUDE ${ NG_INSTALL_DIR_INCLUDE_DEFAULT } CACHE STRING "Install directory for header files" )
set ( NG_INSTALL_DIR_CMAKE ${ NG_INSTALL_DIR_CMAKE_DEFAULT } CACHE STRING "Install directory for CMake files" )
set ( NG_INSTALL_DIR_RES ${ NG_INSTALL_DIR_RES_DEFAULT } CACHE STRING "Install directory for resources" )
get_filename_component ( NETGEN_CMAKE_DIR_ABSOLUTE ${ NG_INSTALL_DIR_CMAKE } ABSOLUTE BASE_DIR ${ CMAKE_INSTALL_PREFIX } )
get_filename_component ( NETGEN_BINARY_DIR_ABSOLUTE ${ NG_INSTALL_DIR_BIN } ABSOLUTE BASE_DIR ${ CMAKE_INSTALL_PREFIX } )
get_filename_component ( NETGEN_LIBRARY_DIR_ABSOLUTE ${ NG_INSTALL_DIR_LIB } ABSOLUTE BASE_DIR ${ CMAKE_INSTALL_PREFIX } )
get_filename_component ( NETGEN_INCLUDE_DIR_ABSOLUTE ${ NG_INSTALL_DIR_INCLUDE } ABSOLUTE BASE_DIR ${ CMAKE_INSTALL_PREFIX } )
get_filename_component ( NETGEN_RESOURCE_DIR_ABSOLUTE ${ NG_INSTALL_DIR_RES } ABSOLUTE BASE_DIR ${ CMAKE_INSTALL_PREFIX } )
file ( RELATIVE_PATH NETGEN_DIR ${ NETGEN_CMAKE_DIR_ABSOLUTE } ${ CMAKE_INSTALL_PREFIX } )
file ( RELATIVE_PATH NETGEN_BINARY_DIR ${ NETGEN_CMAKE_DIR_ABSOLUTE } ${ NETGEN_BINARY_DIR_ABSOLUTE } )
file ( RELATIVE_PATH NETGEN_LIBRARY_DIR ${ NETGEN_CMAKE_DIR_ABSOLUTE } ${ NETGEN_LIBRARY_DIR_ABSOLUTE } )
file ( RELATIVE_PATH NETGEN_INCLUDE_DIR ${ NETGEN_CMAKE_DIR_ABSOLUTE } ${ NETGEN_INCLUDE_DIR_ABSOLUTE } )
file ( RELATIVE_PATH NETGEN_RESOURCE_DIR ${ NETGEN_CMAKE_DIR_ABSOLUTE } ${ NETGEN_RESOURCE_DIR_ABSOLUTE } )
file ( RELATIVE_PATH NETGEN_RPATH ${ NETGEN_BINARY_DIR_ABSOLUTE } ${ NETGEN_LIBRARY_DIR_ABSOLUTE } )
2017-07-20 14:18:34 +05:00
2023-06-23 15:03:14 +05:00
if ( USE_SUPERBUILD )
# execute the superbuild (this script will be invoked again without the
# USE_SUPERBUILD option this time)
include ( cmake/SuperBuild.cmake )
return ( ) # stop processing this file further
endif ( )
set ( CMAKE_EXPORT_COMPILE_COMMANDS ON )
include ( ${ CMAKE_CURRENT_LIST_DIR } /cmake/generate_version_file.cmake )
set ( CPACK_PACKAGE_VERSION "${NETGEN_VERSION}" )
#######################################################################
if ( USE_CCACHE )
find_program ( CCACHE_FOUND NAMES ccache ccache.bat )
if ( CCACHE_FOUND )
set_property ( GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${ CCACHE_FOUND } )
endif ( CCACHE_FOUND )
endif ( USE_CCACHE )
#######################################################################
if ( INTEL_MIC )
set ( MKL_ARCH "mic" )
include ( cmake/mic.cmake )
else ( INTEL_MIC )
set ( MKL_ARCH "intel64" )
endif ( INTEL_MIC )
#######################################################################
# Append install paths of software in non-standard paths (e.g. openmpi, metis, intel mkl, ...)
# cmake -DUSE_MPI=ON -DCMAKE_PREFIX_PATH="/opt/openmpi165;/opt/metis51" ../
set ( ADDITIONAL_PATHS "" CACHE PATH "List of paths to additional libraries in non-standard locations, separated by ';'" )
if ( ADDITIONAL_PATHS )
set ( CMAKE_PREFIX_PATH ${ ADDITIONAL_PATHS } )
endif ( ADDITIONAL_PATHS )
#######################################################################
# build options
include_directories ( "${PROJECT_SOURCE_DIR}/include" )
include_directories ( "${PROJECT_SOURCE_DIR}/libsrc" )
include_directories ( "${PROJECT_SOURCE_DIR}/libsrc/include" )
include_directories ( "${PROJECT_BINARY_DIR}" )
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
2017-07-20 14:18:34 +05:00
if ( USE_PYTHON )
get_filename_component ( NETGEN_PYTHON_DIR_ABSOLUTE ${ NG_INSTALL_DIR_PYTHON } ABSOLUTE BASE_DIR ${ CMAKE_INSTALL_PREFIX } )
file ( RELATIVE_PATH NETGEN_PYTHON_DIR ${ NETGEN_CMAKE_DIR_ABSOLUTE } ${ NETGEN_PYTHON_DIR_ABSOLUTE } )
file ( RELATIVE_PATH NETGEN_PYTHON_RPATH_BIN ${ NETGEN_PYTHON_DIR_ABSOLUTE } ${ NETGEN_BINARY_DIR_ABSOLUTE } )
file ( RELATIVE_PATH NETGEN_PYTHON_RPATH ${ NETGEN_PYTHON_DIR_ABSOLUTE } ${ NETGEN_LIBRARY_DIR_ABSOLUTE } )
if ( WIN32 )
set ( NETGEN_PYTHON_RPATH ${ NETGEN_PYTHON_RPATH_BIN } )
endif ( WIN32 )
endif ( USE_PYTHON )
2017-05-30 00:19:34 +05:00
set ( NG_INSTALL_DIR EXPORT netgen-targets RUNTIME DESTINATION ${ NG_INSTALL_DIR_BIN } COMPONENT netgen LIBRARY DESTINATION ${ NG_INSTALL_DIR_LIB } COMPONENT netgen_devel ARCHIVE DESTINATION ${ NG_INSTALL_DIR_LIB } COMPONENT netgen_devel )
2017-06-08 19:05:12 +05:00
install ( EXPORT netgen-targets DESTINATION ${ NG_INSTALL_DIR_CMAKE } COMPONENT netgen_devel )
2017-05-30 00:19:34 +05:00
set ( CMAKE_MACOSX_RPATH TRUE )
set ( CMAKE_INSTALL_RPATH "${NG_RPATH_TOKEN};${NG_RPATH_TOKEN}/${NETGEN_RPATH}" )
2021-10-27 19:50:07 +05:00
if ( BUILD_FOR_CONDA )
file ( RELATIVE_PATH py_rpath "/bin" "/${NG_INSTALL_DIR_LIB}" )
set ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${py_rpath}" )
endif ( BUILD_FOR_CONDA )
2015-03-06 18:59:14 +05:00
include ( CheckIncludeFiles )
check_include_files ( dlfcn.h HAVE_DLFCN_H )
2017-06-01 13:15:25 +05:00
if ( HAVE_DLFCN_H )
add_definitions ( -DHAVE_DLFCN_H )
endif ( )
2016-11-17 13:54:32 +05:00
include_directories ( BEFORE ${ CMAKE_CURRENT_BINARY_DIR } )
2015-03-06 18:59:14 +05:00
#######################################################################
# platform specific definitions and flags
macro ( get_WIN32_WINNT version )
if ( WIN32 AND CMAKE_SYSTEM_VERSION )
2016-05-09 14:20:15 +05:00
if ( "${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)" )
math ( EXPR ver "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}" )
endif ( )
2015-03-06 18:59:14 +05:00
set ( ${ version } "0x${ver}" )
endif ( )
endmacro ( )
macro ( get_dll_from_lib dll_path lib_path )
get_filename_component ( parent_lib_path ${ lib } DIRECTORY )
get_filename_component ( lib_name ${ lib } name )
endmacro ( )
2022-04-27 16:42:04 +05:00
set ( CMAKE_CXX_VISIBILITY_PRESET hidden )
2019-07-10 15:57:19 +05:00
set ( CMAKE_CXX_STANDARD 17 )
2015-03-06 18:59:14 +05:00
if ( WIN32 )
set ( CMAKE_MFC_FLAG 0 )
endif ( WIN32 )
if ( APPLE )
2016-02-22 13:21:47 +05:00
set ( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup" )
2015-03-06 18:59:14 +05:00
endif ( APPLE )
2022-04-27 16:42:04 +05:00
#######################################################################
add_library ( nglib ${ NGLIB_LIBRARY_TYPE } )
if ( USE_GUI )
add_library ( nggui ${ NGGUI_LIBRARY_TYPE } )
if ( WIN32 )
set_target_properties ( nggui PROPERTIES OUTPUT_NAME "libnggui" )
endif ( WIN32 )
endif ( USE_GUI )
2015-03-06 18:59:14 +05:00
#######################################################################
2016-12-22 23:12:11 +05:00
if ( NOT ZLIB_INCLUDE_DIRS )
find_package ( ZLIB REQUIRED )
endif ( NOT ZLIB_INCLUDE_DIRS )
2022-04-27 16:42:04 +05:00
target_include_directories ( nglib PRIVATE ${ ZLIB_INCLUDE_DIRS } )
if ( USE_GUI )
target_include_directories ( nggui PRIVATE ${ ZLIB_INCLUDE_DIRS } )
endif ( USE_GUI )
2015-03-06 18:59:14 +05:00
#######################################################################
2022-05-05 21:04:18 +05:00
if ( WIN32 )
add_library ( netgen_gui INTERFACE IMPORTED )
else ( )
add_library ( netgen_gui INTERFACE )
endif ( )
2015-03-06 18:59:14 +05:00
if ( USE_GUI )
2016-12-22 23:12:11 +05:00
find_package ( TCL 8.5 REQUIRED )
2021-10-27 19:50:07 +05:00
find_package ( TclStub 8.5 REQUIRED )
2015-03-06 18:59:14 +05:00
find_package ( Threads REQUIRED )
if ( APPLE )
2016-02-22 13:21:47 +05:00
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AppKit" )
2022-05-05 21:04:18 +05:00
target_link_libraries ( netgen_gui INTERFACE "-framework AppKit" )
2016-02-08 19:53:16 +05:00
else ( APPLE )
find_package ( X11 REQUIRED )
2022-05-05 21:04:18 +05:00
target_link_libraries ( netgen_gui INTERFACE ${ X11_Xmu_LIB } ${ X11_X11_LIB } )
2015-03-06 18:59:14 +05:00
endif ( APPLE )
find_package ( OpenGL REQUIRED )
2022-05-05 21:04:18 +05:00
target_compile_definitions ( netgen_gui INTERFACE -DTCL -DOPENGL -DUSE_TOGL_2 -DUSE_TCL_STUBS -DUSE_TK_STUBS )
target_include_directories ( netgen_gui INTERFACE ${ TCL_INCLUDE_PATH } ${ TK_INCLUDE_PATH } )
target_link_libraries ( netgen_gui INTERFACE ${ TCL_STUB_LIBRARY } ${ TK_STUB_LIBRARY } )
2021-12-02 18:14:53 +05:00
if ( NOT EXISTS ${ TK_INCLUDE_PATH } /tkWin.h AND EXISTS ${ TK_INCLUDE_PATH } /../win/tkWin.h )
2022-05-05 21:04:18 +05:00
target_include_directories ( netgen_gui INTERFACE ${ TK_INCLUDE_PATH } /../win )
2021-12-02 18:14:53 +05:00
endif ( )
if ( NOT EXISTS ${ TK_INCLUDE_PATH } /x11/Xlib.h AND EXISTS ${ TK_INCLUDE_PATH } /../xlib/X11/Xlib.h )
2022-05-05 21:04:18 +05:00
target_include_directories ( netgen_gui INTERFACE ${ TK_INCLUDE_PATH } /../xlib )
2021-12-02 18:14:53 +05:00
endif ( )
2022-05-05 21:04:18 +05:00
target_link_libraries ( nggui PUBLIC nglib togl PRIVATE "$<BUILD_INTERFACE:netgen_python>" )
2015-03-06 18:59:14 +05:00
if ( WIN32 )
2022-05-05 21:04:18 +05:00
target_compile_definitions ( netgen_gui INTERFACE -DTOGL_WGL )
endif ( )
if ( APPLE )
target_compile_definitions ( netgen_gui INTERFACE -DTOGL_NSOPENGL )
endif ( )
if ( UNIX AND NOT APPLE )
target_compile_definitions ( netgen_gui INTERFACE -DTOGL_X11 )
endif ( )
2015-03-06 18:59:14 +05:00
endif ( USE_GUI )
#######################################################################
2019-11-27 00:26:18 +05:00
if ( WIN32 )
add_library ( netgen_python INTERFACE IMPORTED )
else ( )
add_library ( netgen_python INTERFACE )
endif ( )
2015-03-06 18:59:14 +05:00
if ( USE_PYTHON )
2022-07-06 20:20:53 +05:00
if ( PREFER_SYSTEM_PYBIND11 )
set ( NG_INSTALL_PYBIND OFF )
2022-11-16 14:27:14 +05:00
find_package ( pybind11 CONFIG REQUIRED )
2022-07-06 20:20:53 +05:00
else ( )
add_subdirectory ( external_dependencies/pybind11 )
endif ( )
2023-08-29 13:52:22 +05:00
target_include_directories ( netgen_python INTERFACE ${ pybind11_INCLUDE_DIR } ${ Python3_INCLUDE_DIRS } )
target_include_directories ( nglib PRIVATE ${ pybind11_INCLUDE_DIR } ${ Python3_INCLUDE_DIRS } )
2023-10-03 22:22:12 +05:00
if ( Python3_LIBRARIES AND ( WIN32 OR NOT BUILD_FOR_CONDA ) )
2023-08-29 13:52:22 +05:00
target_link_libraries ( netgen_python INTERFACE ${ Python3_LIBRARIES } )
2019-11-27 00:26:18 +05:00
endif ( )
2015-03-06 18:59:14 +05:00
2018-01-25 18:01:57 +05:00
if ( NG_INSTALL_PYBIND )
2022-07-06 20:20:53 +05:00
install ( DIRECTORY ${ pybind11_INCLUDE_DIR } /pybind11 DESTINATION ${ NG_INSTALL_DIR_INCLUDE } COMPONENT netgen_devel )
install ( FILES ${ pybind11_INCLUDE_DIR } /../LICENSE DESTINATION ${ NG_INSTALL_DIR_INCLUDE } /pybind11 COMPONENT netgen_devel )
2018-01-25 18:01:57 +05:00
endif ( NG_INSTALL_PYBIND )
2015-03-06 18:59:14 +05:00
endif ( USE_PYTHON )
#######################################################################
2019-07-10 13:56:55 +05:00
add_library ( netgen_metis INTERFACE )
2015-03-06 18:59:14 +05:00
if ( USE_MPI )
2024-05-06 15:31:30 +05:00
set ( MPI_DETERMINE_LIBRARY_VERSION TRUE )
2015-03-06 18:59:14 +05:00
find_package ( MPI REQUIRED )
2019-07-10 13:56:55 +05:00
2015-03-06 18:59:14 +05:00
find_package ( METIS REQUIRED )
2019-07-10 13:56:55 +05:00
target_include_directories ( netgen_metis INTERFACE ${ METIS_INCLUDE_DIR } )
target_link_libraries ( netgen_metis INTERFACE ${ METIS_LIBRARY } )
target_compile_definitions ( netgen_metis INTERFACE METIS )
2020-07-29 20:18:12 +05:00
if ( USE_MPI4PY AND USE_PYTHON )
2023-08-29 14:24:01 +05:00
execute_process ( COMMAND ${ Python3_EXECUTABLE } -c "import mpi4py;print(mpi4py.get_include())" OUTPUT_VARIABLE mpi4py_path OUTPUT_STRIP_TRAILING_WHITESPACE )
2020-07-29 20:18:12 +05:00
find_path ( MPI4PY_INCLUDE_DIR mpi4py.h HINTS ${ mpi4py_path } /mpi4py NO_DEFAULT_PATH REQUIRED )
2024-05-06 15:31:30 +05:00
target_include_directories ( netgen_python INTERFACE ${ MPI4PY_INCLUDE_DIR } )
target_compile_definitions ( netgen_python INTERFACE NG_MPI4PY )
2020-07-29 20:18:12 +05:00
message ( STATUS "Found mpi4py: ${MPI4PY_INCLUDE_DIR}" )
endif ( USE_MPI4PY AND USE_PYTHON )
2015-03-06 18:59:14 +05:00
endif ( USE_MPI )
2024-05-07 19:26:48 +05:00
install ( TARGETS netgen_metis ${ NG_INSTALL_DIR } )
2015-03-06 18:59:14 +05:00
2015-04-09 15:39:41 +05:00
#######################################################################
2023-09-14 14:39:07 +05:00
add_library ( occ_libs INTERFACE IMPORTED )
2015-04-09 15:39:41 +05:00
if ( USE_OCC )
2021-10-27 19:50:07 +05:00
find_package ( OpenCascade NAMES OpenCASCADE opencascade REQUIRED CMAKE_FIND_ROOT_PATH_BOTH )
2021-09-02 17:52:34 +05:00
add_definitions ( -DOCCGEOMETRY )
2021-09-06 16:18:36 +05:00
set ( OCC_LIBRARIES
T K B O
T K B R e p
T K B o o l
T K C A F
T K C D F
T K F i l l e t
T K G 2 d
T K G 3 d
T K G e o m A l g o
T K G e o m B a s e
T K H L R
T K L C A F
T K M a t h
T K M e s h
T K O f f s e t
T K P r i m
T K S e r v i c e
T K S h H e a l i n g
T K T o p A l g o
T K V 3 d
T K V C A F
T K X C A F
T K X S B a s e
T K e r n e l
)
2024-03-25 14:11:51 +05:00
if ( ${ OpenCASCADE_MAJOR_VERSION } . ${ OpenCASCADE_MINOR_VERSION } VERSION_GREATER_EQUAL 7.8 )
list ( APPEND OCC_LIBRARIES TKDEIGES TKDESTEP TKDESTL )
else ( )
list ( APPEND OCC_LIBRARIES
T K I G E S
T K S T E P
T K S T L
T K X D E I G E S
T K X D E S T E P
T K S T E P 2 0 9
T K S T E P A t t r
T K S T E P B a s e
)
endif ( )
2023-09-17 01:39:22 +05:00
if ( UNIX AND NOT APPLE )
2023-09-17 01:38:20 +05:00
list ( PREPEND OCC_LIBRARIES -Wl,--start-group )
list ( APPEND OCC_LIBRARIES -Wl,--end-group )
endif ( )
2023-09-16 22:25:43 +05:00
target_link_libraries ( occ_libs INTERFACE ${ OCC_LIBRARIES } )
2021-09-02 17:52:34 +05:00
include_directories ( ${ OpenCASCADE_INCLUDE_DIR } )
if ( NOT OpenCASCADE_BUILD_SHARED_LIBS )
2022-04-27 16:42:04 +05:00
if ( OpenCASCADE_WITH_FREETYPE )
2023-09-14 14:39:07 +05:00
find_library ( FREETYPE NAMES freetype HINTS ${ OpenCASCADE_LIBRARY_DIR } )
2022-04-27 16:42:04 +05:00
list ( APPEND OCC_LIBRARIES ${ FREETYPE } )
2023-09-14 14:39:07 +05:00
target_link_libraries ( occ_libs INTERFACE ${ FREETYPE } )
2022-04-27 16:42:04 +05:00
if ( UNIX AND NOT APPLE )
find_package ( Fontconfig REQUIRED )
2023-09-14 14:39:07 +05:00
target_link_libraries ( occ_libs INTERFACE ${ Fontconfig_LIBRARIES } )
2022-04-27 16:42:04 +05:00
endif ( )
endif ( OpenCASCADE_WITH_FREETYPE )
2023-09-16 22:25:43 +05:00
set ( THREADS_PREFER_PTHREAD_FLAG ON )
find_package ( Threads REQUIRED )
target_link_libraries ( occ_libs INTERFACE Threads::Threads )
2021-09-02 17:52:34 +05:00
endif ( )
2021-09-08 14:52:45 +05:00
message ( STATUS "OCC DIRS ${OpenCASCADE_INCLUDE_DIR}" )
2022-06-23 16:04:38 +05:00
if ( WIN32 AND USE_GUI )
2023-10-09 14:00:13 +05:00
target_link_libraries ( nggui PRIVATE occ_libs Ws2_32.lib )
2022-06-23 16:04:38 +05:00
endif ( WIN32 AND USE_GUI )
2015-04-09 15:39:41 +05:00
endif ( USE_OCC )
2015-03-06 18:59:14 +05:00
#######################################################################
if ( USE_JPEG )
find_package ( JPEG REQUIRED )
add_definitions ( -DJPEGLIB )
include_directories ( ${ JPEG_INCLUDE_DIR } )
endif ( USE_JPEG )
#######################################################################
if ( USE_MPEG )
find_package ( FFMPEG REQUIRED )
add_definitions ( -DFFMPEG -D__STDC_CONSTANT_MACROS )
include_directories ( ${ FFMPEG_INCLUDE_DIR } )
endif ( USE_MPEG )
2020-05-18 18:55:40 +05:00
#######################################################################
add_custom_target ( ng_generate_version_file
$ { C M A K E _ C O M M A N D }
- D B D I R = $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
- P $ { C M A K E _ C U R R E N T _ L I S T _ D I R } / c m a k e / g e n e r a t e _ v e r s i o n _ f i l e . c m a k e
)
2015-03-06 18:59:14 +05:00
#######################################################################
if ( INSTALL_PROFILES )
file ( WRITE ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "#!/bin/sh\n" )
2017-05-30 00:19:34 +05:00
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export PATH=${CMAKE_INSTALL_PREFIX}/bin:$PATH\n" )
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export NETGENDIR=${CMAKE_INSTALL_PREFIX}/bin\n" )
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${PYTHON_PACKAGES_INSTALL_DIR}:.\n" )
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/lib:.\n" )
2017-02-16 18:21:51 +05:00
install ( PROGRAMS ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh DESTINATION /etc/profile.d COMPONENT netgen )
2015-03-06 18:59:14 +05:00
string ( ASCII 27 Esc )
file ( WRITE ${ CMAKE_CURRENT_BINARY_DIR } /postinst "#!/bin/sh\n" )
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /postinst "echo \" ${ Esc } [0;31mPlease log out and in again or do 'source /etc/profile.d/netgen.sh' to load the correct environment variables! ${ Esc } [m\ "" )
set ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/postinst" )
endif ( INSTALL_PROFILES )
2015-12-11 21:53:06 +05:00
#######################################################################
2017-01-25 22:24:31 +05:00
file ( WRITE ${ CMAKE_CURRENT_BINARY_DIR } /fixup.cmake " \
2017-02-23 18:45:25 +05:00
include ( ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/netgen_fixup.cmake )
2017-05-30 00:19:34 +05:00
set ( APP ${ CMAKE_INSTALL_PREFIX } )
2016-02-08 19:53:16 +05:00
message ( \${APP})
2017-01-25 22:24:31 +05:00
set ( BU_CHMOD_BUNDLE_ITEMS ON )
2016-02-08 19:53:16 +05:00
2017-05-30 00:19:34 +05:00
file ( GLOB libs ${ CMAKE_INSTALL_PREFIX } / ${ NG_INSTALL_DIR_LIB } /*.dylib ${ CMAKE_INSTALL_PREFIX } / ${ NG_INSTALL_DIR_LIB } /*.so )
2016-02-08 19:53:16 +05:00
message ( \"\${libs}\")
2017-05-30 00:19:34 +05:00
netgen_fixup_bundle ( \${APP}/Contents/MacOS/netgen \"\${libs}\" ${ CMAKE_INSTALL_PREFIX } / ${ NG_INSTALL_DIR_LIB } )
execute_process ( COMMAND ln -s /Applications ${ CMAKE_INSTALL_PREFIX } /../Applications )
2016-02-09 13:18:24 +05:00
set ( bundle_filename \$ENV{NETGEN_BUNDLE_NAME})
2016-02-08 22:20:15 +05:00
if ( NOT bundle_filename )
set ( bundle_filename netgen )
endif ( NOT bundle_filename )
2017-05-30 00:19:34 +05:00
execute_process ( COMMAND hdiutil create -volname Netgen -srcfolder ${ CMAKE_INSTALL_PREFIX } -ov -format UDZO \${bundle_filename}-${PACKAGE_VERSION}.dmg)
2016-02-08 19:53:16 +05:00
" )
add_custom_target ( bundle COMMAND ${ CMAKE_COMMAND } "-P" "${CMAKE_CURRENT_BINARY_DIR}/fixup.cmake" )
2015-03-06 18:59:14 +05:00
#######################################################################
2017-02-23 20:41:27 +05:00
# CTest
enable_testing ( )
include ( CTest )
2018-12-03 20:28:04 +05:00
if ( ENABLE_UNIT_TESTS )
include ( ${ CMAKE_CURRENT_LIST_DIR } /cmake/external_projects/catch.cmake )
endif ( ENABLE_UNIT_TESTS )
2017-02-23 20:41:27 +05:00
#######################################################################
2015-03-06 18:59:14 +05:00
2018-12-28 17:43:15 +05:00
if ( USE_SPDLOG )
include ( ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/external_projects/spdlog.cmake )
include_directories ( ${ SPDLOG_INCLUDE_DIR } )
endif ( USE_SPDLOG )
2018-12-08 20:10:29 +05:00
if ( ENABLE_CPP_CORE_GUIDELINES_CHECK )
find_program (
C L A N G _ T I D Y _ E X E
N A M E S " c l a n g - t i d y "
D O C " P a t h t o c l a n g - t i d y e x e c u t a b l e "
)
if ( NOT CLANG_TIDY_EXE )
message ( WARNING "clang-tidy not found." )
else ( )
message ( STATUS "clang-tidy found: ${CLANG_TIDY_EXE}" )
2018-12-10 20:20:07 +05:00
set ( DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-header-filter=libsrc/core/" )
2018-12-08 20:10:29 +05:00
endif ( )
endif ( ENABLE_CPP_CORE_GUIDELINES_CHECK )
2020-03-11 15:48:05 +05:00
add_library ( netgen_cgns INTERFACE )
if ( USE_CGNS )
2020-03-11 19:53:08 +05:00
find_library ( CGNS_LIBRARY NAMES cgns cgnsdll )
2020-03-11 15:48:05 +05:00
find_path ( CGNS_INCLUDE_DIR cgnslib.h )
target_compile_definitions ( netgen_cgns INTERFACE NG_CGNS )
target_include_directories ( netgen_cgns INTERFACE ${ CGNS_INCLUDE_DIR } )
target_link_libraries ( netgen_cgns INTERFACE ${ CGNS_LIBRARY } )
2020-03-12 01:30:43 +05:00
if ( NOT WIN32 AND NOT APPLE ) # hdf5 is statically linked into cgns in Windows amd MacOS binaries
2020-03-11 20:35:48 +05:00
find_library ( HDF5_LIBRARY NAMES hdf5 hdf5_serial )
target_link_libraries ( netgen_cgns INTERFACE ${ HDF5_LIBRARY } )
2020-03-12 01:30:43 +05:00
endif ( NOT WIN32 AND NOT APPLE )
2020-03-11 15:48:05 +05:00
endif ( USE_CGNS )
2020-09-09 14:33:06 +05:00
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } /netgen_version.hpp ${ CMAKE_CURRENT_BINARY_DIR } /netgen_config.hpp DESTINATION ${ NG_INSTALL_DIR_INCLUDE } /include COMPONENT netgen_devel )
2020-07-23 20:49:10 +05:00
2022-04-27 16:42:04 +05:00
# include instead of add_subdirectory to recognize the generated source files properly
include ( rules/CMakeLists.txt )
2020-11-16 20:10:46 +05:00
add_subdirectory ( windows )
2015-03-06 18:59:14 +05:00
add_subdirectory ( libsrc )
add_subdirectory ( ng )
add_subdirectory ( tutorials )
add_subdirectory ( py_tutorials )
add_subdirectory ( doc )
add_subdirectory ( nglib )
2017-02-23 20:41:27 +05:00
add_subdirectory ( tests )
2015-03-06 18:59:14 +05:00
2019-12-20 22:07:54 +05:00
#######################################################################
if ( USE_NATIVE_ARCH )
if ( WIN32 )
include ( CheckCXXSourceRuns )
check_cxx_source_runs ( "
#include <immintrin.h>
i n t main ( )
{
_ _ m 2 5 6 d a { 1 . , 2 . , 3 . , 4 . } ;
_ _ m 2 5 6 d b { 2 . , 0 . , 3 . , 5 . } ;
_ _ m 2 5 6 d c = _mm256_mul_pd ( a,b ) ;
r e t u r n 0 ;
} " N G _ H A V E _ A V X )
check_cxx_source_runs ( "
#include <immintrin.h>
i n t main ( )
{
_ _ m 2 5 6 i a { 1 , 2 , 3 , 4 } ;
_ _ m 2 5 6 i b { 2 , 0 , 3 , 5 } ;
_ _ m 2 5 6 i c = _mm256_cmpgt_epi64 ( a,b ) ;
r e t u r n 0 ;
} " N G _ H A V E _ A V X 2 )
check_cxx_source_runs ( "
#include <immintrin.h>
i n t main ( )
{
_ _ m 5 1 2 d a { 1 . , 2 . , 3 . , 4 . } ;
_ _ m 5 1 2 d b { 5 . , 6 . , 7 . , 8 . } ;
_ _ m 5 1 2 d c = _mm512_mul_pd ( a,b ) ;
r e t u r n 0 ;
} " N G _ H A V E _ A V X 5 1 2 )
if ( NG_HAVE_AVX512 )
target_compile_options ( ngcore PUBLIC "/arch:AVX512" )
message ( STATUS "Build for AVX512 CPU" )
elseif ( NG_HAVE_AVX2 )
target_compile_options ( ngcore PUBLIC "/arch:AVX2" )
message ( STATUS "Build for AVX2 CPU" )
elseif ( NG_HAVE_AVX )
target_compile_options ( ngcore PUBLIC "/arch:AVX" )
message ( STATUS "Build for AVX CPU" )
else ( )
message ( STATUS "Build for generic CPU" )
endif ( )
2020-12-17 14:26:29 +05:00
elseif ( APPLE AND CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64" )
# no flag necessary/available on Apple M1
2019-12-20 22:07:54 +05:00
else ( )
target_compile_options ( ngcore PUBLIC "-march=native" )
endif ( WIN32 )
2020-01-17 17:09:44 +05:00
if ( APPLE )
# work-around for bug in Xcode 11.3: https://forums.developer.apple.com/thread/121887
target_compile_options ( ngcore PUBLIC "-fno-stack-check" )
endif ( APPLE )
2019-12-20 22:07:54 +05:00
endif ( USE_NATIVE_ARCH )
2021-10-28 16:57:24 +05:00
if ( USE_PYTHON )
add_subdirectory ( python )
endif ( USE_PYTHON )
2015-03-06 18:59:14 +05:00
#######################################################################
# Debian packager
2016-02-08 19:53:16 +05:00
if ( UNIX )
set ( CPACK_SOURCE_GENERATOR "TGZ" )
set ( CPACK_SOURCE_IGNORE_FILES "/cmake/;/build/;/.gz/;~$;${CPACK_SOURCE_IGNORE_FILES}" )
set ( CPACK_PACKAGE_VERSION ${ PACKAGE_VERSION } )
2015-03-06 18:59:14 +05:00
2016-02-08 19:53:16 +05:00
set ( CPACK_PACKAGE_NAME netgen )
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "automatic 3d tetrahedral mesh generator" )
set ( CPACK_PACKAGE_DESCRIPTION "NETGEN is an automatic 3d tetrahedral mesh generator. It accepts input from constructive solid geometry (CSG) or boundary representation (BRep) from STL file format. The connection to a geometry kernel allows the handling of IGES and STEP files. NETGEN contains modules for mesh optimization and hierarchical mesh refinement. Netgen is open source based on the LGPL license. It is available for Unix/Linux and Windows." )
2015-10-09 15:00:55 +05:00
2015-10-15 13:45:32 +05:00
set ( CPACK_PACKAGING_INSTALL_PREFIX "/opt/netgen" )
2015-03-06 18:59:14 +05:00
execute_process ( COMMAND grep CODENAME /etc/lsb-release OUTPUT_VARIABLE temp OUTPUT_STRIP_TRAILING_WHITESPACE )
2015-11-02 21:31:23 +05:00
execute_process ( COMMAND dpkg --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE )
2015-03-06 18:59:14 +05:00
if ( temp )
set ( CPACK_GENERATOR "DEB" )
string ( SUBSTRING ${ temp } 17 -1 UBUNTU_VERSION )
message ( "ubuntu version: ${UBUNTU_VERSION}" )
2015-10-09 15:00:55 +05:00
2016-11-04 16:14:52 +05:00
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "python3, libtk8.5, libtcl8.5, tix, libxmu6" )
2015-03-06 18:59:14 +05:00
execute_process ( COMMAND dpkg --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE )
2015-11-02 21:31:23 +05:00
set ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Matthias Hochsteger <matthias.hochsteger@tuwien.ac.at>" )
2015-03-06 18:59:14 +05:00
if ( USE_MPI )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, libmetis5, openmpi-bin" )
set ( CPACK_PACKAGE_NAME "${CPACK_PACKAGE_NAME}_mpi" )
endif ( USE_MPI )
2016-03-01 22:25:48 +05:00
if ( USE_OCC )
2016-10-14 19:38:25 +05:00
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, liboce-ocaf-dev" )
2016-03-01 22:25:48 +05:00
endif ( USE_OCC )
2015-03-06 18:59:14 +05:00
set ( CPACK_DEBIAN_PACKAGE_SECTION Science )
2015-11-02 21:31:23 +05:00
set ( CPACK_DEBIAN_PACKAGE_NAME ${ CPACK_PACKAGE_NAME } )
set ( CPACK_PACKAGE_FILE_NAME "netgen-${PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" )
2015-03-06 18:59:14 +05:00
endif ( temp )
endif ( UNIX )
2022-02-02 21:32:50 +05:00
if ( APPLE AND NOT SKBUILD )
2015-12-11 21:53:06 +05:00
# create some auxiliary files
set ( mac_startup ${ CMAKE_CURRENT_BINARY_DIR } /startup.sh )
2016-02-08 19:53:16 +05:00
file ( WRITE ${ mac_startup } " \
#!/bin/sh
N e t g e n _ B U N D L E = \ " ` e c h o \ " $ 0 \ " | s e d - e ' s / \ \ / C o n t e n t s \ \ / M a c O S \ \ / s t a r t u p . s h / / ' ` \ "
N e t g e n _ M A C O S = \ " $ N e t g e n _ B U N D L E / C o n t e n t s / M a c O S \ "
e x p o r t N E T G E N D I R = $ N e t g e n _ M A C O S
e x p o r t D Y L D _ L I B R A R Y _ P A T H = $ N e t g e n _ M A C O S : $ D Y L D _ L I B R A R Y _ P A T H
# export TIX_LIBRARY=$Netgen_MACOS/library
# export TCLLIBPATH=$Netgen_MACOS:$TCLLIBPATH
2017-01-15 23:32:59 +05:00
e x p o r t P Y T H O N P A T H = $ N e t g e n _ B U N D L E / C o n t e n t s / R e s o u r c e s / $ { P Y T H O N _ P A C K A G E S _ I N S T A L L _ D I R } : $ P Y T H O N P A T H
2016-02-08 19:53:16 +05:00
c d $ N e t g e n _ M A C O S
2016-02-23 17:08:09 +05:00
$ N e t g e n _ M A C O S / n e t g e n
2016-02-08 19:53:16 +05:00
" )
2017-05-30 00:19:34 +05:00
install ( PROGRAMS ${ mac_startup } DESTINATION ${ NG_INSTALL_DIR_BIN } )
2015-12-11 21:53:06 +05:00
set ( mac_ngsuite ${ CMAKE_CURRENT_BINARY_DIR } /ngsuite.sh )
2016-02-08 19:53:16 +05:00
file ( WRITE ${ mac_ngsuite } " \
#!/bin/sh
2016-02-23 17:08:09 +05:00
N e t g e n _ B U N D L E = \ " ` e c h o \ " $ 0 \ " | s e d - e ' s / \ \ / C o n t e n t s \ \ / M a c O S \ \ / N e t g e n 1 / / ' ` \ "
2016-02-08 19:53:16 +05:00
N e t g e n _ M A C O S = \ " $ N e t g e n _ B U N D L E / C o n t e n t s / M a c O S \ "
2019-09-10 17:20:31 +05:00
o p e n - a / A p p l i c a t i o n s / U t i l i t i e s / T e r m i n a l . a p p $ N e t g e n _ M A C O S / s t a r t u p . s h | | o p e n - a / S y s t e m / A p p l i c a t i o n s / U t i l i t i e s / T e r m i n a l . a p p $ N e t g e n _ M A C O S / s t a r t u p . s h
2016-02-08 19:53:16 +05:00
" )
2017-05-30 00:19:34 +05:00
install ( PROGRAMS ${ mac_ngsuite } DESTINATION ${ NG_INSTALL_DIR_BIN } RENAME Netgen1 )
2015-12-11 21:53:06 +05:00
set ( mac_plist ${ CMAKE_CURRENT_BINARY_DIR } /Info.plist )
2016-02-08 19:53:16 +05:00
file ( WRITE ${ mac_plist } "<?xml version=\" 1.0\ " encoding=\" UTF-8\ " ?>
< ! D O C T Y P E p l i s t P U B L I C \ " - / / A p p l e C o m p u t e r / / D T D P L I S T 1 . 0 / / E N \ " \ " h t t p : / / w w w . a p p l e . c o m / D T D s / P r o p e r t y L i s t - 1 . 0 . d t d \ " >
< p l i s t v e r s i o n = \ " 1 . 0 \ " >
< d i c t >
< k e y > C F B u n d l e D e v e l o p m e n t R e g i o n < / k e y >
< s t r i n g > E n g l i s h < / s t r i n g >
< k e y > C F B u n d l e E x e c u t a b l e < / k e y >
2016-02-23 17:08:09 +05:00
< s t r i n g > N e t g e n 1 < / s t r i n g >
2016-02-08 19:53:16 +05:00
< k e y > C F B u n d l e I c o n F i l e < / k e y >
< s t r i n g > N e t g e n . i c n s < / s t r i n g >
< k e y > N S H i g h R e s o l u t i o n C a p a b l e < / k e y >
< s t r i n g > T r u e < / s t r i n g >
< / d i c t >
< / p l i s t >
" )
2017-05-30 00:19:34 +05:00
install ( FILES ${ mac_plist } DESTINATION ${ NG_INSTALL_DIR_BIN } /../ )
install ( FILES ${ CMAKE_CURRENT_SOURCE_DIR } /netgen.icns DESTINATION ${ NG_INSTALL_DIR_RES } /../ RENAME Netgen.icns )
2015-12-12 00:48:34 +05:00
2022-02-02 21:32:50 +05:00
endif ( APPLE AND NOT SKBUILD )
2015-12-11 18:31:28 +05:00
2016-02-08 19:53:16 +05:00
if ( NOT APPLE )
include ( CPack )
endif ( )
2015-03-06 18:59:14 +05:00
#######################################################################
# uninstall target
configure_file (
2017-02-23 18:45:25 +05:00
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / c m a k e _ u n i n s t a l l . c m a k e . i n "
2015-03-06 18:59:14 +05:00
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
add_custom_target ( uninstall
C O M M A N D $ { C M A K E _ C O M M A N D } - P $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e )
2017-05-30 00:19:34 +05:00
#######################################################################
# Generate package config file
get_directory_property ( NETGEN_COMPILE_DEFINITIONS COMPILE_DEFINITIONS )
2018-07-02 15:25:18 +05:00
configure_file ( ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/NetgenConfig.cmake.in
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / N e t g e n C o n f i g . c m a k e @ O N L Y E S C A P E _ Q U O T E S )
2016-12-22 23:12:11 +05:00
2017-06-08 17:48:13 +05:00
install ( FILES ${ CMAKE_CURRENT_BINARY_DIR } /NetgenConfig.cmake DESTINATION ${ NG_INSTALL_DIR_CMAKE } COMPONENT netgen_devel )
2015-03-06 18:59:14 +05:00
#######################################################################
# Configure message
# TODO: other message in case of failure
string ( TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" name )
set ( flags "${${name}} ${CMAKE_CXX_FLAGS}" )
message ( "
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$ { P R O J E C T _ N A M E } $ { P A C K A G E _ V E R S I O N } : A u t o m a t i c c o n f i g u r a t i o n O K .
B u i l d t y p e : $ { C M A K E _ B U I L D _ T Y P E }
F l a g s : $ { f l a g s }
E n a b l e d f u n c t i o n a l i t y :
O C C : . . . . . . . . . . . . . . . $ { U S E _ O C C }
J P E G l i b : . . . . . . . . . . . $ { U S E _ J P E G }
F F M P E G : . . . . . . . . . . . . $ { U S E _ M P E G }
G U I : . . . . . . . . . . . . . . . $ { U S E _ G U I }
M P I : . . . . . . . . . . . . . . . $ { U S E _ M P I }
P Y T H O N : . . . . . . . . . . . . $ { U S E _ P Y T H O N }
B u i l d i n g : " )
if ( WIN32 )
message ( "
O p e n $ { C M A K E _ B I N A R Y _ D I R } / N e t g e n . s l n a n d b u i l d s o l u t i o n t o c o m p i l e $ { P R O J E C T _ N A M E } .
B u i l d \ " I N S T A L L \ " t o i n s t a l l $ { P R O J E C T _ N A M E } .
" )
else ( WIN32 )
message ( "
T y p e ' m a k e ' t o c o m p i l e $ { P R O J E C T _ N A M E } .
T y p e ' m a k e i n s t a l l ' t o i n s t a l l $ { P R O J E C T _ N A M E } .
" )
endif ( WIN32 )
message ( "
I n s t a l l d i r e c t o r y :
$ { C M A K E _ I N S T A L L _ P R E F I X }
P l e a s e s e t t h e f o l l o w i n g e n v i r o n m e n t v a r i a b l e s :
N E T G E N D I R = $ { C M A K E _ I N S T A L L _ P R E F I X } / b i n " )
if ( USE_PYTHON )
message ( " PYTHONPATH=.:${CMAKE_INSTALL_PREFIX}/${PYTHON_PACKAGES_INSTALL_DIR}" )
endif ( USE_PYTHON )
message ( "
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
" )
2016-02-15 13:08:26 +05:00
if ( ADDITIONAL_PATHS )
2017-07-26 08:29:41 +05:00
message ( WARNING "The use of ADDITIONAL_PATHS is deprecated, use CMAKE_PREFIX_PATH instead" )
2016-02-15 13:08:26 +05:00
endif ( ADDITIONAL_PATHS )
2015-03-06 18:59:14 +05:00