mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-25 04:10:33 +05:00
Merge branch 'external_project_metis' into 'master'
Build Metis if not found on Unix platforms In case Metis is not found, it will be built automatically on unix platforms. See merge request !36
This commit is contained in:
commit
04d7e47824
@ -19,11 +19,13 @@ option( USE_CCACHE "use ccache")
|
||||
|
||||
option( USE_SUPERBUILD "use ccache" ON)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_modules")
|
||||
|
||||
if (USE_SUPERBUILD)
|
||||
project (SUPERBUILD)
|
||||
# execute the superbuild (this script will be invoked again without the
|
||||
# USE_SUPERBUILD option this time)
|
||||
include (cmake_modules/SuperBuild.cmake)
|
||||
include (cmake/SuperBuild.cmake)
|
||||
return() # stop processing this file further
|
||||
else()
|
||||
project(Netgen)
|
||||
@ -54,7 +56,7 @@ endif(USE_NATIVE_ARCH)
|
||||
#######################################################################
|
||||
if(INTEL_MIC)
|
||||
set(MKL_ARCH "mic")
|
||||
include(cmake_modules/mic.cmake)
|
||||
include(cmake/mic.cmake)
|
||||
else(INTEL_MIC)
|
||||
set(MKL_ARCH "intel64")
|
||||
endif(INTEL_MIC)
|
||||
@ -93,7 +95,6 @@ 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")
|
||||
|
||||
set(INCDIR include CACHE PATH "install directory for header files")
|
||||
if(APPLE)
|
||||
@ -240,7 +241,7 @@ endif(INSTALL_PROFILES)
|
||||
|
||||
#######################################################################
|
||||
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})
|
||||
message(\${APP})
|
||||
set(BU_CHMOD_BUNDLE_ITEMS ON)
|
||||
@ -366,13 +367,13 @@ endif()
|
||||
#######################################################################
|
||||
# uninstall target
|
||||
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"
|
||||
IMMEDIATE @ONLY)
|
||||
add_custom_target(uninstall
|
||||
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)
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/NetgenConfig.cmake DESTINATION share/cmake)
|
||||
|
@ -6,8 +6,6 @@ set (NETGEN_DEPENDENCIES)
|
||||
set (LAPACK_DEPENDENCIES)
|
||||
set (NETGEN_CMAKE_ARGS "" CACHE INTERNAL "")
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${PROJECT_SOURCE_DIR}/cmake_modules")
|
||||
|
||||
macro(set_vars VAR_OUT)
|
||||
foreach(varname ${ARGN})
|
||||
if(NOT "${${varname}}" STREQUAL "")
|
||||
@ -105,9 +103,23 @@ endif(USE_OCC AND WIN32 AND NOT OCC_INCLUDE_DIR)
|
||||
#######################################################################
|
||||
|
||||
if(USE_GUI)
|
||||
include(cmake_modules/ExternalProject_TCLTK.cmake)
|
||||
include(cmake/external_projects/tcltk.cmake)
|
||||
endif(USE_GUI)
|
||||
|
||||
#######################################################################
|
||||
if(USE_MPI)
|
||||
if(UNIX)
|
||||
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()
|
||||
else(UNIX)
|
||||
find_package(METIS REQUIRED)
|
||||
endif(UNIX)
|
||||
endif(USE_MPI)
|
||||
|
||||
|
||||
#######################################################################
|
||||
# propagate cmake variables to Netgen subproject
|
||||
set_vars( NETGEN_CMAKE_ARGS
|
||||
@ -164,14 +176,14 @@ ExternalProject_Add (netgen
|
||||
# Check if the git submodules (i.e. pybind11) are up to date
|
||||
# in case, something is wrong, emit a warning but continue
|
||||
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
|
||||
)
|
||||
|
||||
# Due to 'ALWAYS 1', this step is always run which also forces a build of
|
||||
# the Netgen subproject
|
||||
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
|
||||
DEPENDERS build # Steps that depend on this step
|
||||
ALWAYS 1 # No stamp file, step always runs
|
@ -49,14 +49,8 @@ if (METIS_INCLUDE_DIR)
|
||||
NAMES ${metis_inc_names}
|
||||
HINTS ${METIS_INCLUDE_DIR}
|
||||
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}")
|
||||
else()
|
||||
message(SEND_ERROR "METIS_INCLUDE_DIR=${METIS_INCLUDE_DIR} does not exist")
|
||||
set(METIS_INCLUDE_DIR "METIS_INCLUDE_DIR-NOTFOUND")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# Metis sometimes puts the include files in a subdir called Lib
|
||||
set(metis_inc_suffixes "include" "Lib")
|
||||
@ -67,19 +61,13 @@ if(METIS_DIR)
|
||||
HINTS ${METIS_DIR}
|
||||
PATH_SUFFIXES ${metis_inc_suffixes}
|
||||
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()
|
||||
find_path(METIS_INCLUDE_DIR
|
||||
NAMES ${metis_inc_names}
|
||||
PATH_SUFFIXES ${metis_inc_suffixes})
|
||||
endif()
|
||||
endif()
|
||||
if ( NOT METIS_INCLUDE_DIR )
|
||||
message(SEND_ERROR "Can not locate METIS include directory")
|
||||
endif()
|
||||
# Search for libraries
|
||||
# Search order preference:
|
||||
# (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}
|
||||
HINTS ${METIS_LIBRARY_DIR}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
message(SEND_ERROR "METIS_LIBRARY_DIR=${METIS_LIBRARY_DIR} does not exist")
|
||||
set(METIS_LIBRARY "METIS_LIBRARY-NOTFOUND")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND metis_lib_suffixes "lib" "Lib")
|
||||
@ -106,9 +91,6 @@ if(METIS_DIR)
|
||||
HINTS ${METIS_DIR}
|
||||
PATH_SUFFIXES ${metis_lib_suffixes}
|
||||
NO_DEFAULT_PATH)
|
||||
else()
|
||||
message(SEND_ERROR "METIS_DIR=${METIS_DIR} does not exist")
|
||||
set(METISLIBRARY "METIS_LIBRARY-NOTFOUND")
|
||||
endif()
|
||||
else()
|
||||
find_library(METIS_LIBRARY
|
||||
@ -116,9 +98,6 @@ else()
|
||||
PATH_SUFFIXES ${metis_lib_suffixes})
|
||||
endif()
|
||||
endif()
|
||||
if ( NOT METIS_LIBRARY )
|
||||
message(SEND_ERROR "Can not locate METIS library")
|
||||
endif()
|
||||
|
||||
# Define prerequisite packages
|
||||
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)
|
@ -1,12 +1,12 @@
|
||||
if(APPLE)
|
||||
set(HOME $ENV{HOME})
|
||||
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_MD5 d7cbb91f1ded1919370a30edd1534304
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
||||
UPDATE_COMMAND "" # Disable update
|
||||
CONFIGURE_COMMAND ../tcl/macosx/configure --enable-threads --enable-framework --prefix=${tcl_prefix} --libdir=${tcl_prefix}/Contents/Frameworks --bindir=${tcl_prefix}/Contents/Frameworks/Tcl.framework/bin
|
||||
CONFIGURE_COMMAND ../project_tcl/macosx/configure --enable-threads --enable-framework --prefix=${tcl_prefix} --libdir=${tcl_prefix}/Contents/Frameworks --bindir=${tcl_prefix}/Contents/Frameworks/Tcl.framework/bin
|
||||
BUILD_COMMAND make -j4 binaries libraries
|
||||
INSTALL_COMMAND make install-binaries install-headers install-libraries install-private-headers
|
||||
LOG_DOWNLOAD 1
|
||||
@ -15,13 +15,13 @@ if(APPLE)
|
||||
LOG_INSTALL 1
|
||||
)
|
||||
|
||||
ExternalProject_Add(tk
|
||||
DEPENDS tcl
|
||||
ExternalProject_Add(project_tk
|
||||
DEPENDS project_tcl
|
||||
URL "http://sourceforge.net/projects/tcl/files/Tcl/8.6.4/tk8.6.4-src.tar.gz"
|
||||
URL_MD5 261754d7dc2a582f00e35547777e1fea
|
||||
DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies
|
||||
UPDATE_COMMAND "" # Disable update
|
||||
CONFIGURE_COMMAND ../tk/macosx/configure --enable-aqua=yes --enable-threads --enable-framework --prefix=${tcl_prefix} --libdir=${tcl_prefix}/Contents/Frameworks --bindir=${tcl_prefix}/Contents/Frameworks/Tcl.framework/bin --with-tcl=${tcl_prefix}/Contents/Frameworks/Tcl.framework
|
||||
CONFIGURE_COMMAND ../project_tk/macosx/configure --enable-aqua=yes --enable-threads --enable-framework --prefix=${tcl_prefix} --libdir=${tcl_prefix}/Contents/Frameworks --bindir=${tcl_prefix}/Contents/Frameworks/Tcl.framework/bin --with-tcl=${tcl_prefix}/Contents/Frameworks/Tcl.framework
|
||||
BUILD_COMMAND make -j4 binaries libraries
|
||||
INSTALL_COMMAND make install-binaries install-headers install-libraries install-private-headers
|
||||
LOG_DOWNLOAD 1
|
||||
@ -47,7 +47,7 @@ if(APPLE)
|
||||
#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)
|
||||
set(TCL_INCLUDE_PATH ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework/Headers)
|
||||
set(TCL_LIBRARY ${CMAKE_INSTALL_PREFIX}/../Frameworks/Tcl.framework)
|
||||
@ -56,7 +56,7 @@ if(APPLE)
|
||||
|
||||
elseif(WIN32)
|
||||
|
||||
ExternalProject_Add(win_extlibs
|
||||
ExternalProject_Add(project_win_extlibs
|
||||
URL ${EXT_LIBS_DOWNLOAD_URL_WIN}
|
||||
UPDATE_COMMAND "" # Disable update
|
||||
BUILD_IN_SOURCE 1
|
||||
@ -66,7 +66,7 @@ elseif(WIN32)
|
||||
LOG_DOWNLOAD 1
|
||||
)
|
||||
|
||||
list(APPEND NETGEN_DEPENDENCIES win_extlibs)
|
||||
list(APPEND NETGEN_DEPENDENCIES project_win_extlibs)
|
||||
else(WIN32)
|
||||
find_package(TCL 8.5 REQUIRED)
|
||||
endif(APPLE)
|
Loading…
Reference in New Issue
Block a user