-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
65 lines (52 loc) · 1.97 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
cmake_minimum_required(VERSION 3.13)
project (WaveguideAnalysis LANGUAGES CXX)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# this option is useful for static analyzers
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
#this is the folder where additional findMYLIB.cmake modules must be put
#in order to use find_package(MYLIB)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Finding the pz package if not in neopz buildtree
if(NOT CMAKE_IS_PZ_BUILDTREE)
find_package(NeoPZ REQUIRED)
endif()
check_pz_opt(PZ_USING_MKL _PZ_HAS_MKL)
#enabling SLEPc library (enables PETSc, BLAS, LAPACK, ARPACK, SUPERLU and METIS)
option(USING_SLEPC "Whether the SLEPc library will be linked in" OFF)
if(NOT _PZ_HAS_MKL AND NOT USING_SLEPC)
message(FATAL_ERROR "This project requires NeoPZ to "
"have been configured using MKL or USING_SLEPC should be on")
endif()
add_subdirectory(wgma)
if(USING_SLEPC)
include(cmake/enable_slepc.cmake)
enable_slepc(wgma)
endif()
#might be useful for debugging
#remember to call pzutils::SetNumThreadsLocalMKL(0) as well
option(WGMA_SERIAL "Whether to run wgma in serial mode" OFF)
if(WGMA_SERIAL)
target_compile_definitions(wgma PRIVATE WGMA_SERIAL)
endif()
#now we check for json library
find_package(nlohmann_json 3.11.2 QUIET)
if(NOT TARGET nlohmann_json::nlohmann_json)
#could not find package, downloading it
include(FetchContent)
# Optional: set this to ON if your target publicly links to nlohmann_json and needs to install()
# set(JSON_Install ON)
if(NOT json_SOURCE_DIR)
message(STATUS "Downloading nlohmann_json")
endif()
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_PROGRESS TRUE
GIT_SHALLOW TRUE
GIT_TAG v3.11.2)
FetchContent_MakeAvailable(json)
endif()
target_link_libraries(wgma PUBLIC nlohmann_json::nlohmann_json)
#let us add all the examples
add_subdirectory(examples)