-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
60 lines (43 loc) · 1.57 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
cmake_minimum_required(VERSION 3.9)
# Set a name and a version number for your project:
project(phgasnets VERSION 0.0.1 LANGUAGES CXX)
# Set CMake policies for this project
# We allow <Package>_ROOT (env) variables for locating dependencies
cmake_policy(SET CMP0074 NEW)
# Initialize some default paths
include(GNUInstallDirs)
# Define the minimum C++ standard that is required
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Set build type specific flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fopenmp -march=native -mfma -fpic -ftree-vectorize")
# Set default build type to Release if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
# Set possible build types
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
# External dependencies
# nlohmann_json
find_package(nlohmann_json 3.10 REQUIRED)
# Eigen
find_package(Eigen3 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
# HDF5
enable_language(C)
find_package(HDF5 REQUIRED)
# HighFive
find_package(HighFive 2.8 REQUIRED)
# Ceres
find_package(Ceres 2.0.0 REQUIRED)
# compile the library
add_subdirectory(src)
# compile the demos
add_subdirectory(demos)
# Add an alias target for use if this project is included as a subproject in another project
add_library(phgasnets::phgasnets ALIAS phgasnets)
# # This prints a summary of found dependencies
include(FeatureSummary)
feature_summary(WHAT ALL)