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 )
cmake_minimum_required ( VERSION 2.8.9 )
project ( Netgen )
set ( NETGEN_VERSION_MAJOR 6 )
set ( NETGEN_VERSION_MINOR 1 )
2015-11-02 21:31:23 +05:00
string ( TIMESTAMP NETGEN_VERSION_PATCH "%y%U%w" )
2015-03-06 18:59:14 +05:00
set ( NETGEN_VERSION "${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}-dev" )
2015-11-02 21:31:23 +05:00
set ( PACKAGE_VERSION "${NETGEN_VERSION_MAJOR}.${NETGEN_VERSION_MINOR}-${NETGEN_VERSION_PATCH}" )
set ( CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}" )
# set(CPACK_DEBIAN_PACKAGE_VERSION "${PACKAGE_VERSION}"
2015-03-06 18:59:14 +05:00
if ( NOT WIN32 )
option ( USE_NATIVE_ARCH "build which -march=native" ON )
endif ( NOT WIN32 )
option ( USE_GUI "don't build netgen with GUI" ON )
option ( USE_PYTHON "link boost python, necessary for ngsolve" ON )
option ( USE_MPI "enable mpi parallelization" OFF )
option ( USE_OCC "(not supported) compile with OpenCascade geometry kernel" OFF )
option ( USE_JPEG "enable snapshots using library libjpeg" OFF )
option ( USE_MPEG "enable video recording with FFmpeg, uses libavcodec" OFF )
option ( INTEL_MIC "cross compile for intel xeon phi" )
option ( INSTALL_PROFILES "install environment variable settings to /etc/profile.d" OFF )
2015-12-11 21:53:06 +05:00
option ( INSTALL_DEPENDENCIES "install dependencies like tcl, useful for packaging" OFF )
2015-11-19 18:24:36 +05:00
option ( USE_CCACHE "use ccache" )
#######################################################################
if ( USE_CCACHE )
find_program ( CCACHE_FOUND ccache )
if ( CCACHE_FOUND )
set_property ( GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache )
set_property ( GLOBAL PROPERTY RULE_LAUNCH_LINK ccache )
endif ( CCACHE_FOUND )
endif ( USE_CCACHE )
2015-03-06 18:59:14 +05:00
#######################################################################
if ( USE_NATIVE_ARCH )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native" )
endif ( USE_NATIVE_ARCH )
#######################################################################
if ( INTEL_MIC )
set ( MKL_ARCH "mic" )
include ( cmake_modules/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, ...)
2016-02-15 13:08:26 +05:00
# cmake -DUSE_MPI=ON -DCMAKE_PREFIX_PATH="/opt/openmpi165;/opt/metis51" ../
2015-03-06 18:59:14 +05:00
set ( ADDITIONAL_PATHS "" CACHE PATH "List of paths to additional libraries in non-standard locations, seperated by ';'" )
if ( ADDITIONAL_PATHS )
2016-02-15 13:08:26 +05:00
set ( CMAKE_PREFIX_PATH ${ ADDITIONAL_PATHS } )
2015-03-06 18:59:14 +05:00
endif ( ADDITIONAL_PATHS )
#######################################################################
# install dir
if ( NOT INSTALL_DIR )
set ( INSTALL_DIR "/opt/netgen" CACHE PATH "Prefix prepended to install directories" )
endif ( NOT INSTALL_DIR )
2016-02-08 19:53:16 +05:00
if ( APPLE )
set ( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}/Netgen.app/Contents/Resources" CACHE INTERNAL "Prefix prepended to install directories" FORCE )
else ( APPLE )
set ( CMAKE_INSTALL_PREFIX "${INSTALL_DIR}" CACHE INTERNAL "Prefix prepended to install directories" FORCE )
endif ( APPLE )
2015-03-06 18:59:14 +05:00
#######################################################################
# use rpath
SET ( CMAKE_SKIP_BUILD_RPATH FALSE )
SET ( CMAKE_BUILD_WITH_INSTALL_RPATH FALSE )
SET ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" )
SET ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
LIST ( FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir )
IF ( "${isSystemDir}" STREQUAL "-1" )
SET ( CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib" )
ENDIF ( "${isSystemDir}" STREQUAL "-1" )
#######################################################################
# build options
add_definitions ( -DUSE_TIMEOFDAY )
include_directories ( "${PROJECT_SOURCE_DIR}/include" )
include_directories ( "${PROJECT_SOURCE_DIR}/libsrc/include" )
include_directories ( "${PROJECT_BINARY_DIR}" )
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
set ( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules" )
2016-02-08 19:53:16 +05:00
if ( APPLE )
set ( ng_install_dir_bin ../MacOS )
set ( ng_install_dir_lib ../MacOS )
else ( APPLE )
set ( ng_install_dir_bin bin )
set ( ng_install_dir_lib lib )
endif ( APPLE )
set ( ng_install_dir 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 )
2015-03-06 18:59:14 +05:00
include ( CheckIncludeFiles )
check_include_files ( dlfcn.h HAVE_DLFCN_H )
configure_file ( ${ CMAKE_CURRENT_SOURCE_DIR } /config.h.cmake ${ CMAKE_CURRENT_BINARY_DIR } /config.h )
add_definitions ( -DHAVE_CONFIG_H )
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 ( )
if ( WIN32 )
get_WIN32_WINNT ( ver )
2016-11-04 16:14:52 +05:00
add_definitions ( -D_WIN32_WINNT= ${ ver } -DWNT -DWNT_WINDOW -DNOMINMAX )
2015-03-06 18:59:14 +05:00
set ( CMAKE_MFC_FLAG 0 )
# add_definitions(-DNGINTERFACE_EXPORTS)
# add_definitions(-DNGLIB_EXPORTS)
2015-09-23 19:36:33 +05:00
add_definitions ( -DMSVC_EXPRESS -D_CRT_SECURE_NO_WARNINGS -DHAVE_STRUCT_TIMESPEC )
2015-03-06 18:59:14 +05:00
# build convenience (aka object) libraries in windows)
set ( NG_LIB_TYPE OBJECT )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4244 /wd4800" )
else ( WIN32 )
# build shared libraries
set ( NG_LIB_TYPE SHARED )
2016-11-04 16:14:52 +05:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14" )
2015-03-06 18:59:14 +05:00
endif ( WIN32 )
if ( APPLE )
2015-12-11 18:31:28 +05:00
# set(MACOSX_BUNDLE ON)
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
# set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
endif ( APPLE )
#######################################################################
find_package ( ZLIB REQUIRED )
include_directories ( ${ ZLIB_INCLUDE_DIRS } )
#######################################################################
if ( USE_GUI )
2016-02-08 19:53:16 +05:00
find_package ( TCL 8.5 )
2015-03-06 18:59:14 +05:00
find_package ( Threads REQUIRED )
if ( APPLE )
2016-02-22 13:21:47 +05:00
# find_library(OPENGL_gl_LIBRARY AppKit REQUIRED)
# find_library(OPENGL_gl_LIBRARY OpenGL REQUIRED)
# find_package(AppKit REQUIRED)
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AppKit" )
message ( "linker flags: ${CMAKE_EXE_LINKER_FLAGS}" )
2016-02-08 19:53:16 +05:00
else ( APPLE )
find_package ( X11 REQUIRED )
2015-03-06 18:59:14 +05:00
endif ( APPLE )
find_package ( OpenGL REQUIRED )
2016-03-07 22:52:51 +05:00
add_definitions ( -DTCL -DOPENGL -DUSE_TOGL_2 )
2015-03-06 18:59:14 +05:00
include_directories ( ${ TCL_INCLUDE_PATH } )
2016-02-08 19:53:16 +05:00
include_directories ( ${ TK_INCLUDE_PATH } )
2016-03-07 22:52:51 +05:00
set ( LIBTOGL togl )
2015-03-06 18:59:14 +05:00
if ( WIN32 )
get_filename_component ( MY_LIB_DIR ${ TK_LIBRARY } DIRECTORY )
2016-03-07 22:52:51 +05:00
install ( DIRECTORY "${MY_LIB_DIR}/tcl8.6" DESTINATION lib COMPONENT netgen )
install ( DIRECTORY "${MY_LIB_DIR}/tk8.6" DESTINATION lib COMPONENT netgen )
2015-04-08 23:04:28 +05:00
install ( DIRECTORY "${MY_LIB_DIR}/tix8.4.3" DESTINATION lib COMPONENT netgen )
install ( DIRECTORY "${MY_LIB_DIR}/../bin" DESTINATION . COMPONENT netgen )
2016-03-07 22:52:51 +05:00
add_definitions ( -DTOGL_WGL )
2015-03-06 18:59:14 +05:00
else ( WIN32 )
2016-02-08 19:53:16 +05:00
if ( APPLE )
ADD_DEFINITIONS ( -DTOGL_NSOPENGL )
else ( APPLE )
ADD_DEFINITIONS ( -DTOGL_X11 )
endif ( APPLE )
2015-03-06 18:59:14 +05:00
endif ( WIN32 )
endif ( USE_GUI )
#######################################################################
if ( USE_PYTHON )
2016-11-04 16:14:52 +05:00
find_path ( PYBIND_INCLUDE_DIR pybind11/pybind11.h ${ CMAKE_CURRENT_SOURCE_DIR } /external_dependencies/pybind11/include )
if ( NOT PYBIND_INCLUDE_DIR )
execute_process ( COMMAND git submodule update --init --recursive WORKING_DIRECTORY ${ CMAKE_CURRENT_SOURCE_DIR } )
find_path ( PYBIND_INCLUDE_DIR pybind11/pybind11.h ${ CMAKE_CURRENT_SOURCE_DIR } /external_dependencies/pybind11/include )
endif ( NOT PYBIND_INCLUDE_DIR )
if ( PYBIND_INCLUDE_DIR )
message ( "-- Found Pybind11: ${PYBIND_INCLUDE_DIR}" )
else ( PYBIND_INCLUDE_DIR )
message ( FATAL_ERROR "Could NOT find pybind11!" )
endif ( PYBIND_INCLUDE_DIR )
include_directories ( ${ PYBIND_INCLUDE_DIR } )
2015-03-06 18:59:14 +05:00
set ( CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules/python" )
set ( PYTHON_VERSION "3" CACHE STRING "" )
2015-09-23 19:36:33 +05:00
set ( Python_ADDITIONAL_VERSIONS 3.5 )
2015-03-06 18:59:14 +05:00
if ( PYTHON_VERSION VERSION_LESS 3 )
message ( FATAL_ERROR "NGSolve supports only Python 3" )
endif ( PYTHON_VERSION VERSION_LESS 3 )
if ( PYTHON_VERSION STREQUAL "3" )
find_package ( PythonInterp ${ PYTHON_VERSION } REQUIRED )
find_package ( PythonLibs ${ PYTHON_VERSION } REQUIRED )
else ( PYTHON_VERSION STREQUAL "3" )
find_package ( PythonInterp ${ PYTHON_VERSION } EXACT REQUIRED )
find_package ( PythonLibs ${ PYTHON_VERSION } EXACT REQUIRED )
endif ( PYTHON_VERSION STREQUAL "3" )
add_definitions ( -DNG_PYTHON )
include_directories ( ${ PYTHON_INCLUDE_DIRS } )
2016-11-04 16:14:52 +05:00
set ( PYTHON_LIBS "${PYTHON_LIBRARIES}" )
2015-03-06 18:59:14 +05:00
execute_process ( COMMAND ${ PYTHON_EXECUTABLE } -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE )
message ( "python install path: ${PYTHON_PACKAGES_INSTALL_DIR}" )
endif ( USE_PYTHON )
#######################################################################
if ( USE_MPI )
find_package ( MPI REQUIRED )
find_package ( METIS REQUIRED )
add_definitions ( -DPARALLEL -DMETIS )
include_directories ( ${ MPI_CXX_INCLUDE_PATH } )
include_directories ( ${ METIS_INCLUDE_DIR } )
endif ( USE_MPI )
2015-04-09 15:39:41 +05:00
#######################################################################
if ( USE_OCC )
find_package ( OpenCasCade REQUIRED )
add_definitions ( -DOCCGEOMETRY -D_OCC64 )
include_directories ( ${ OCC_INCLUDE_DIR } )
2016-03-14 18:22:25 +05:00
if ( WIN32 )
install ( DIRECTORY "${OCC_LIBRARY_DIR}/../bin" DESTINATION . COMPONENT netgen )
install ( FILES ${ OCC_LIBRARIES_BIN } DESTINATION bin COMPONENT netgen )
endif ( WIN32 )
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 )
#######################################################################
if ( INSTALL_PROFILES )
file ( WRITE ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "#!/bin/sh\n" )
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export PATH=${INSTALL_DIR}/bin:$PATH\n" )
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export NETGENDIR=${INSTALL_DIR}/bin\n" )
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export PYTHONPATH=${INSTALL_DIR}/${PYTHON_PACKAGES_INSTALL_DIR}:.\n" )
2015-11-20 13:55:46 +05:00
file ( APPEND ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh "export LD_LIBRARY_PATH=${INSTALL_DIR}/lib:.\n" )
2015-03-06 18:59:14 +05:00
install ( PROGRAMS ${ CMAKE_CURRENT_BINARY_DIR } /netgen.sh DESTINATION /etc/profile.d )
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
#######################################################################
if ( INSTALL_DEPENDENCIES )
2016-02-08 19:53:16 +05:00
include ( InstallRequiredSystemLibraries )
2016-02-26 01:10:24 +05:00
# find_library(LIBGOMP NAMES gomp.1)
# find_library(LIBSTDCXX NAMES stdc++.6)
# find_library(LIBGCCS NAMES gcc_s.1)
# install( FILES "${Boost_LIBRARIES}" ${LIBGOMP} ${LIBSTDCXX} ${LIBGCCS} DESTINATION ${ng_install_dir_lib} COMPONENT netgen )
2016-11-04 16:14:52 +05:00
# install( FILES "${Boost_LIBRARIES}" DESTINATION ${ng_install_dir_lib} COMPONENT netgen )
2016-02-08 19:53:16 +05:00
get_filename_component ( MY_LIB_DIR ${ TK_LIBRARY } DIRECTORY )
if ( APPLE )
2016-03-15 21:49:58 +05:00
if ( TIX_LIBRARY )
install ( DIRECTORY "${TIX_LIBRARY}" DESTINATION ${ ng_install_dir_lib } COMPONENT netgen )
endif ( TIX_LIBRARY )
if ( TK_DND_LIBRARY )
install ( DIRECTORY "${TK_DND_LIBRARY}" DESTINATION ${ ng_install_dir_lib } COMPONENT netgen )
endif ( TK_DND_LIBRARY )
2016-02-08 19:53:16 +05:00
endif ( APPLE )
file ( WRITE ${ CMAKE_CURRENT_BINARY_DIR } /fixup.cmake " \
include ( ${ CMAKE_CURRENT_SOURCE_DIR } /cmake_modules/netgen_fixup.cmake )
set ( APP ${ INSTALL_DIR } /Netgen.app )
message ( \${APP})
file ( GLOB libs ${ CMAKE_INSTALL_PREFIX } / ${ ng_install_dir_lib } /*.dylib ${ CMAKE_INSTALL_PREFIX } / ${ ng_install_dir_lib } /*.so )
# set(libs ${CMAKE_INSTALL_PREFIX}/${ng_install_dir_lib}/libTix8.4.3.dylib)
message ( \"\${libs}\")
2016-02-23 17:08:09 +05:00
netgen_fixup_bundle ( \${APP}/Contents/MacOS/netgen \"\${libs}\" ${ CMAKE_INSTALL_PREFIX } / ${ ng_install_dir_lib } )
2016-02-08 19:53:16 +05:00
execute_process ( COMMAND ln -s /Applications ${ INSTALL_DIR } /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 )
execute_process ( COMMAND hdiutil create -volname Netgen -srcfolder ${ INSTALL_DIR } -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-12-11 21:53:06 +05:00
endif ( INSTALL_DEPENDENCIES )
2015-03-06 18:59:14 +05:00
#######################################################################
add_subdirectory ( libsrc )
add_subdirectory ( ng )
add_subdirectory ( tutorials )
2015-04-20 12:48:05 +05:00
if ( USE_PYTHON )
add_subdirectory ( python )
endif ( USE_PYTHON )
2015-03-06 18:59:14 +05:00
add_subdirectory ( py_tutorials )
add_subdirectory ( doc )
add_subdirectory ( windows )
add_subdirectory ( nglib )
#######################################################################
# CTest
enable_testing ( )
include ( CTest )
#######################################################################
# 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 )
2015-12-11 18:31:28 +05:00
if ( APPLE )
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
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 / l i b / p y t h o n 3 . 5 / s i t e - p a c k a g e s : $ P Y T H O N P A T H
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
" )
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 \ "
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
" )
2016-02-23 17:08:09 +05:00
install ( PROGRAMS ${ mac_ngsuite } DESTINATION ../MacOS 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 >
" )
install ( FILES ${ mac_plist } DESTINATION ../ )
install ( FILES ${ CMAKE_CURRENT_SOURCE_DIR } /netgen.icns DESTINATION . RENAME Netgen.icns )
2015-12-12 00:48:34 +05:00
2015-12-11 18:31:28 +05:00
endif ( APPLE )
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 (
" $ { 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 _ m o d u l e s / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { 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 )
#######################################################################
# 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 )
message ( WARNING "The use of ADDITIONAL_PATHS is depricated, use CMAKE_PREFIX_PATH instead" )
endif ( ADDITIONAL_PATHS )
2015-03-06 18:59:14 +05:00