mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-26 05:50:32 +05:00
Restructure cmake files, build METIS as dependency
This commit is contained in:
parent
ea00690a2a
commit
0659961f28
@ -19,11 +19,13 @@ option( USE_CCACHE "use ccache")
|
|||||||
|
|
||||||
option( USE_SUPERBUILD "use ccache" ON)
|
option( USE_SUPERBUILD "use ccache" ON)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_modules")
|
||||||
|
|
||||||
if (USE_SUPERBUILD)
|
if (USE_SUPERBUILD)
|
||||||
project (SUPERBUILD)
|
project (SUPERBUILD)
|
||||||
# execute the superbuild (this script will be invoked again without the
|
# execute the superbuild (this script will be invoked again without the
|
||||||
# USE_SUPERBUILD option this time)
|
# USE_SUPERBUILD option this time)
|
||||||
include (cmake_modules/SuperBuild.cmake)
|
include (cmake/SuperBuild.cmake)
|
||||||
return() # stop processing this file further
|
return() # stop processing this file further
|
||||||
else()
|
else()
|
||||||
project(Netgen)
|
project(Netgen)
|
||||||
@ -55,7 +57,7 @@ endif(USE_NATIVE_ARCH)
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
if(INTEL_MIC)
|
if(INTEL_MIC)
|
||||||
set(MKL_ARCH "mic")
|
set(MKL_ARCH "mic")
|
||||||
include(cmake_modules/mic.cmake)
|
include(cmake/mic.cmake)
|
||||||
else(INTEL_MIC)
|
else(INTEL_MIC)
|
||||||
set(MKL_ARCH "intel64")
|
set(MKL_ARCH "intel64")
|
||||||
endif(INTEL_MIC)
|
endif(INTEL_MIC)
|
||||||
@ -94,7 +96,6 @@ include_directories ("${PROJECT_SOURCE_DIR}/libsrc/include")
|
|||||||
include_directories ("${PROJECT_BINARY_DIR}")
|
include_directories ("${PROJECT_BINARY_DIR}")
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules")
|
|
||||||
|
|
||||||
set(INCDIR include CACHE PATH "install directory for header files")
|
set(INCDIR include CACHE PATH "install directory for header files")
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
@ -241,7 +242,7 @@ endif(INSTALL_PROFILES)
|
|||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fixup.cmake "\
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fixup.cmake "\
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/netgen_fixup.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/netgen_fixup.cmake)
|
||||||
set(APP ${INSTALL_DIR})
|
set(APP ${INSTALL_DIR})
|
||||||
message(\${APP})
|
message(\${APP})
|
||||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||||
@ -366,13 +367,13 @@ endif()
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
# uninstall target
|
# uninstall target
|
||||||
configure_file(
|
configure_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/cmake_uninstall.cmake.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
IMMEDIATE @ONLY)
|
IMMEDIATE @ONLY)
|
||||||
add_custom_target(uninstall
|
add_custom_target(uninstall
|
||||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||||
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/NetgenConfig.cmake.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/NetgenConfig.cmake.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake @ONLY)
|
${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake @ONLY)
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake DESTINATION share/cmake)
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake DESTINATION share/cmake)
|
||||||
|
@ -6,8 +6,6 @@ set (NETGEN_DEPENDENCIES)
|
|||||||
set (LAPACK_DEPENDENCIES)
|
set (LAPACK_DEPENDENCIES)
|
||||||
set (NETGEN_CMAKE_ARGS "" CACHE INTERNAL "")
|
set (NETGEN_CMAKE_ARGS "" CACHE INTERNAL "")
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules")
|
|
||||||
|
|
||||||
macro(set_vars VAR_OUT)
|
macro(set_vars VAR_OUT)
|
||||||
foreach(varname ${ARGN})
|
foreach(varname ${ARGN})
|
||||||
if(NOT "${${varname}}" STREQUAL "")
|
if(NOT "${${varname}}" STREQUAL "")
|
||||||
@ -105,9 +103,19 @@ endif(USE_OCC AND WIN32 AND NOT OCC_INCLUDE_DIR)
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
if(USE_GUI)
|
if(USE_GUI)
|
||||||
include(cmake_modules/ExternalProject_TCLTK.cmake)
|
include(cmake/external_projects/tcltk.cmake)
|
||||||
endif(USE_GUI)
|
endif(USE_GUI)
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
if(USE_MPI)
|
||||||
|
find_package(METIS QUIET)
|
||||||
|
if(NOT METIS_FOUND)
|
||||||
|
message(STATUS "Could not find METIS, it will be built from source")
|
||||||
|
include(cmake/external_projects/metis.cmake)
|
||||||
|
endif()
|
||||||
|
endif(USE_MPI)
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# propagate cmake variables to Netgen subproject
|
# propagate cmake variables to Netgen subproject
|
||||||
set_vars( NETGEN_CMAKE_ARGS
|
set_vars( NETGEN_CMAKE_ARGS
|
||||||
@ -164,14 +172,14 @@ ExternalProject_Add (netgen
|
|||||||
# Check if the git submodules (i.e. pybind11) are up to date
|
# Check if the git submodules (i.e. pybind11) are up to date
|
||||||
# in case, something is wrong, emit a warning but continue
|
# in case, something is wrong, emit a warning but continue
|
||||||
ExternalProject_Add_Step(netgen check_submodules
|
ExternalProject_Add_Step(netgen check_submodules
|
||||||
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/check_submodules.cmake
|
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_submodules.cmake
|
||||||
DEPENDERS install # Steps on which this step depends
|
DEPENDERS install # Steps on which this step depends
|
||||||
)
|
)
|
||||||
|
|
||||||
# Due to 'ALWAYS 1', this step is always run which also forces a build of
|
# Due to 'ALWAYS 1', this step is always run which also forces a build of
|
||||||
# the Netgen subproject
|
# the Netgen subproject
|
||||||
ExternalProject_Add_Step(netgen check_submodules1
|
ExternalProject_Add_Step(netgen check_submodules1
|
||||||
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/check_submodules.cmake
|
COMMAND cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_submodules.cmake
|
||||||
DEPENDEES configure # Steps on which this step depends
|
DEPENDEES configure # Steps on which this step depends
|
||||||
DEPENDERS build # Steps that depend on this step
|
DEPENDERS build # Steps that depend on this step
|
||||||
ALWAYS 1 # No stamp file, step always runs
|
ALWAYS 1 # No stamp file, step always runs
|
@ -49,14 +49,8 @@ if (METIS_INCLUDE_DIR)
|
|||||||
NAMES ${metis_inc_names}
|
NAMES ${metis_inc_names}
|
||||||
HINTS ${METIS_INCLUDE_DIR}
|
HINTS ${METIS_INCLUDE_DIR}
|
||||||
NO_DEFAULT_PATH)
|
NO_DEFAULT_PATH)
|
||||||
if(NOT metis_test_include_path)
|
|
||||||
message(SEND_ERROR "Can not locate ${metis_inc_names} in ${METIS_INCLUDE_DIR}")
|
|
||||||
endif()
|
|
||||||
set(METIS_INCLUDE_DIR "${metis_test_include_path}")
|
set(METIS_INCLUDE_DIR "${metis_test_include_path}")
|
||||||
else()
|
endif()
|
||||||
message(SEND_ERROR "METIS_INCLUDE_DIR=${METIS_INCLUDE_DIR} does not exist")
|
|
||||||
set(METIS_INCLUDE_DIR "METIS_INCLUDE_DIR-NOTFOUND")
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
# Metis sometimes puts the include files in a subdir called Lib
|
# Metis sometimes puts the include files in a subdir called Lib
|
||||||
set(metis_inc_suffixes "include" "Lib")
|
set(metis_inc_suffixes "include" "Lib")
|
||||||
@ -67,9 +61,6 @@ if(METIS_DIR)
|
|||||||
HINTS ${METIS_DIR}
|
HINTS ${METIS_DIR}
|
||||||
PATH_SUFFIXES ${metis_inc_suffixes}
|
PATH_SUFFIXES ${metis_inc_suffixes}
|
||||||
NO_DEFAULT_PATH)
|
NO_DEFAULT_PATH)
|
||||||
else()
|
|
||||||
message(SEND_ERROR "METIS_DIR=${METIS_DIR} does not exist")
|
|
||||||
set(METIS_INCLUDE_DIR "METIS_INCLUDE_DIR-NOTFOUND")
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
find_path(METIS_INCLUDE_DIR
|
find_path(METIS_INCLUDE_DIR
|
||||||
@ -77,9 +68,6 @@ else()
|
|||||||
PATH_SUFFIXES ${metis_inc_suffixes})
|
PATH_SUFFIXES ${metis_inc_suffixes})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if ( NOT METIS_INCLUDE_DIR )
|
|
||||||
message(SEND_ERROR "Can not locate METIS include directory")
|
|
||||||
endif()
|
|
||||||
# Search for libraries
|
# Search for libraries
|
||||||
# Search order preference:
|
# Search order preference:
|
||||||
# (1) METIS_LIBRARY_DIR - check existence of path AND if the library file exists
|
# (1) METIS_LIBRARY_DIR - check existence of path AND if the library file exists
|
||||||
@ -93,9 +81,6 @@ if (METIS_LIBRARY_DIR)
|
|||||||
NAMES ${metis_lib_names}
|
NAMES ${metis_lib_names}
|
||||||
HINTS ${METIS_LIBRARY_DIR}
|
HINTS ${METIS_LIBRARY_DIR}
|
||||||
NO_DEFAULT_PATH)
|
NO_DEFAULT_PATH)
|
||||||
else()
|
|
||||||
message(SEND_ERROR "METIS_LIBRARY_DIR=${METIS_LIBRARY_DIR} does not exist")
|
|
||||||
set(METIS_LIBRARY "METIS_LIBRARY-NOTFOUND")
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
list(APPEND metis_lib_suffixes "lib" "Lib")
|
list(APPEND metis_lib_suffixes "lib" "Lib")
|
||||||
@ -106,9 +91,6 @@ if(METIS_DIR)
|
|||||||
HINTS ${METIS_DIR}
|
HINTS ${METIS_DIR}
|
||||||
PATH_SUFFIXES ${metis_lib_suffixes}
|
PATH_SUFFIXES ${metis_lib_suffixes}
|
||||||
NO_DEFAULT_PATH)
|
NO_DEFAULT_PATH)
|
||||||
else()
|
|
||||||
message(SEND_ERROR "METIS_DIR=${METIS_DIR} does not exist")
|
|
||||||
set(METISLIBRARY "METIS_LIBRARY-NOTFOUND")
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
find_library(METIS_LIBRARY
|
find_library(METIS_LIBRARY
|
||||||
@ -116,9 +98,6 @@ else()
|
|||||||
PATH_SUFFIXES ${metis_lib_suffixes})
|
PATH_SUFFIXES ${metis_lib_suffixes})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if ( NOT METIS_LIBRARY )
|
|
||||||
message(SEND_ERROR "Can not locate METIS library")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Define prerequisite packages
|
# Define prerequisite packages
|
||||||
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})
|
set(METIS_INCLUDE_DIRS ${METIS_INCLUDE_DIR})
|
18
cmake/external_projects/metis.cmake
Normal file
18
cmake/external_projects/metis.cmake
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
set(METIS_SRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/project_metis)
|
||||||
|
set(METIS_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/metis)
|
||||||
|
|
||||||
|
ExternalProject_Add(project_metis
|
||||||
|
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/dependencies
|
||||||
|
URL "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz"
|
||||||
|
URL_MD5 5465e67079419a69e0116de24fce58fe
|
||||||
|
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
||||||
|
CMAKE_ARGS
|
||||||
|
-DGKLIB_PATH=${METIS_SRC_DIR}/GKlib
|
||||||
|
-DCMAKE_INSTALL_PREFIX=${METIS_DIR}
|
||||||
|
UPDATE_COMMAND "" # Disable update
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
)
|
||||||
|
|
||||||
|
set_vars( NETGEN_CMAKE_ARGS METIS_DIR )
|
||||||
|
|
||||||
|
list(APPEND NETGEN_DEPENDENCIES project_metis)
|
14
cmake/external_projects/parmetis.cmake
Normal file
14
cmake/external_projects/parmetis.cmake
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
set(METIS_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/parmetis/metis)
|
||||||
|
set(PARMETIS_DIR ${CMAKE_CURRENT_BINARY_DIR}/dependencies/src/parametis)
|
||||||
|
ExternalProject_Add(parmetis
|
||||||
|
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/dependencies
|
||||||
|
URL "http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-4.0.3.tar.gz"
|
||||||
|
URL_MD5 f69c479586bf6bb7aff6a9bc0c739628
|
||||||
|
CMAKE_CACHE_ARGS -DMETIS_PATH:string=${METIS_DIR} -DGKLIB_PATH:string=${METIS_DIR}/GKlib
|
||||||
|
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
||||||
|
UPDATE_COMMAND "" # Disable update
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
)
|
||||||
|
set_vars( NETGEN_CMAKE_ARGS METIS_DIR )
|
||||||
|
|
||||||
|
list(APPEND NETGEN_DEPENDENCIES parmetis)
|
@ -1,7 +1,7 @@
|
|||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(HOME $ENV{HOME})
|
set(HOME $ENV{HOME})
|
||||||
set(tcl_prefix ${CMAKE_INSTALL_PREFIX}/../../)
|
set(tcl_prefix ${CMAKE_INSTALL_PREFIX}/../../)
|
||||||
ExternalProject_Add(tcl
|
ExternalProject_Add(project_tcl
|
||||||
URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tcl8.6.4-src.tar.gz"
|
URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tcl8.6.4-src.tar.gz"
|
||||||
URL_MD5 d7cbb91f1ded1919370a30edd1534304
|
URL_MD5 d7cbb91f1ded1919370a30edd1534304
|
||||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
||||||
@ -15,8 +15,8 @@ if(APPLE)
|
|||||||
LOG_INSTALL 1
|
LOG_INSTALL 1
|
||||||
)
|
)
|
||||||
|
|
||||||
ExternalProject_Add(tk
|
ExternalProject_Add(project_tk
|
||||||
DEPENDS tcl
|
DEPENDS project_tcl
|
||||||
URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tk8.6.4-src.tar.gz"
|
URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tk8.6.4-src.tar.gz"
|
||||||
URL_MD5 261754d7dc2a582f00e35547777e1fea
|
URL_MD5 261754d7dc2a582f00e35547777e1fea
|
||||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
||||||
@ -47,7 +47,7 @@ if(APPLE)
|
|||||||
#LOG_INSTALL 1
|
#LOG_INSTALL 1
|
||||||
#)
|
#)
|
||||||
|
|
||||||
list(APPEND NETGEN_DEPENDENCIES tcl tk)
|
list(APPEND NETGEN_DEPENDENCIES project_tcl project_tk)
|
||||||
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}../Frameworks)
|
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}../Frameworks)
|
||||||
set(TCL_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework/Headers)
|
set(TCL_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework/Headers)
|
||||||
set(TCL_LIBRARY ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework)
|
set(TCL_LIBRARY ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework)
|
||||||
@ -56,7 +56,7 @@ if(APPLE)
|
|||||||
|
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
|
|
||||||
ExternalProject_Add(win_extlibs
|
ExternalProject_Add(project_win_extlibs
|
||||||
URL ${EXT_LIBS_DOWNLOAD_URL_WIN}
|
URL ${EXT_LIBS_DOWNLOAD_URL_WIN}
|
||||||
UPDATE_COMMAND "" # Disable update
|
UPDATE_COMMAND "" # Disable update
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
@ -66,7 +66,7 @@ elseif(WIN32)
|
|||||||
LOG_DOWNLOAD 1
|
LOG_DOWNLOAD 1
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND NETGEN_DEPENDENCIES win_extlibs)
|
list(APPEND NETGEN_DEPENDENCIES project_win_extlibs)
|
||||||
else(WIN32)
|
else(WIN32)
|
||||||
find_package(TCL 8.5 REQUIRED)
|
find_package(TCL 8.5 REQUIRED)
|
||||||
endif(APPLE)
|
endif(APPLE)
|
Loading…
Reference in New Issue
Block a user