-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathCMakeLists.txt
94 lines (72 loc) · 2.32 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
cmake_minimum_required(VERSION 3.14.0)
project(Corklib VERSION 0.9.0)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(BOOST_VERSION "boost_1_77_0")
set(TBB_VERSION "oneapi-tbb-2021.3.0")
set(MPIR_VERSION "mpir-3.0.0")
include(FetchContent)
include(cmake/find_avx.cmake)
FetchContent_Declare(
guidelines_support_lib
GIT_REPOSITORY https://github.com/microsoft/GSL.git
GIT_TAG v3.1.0)
FetchContent_MakeAvailable(guidelines_support_lib)
FetchContent_Declare(
type_safe
GIT_REPOSITORY https://github.com/foonathan/type_safe.git
GIT_TAG main)
FetchContent_MakeAvailable(type_safe)
FetchContent_Declare(
fmtlib
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 8.0.1)
FetchContent_MakeAvailable(fmtlib)
FetchContent_Declare(
cppresult
GIT_REPOSITORY https://github.com/stephanfr/CppResult.git
GIT_TAG main)
FetchContent_MakeAvailable(cppresult)
check_for_avx()
message( STATUS "AVX Status: ${HAVE_AVX_EXTENSIONS}" )
message( STATUS "AVX2 Status: ${HAVE_AVX2_EXTENSIONS}" )
if( HAVE_AVX_EXTENSIONS )
SET( AVX_FLAGS "${AVX_FLAGS} -D__HAVE_AVX_EXTENSIONS__" )
endif ()
if( HAVE_AVX2_EXTENSIONS )
SET( AVX_FLAGS "${AVX_FLAGS} -D__HAVE_AVX2_EXTENSIONS__" )
endif ()
message( STATUS "AVX Flags: ${AVX_FLAGS}" )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AVX_FLAGS} -Wno-deprecated-declarations")
add_compile_definitions(
TRILIBRARY
FMT_HEADER_ONLY
__HAS_PERFORMANCE_STRINGSTREAM__
GSL_UNENFORCED_ON_CONTRACT_VIOLATION
)
# Determine if Cork is built as a subproject (using add_subdirectory)
# or if it is the master project.
if (NOT DEFINED CORK_IS_MASTER_PROJECT)
set(CORK_IS_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CORK_IS_MASTER_PROJECT ON)
message(STATUS "CMake version: ${CMAKE_VERSION}")
message(STATUS "Cork is master project")
endif ()
endif ()
include_directories(
./thirdparty/boost/${BOOST_VERSION}
./include
${fmtlib_SOURCE_DIR}/include
${type_safe_SOURCE_DIR}/include
${type_safe_SOURCE_DIR}/external/debug_assert
${cppresult_SOURCE_DIR}/include
${guidelines_support_lib_SOURCE_DIR}/include
)
add_subdirectory(src)
if ( DEFINED CORK_IS_MASTER_PROJECT )
add_subdirectory(RegressionTest)
add_subdirectory(UnitTest)
endif ()