-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
69 lines (62 loc) · 1.85 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
cmake_minimum_required(VERSION 3.5)
project(diagblock VERSION 0.0.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(ExternalProject)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
find_package(BLAS REQUIRED)
find_package(GSL REQUIRED)
# FMT
ExternalProject_Add(Fmt
PREFIX fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt
GIT_TAG 4.0.0
CMAKE_CACHE_ARGS "-DFMT_DOC:BOOL=OFF" "-DFMT_INSTALL:BOOL=ON" "-DFMT_TEST:BOOL=OFF"
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
)
set(FMT_INCLUDE_DIR "${CMAKE_BINARY_DIR}/fmt/include")
if (WIN32)
set(FMT_LIB "${CMAKE_BINARY_DIR}/fmt/lib/fmt.lib")
else()
set(FMT_LIB "${CMAKE_BINARY_DIR}/fmt/lib/libfmt.a")
endif()
# Blaze
# ExternalProject_Add(Blaze
# PREFIX blaze
# GIT_REPOSITORY https://bitbucket.org/blaze-lib/blaze
# CMAKE_CACHE_ARGS "-DFMT_DOC:BOOL=OFF" "-DFMT_INSTALL:BOOL=ON" "-DFMT_TEST:BOOL=OFF"
# CMAKE_ARGS
# -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
# )
# set(BLAZE_INCLUDE_DIR "${CMAKE_BINARY_DIR}/blaze/include")
# set(BLAZE_LIB "${CMAKE_BINARY_DIR}/blaze/lib/")
add_executable(diagblock
src/main.cc
src/eigenblock.cc
src/gslblock.cc
src/diagblock.cc
)
add_dependencies(diagblock Fmt)
target_include_directories(diagblock PUBLIC
${FMT_INCLUDE_DIR}
${BLAS_INCLUDE_DIR}
)
target_link_libraries(diagblock
Eigen3::Eigen
${FMT_LIB}
blas
gsl
)