forked from ALPSCore/ALPSCore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
95 lines (77 loc) · 3.1 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#
# global cmake configuration file for ALPSCore
#
cmake_minimum_required (VERSION 3.1)
project(ALPSCore C CXX)
# # TODO: should probably a bit more fine-grained
# # Is expected to be taken care of by ALPS_CXX_STD, which works transitively
# set(CMAKE_CXX_STANDARD 11)
# include cmake scripts from common/cmake directory
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/common/cmake)
include(ALPSCommonModuleDefinitions)
# check that compiler version is OK.
include(ALPSCompilerVersionCheck)
# take care of compiler-specific tweaks
include(ALPSCompilerTweaks)
include(ALPSEnableMPI)
include(ALPSEnableEigen)
# ALPS_GLOBAL_BUILD means building project all at once
set(ALPS_GLOBAL_BUILD true)
# Documentation
option(DocumentationOnly "Build only documentation, no code or tests" OFF)
mark_as_advanced(DocumentationOnly)
option(Documentation "Build documentation" ON)
if (DocumentationOnly)
set(Documentation ON)
endif (DocumentationOnly)
set(_am_building_documentation ${Documentation})
if (Documentation)
message(STATUS "Enable build of documentation")
set(Documentation OFF) # not to spawn make doc jobs for each module
endif(Documentation)
# enable Testing
option(Testing "Enable testing" ON)
option(ExtensiveTesting "Enable extensive testing, including time consuming tests" OFF)
mark_as_advanced(ExtensiveTesting)
if (Testing AND NOT DocumentationOnly)
enable_testing()
include(ALPSEnableTests) #defined in common/cmake
endif(Testing AND NOT DocumentationOnly)
# Normalize the list of disabled modules (aka packages)
# FIXME: this inconsistent dual-naming "${module}" vs "alps-${module}" should go away!
foreach(module_ ${ALPS_MODULES_DISABLE})
list(APPEND ALPS_MODULES_DISABLE "alps-${module_}")
endforeach()
# each module is defined as a cmake project in a subdirectory
# also add to utilities/include/config.hpp.in under "Available ALPSCore components"
set(ALPS_KNOWN_COMPONENTS)
foreach(module_ utilities hdf5 accumulators params mc gf alea)
list(FIND ALPS_MODULES_DISABLE ${module_} disabled_index_)
if (disabled_index_ EQUAL -1)
add_subdirectory(${module_})
alps_add_module("alps-${module_}" ${module_})
list(APPEND ALPS_KNOWN_COMPONENTS ${module_})
else()
message("\nNOTE: module ${module_} is disabled")
endif()
endforeach()
#Doxygen building is a function to prevent namespace damage
function(build_documentation_)
set(DOXYFILE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/common/doc")
message(STATUS "Building documentation for sources in ${DOXYFILE_EXTRA_SOURCES}")
set(DOXYFILE_IN "${PROJECT_SOURCE_DIR}/common/doc/Doxyfile.in")
set(CMAKE_PROJECT_NAME "ALPSCore reference") # to provide name for the documentation
include(UseDoxygen)
unset(CMAKE_PROJECT_NAME)
endfunction()
if(_am_building_documentation)
build_documentation_()
endif(_am_building_documentation)
# unset(_am_building_documentation CACHE)
# miscellaneous operations
# Create the main config file
gen_cfg_main()
# Create the main *.hpp config file
gen_main_hpp_config()
# create module file for lmod manager
configure_file("${PROJECT_SOURCE_DIR}/common/misc/alpscore.lmod.in" "${PROJECT_BINARY_DIR}/alpscore.lmod")