-
Notifications
You must be signed in to change notification settings - Fork 115
/
CMakeLists.txt
36 lines (28 loc) · 1017 Bytes
/
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
cmake_minimum_required(VERSION 3.12)
project(alex)
set(CMAKE_CXX_STANDARD 14)
# Define the macro ‘DEBUG' in the debug mode
if(CMAKE_BUILD_TYPE STREQUAL Debug)
ADD_DEFINITIONS(-DDEBUG)
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "/O2 /arch:AVX2 /W1 /EHsc")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "-O3 -xHost")
else()
# clang and gcc
set(CMAKE_CXX_FLAGS "-O3 -march=native -Wall -Wextra")
endif()
include_directories(src/core)
add_executable(example src/examples/main.cpp)
add_executable(benchmark src/benchmark/main.cpp)
set(DOCTEST_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/doctest)
file(DOWNLOAD
https://raw.githubusercontent.com/onqtam/doctest/2.4.6/doctest/doctest.h
${DOCTEST_DOWNLOAD_DIR}/doctest.h
EXPECTED_HASH SHA1=40728d2bed7f074e80cb095844820114e7d16ce0
)
add_executable(test_alex test/unittest_main.cpp)
target_include_directories(test_alex PRIVATE ${DOCTEST_DOWNLOAD_DIR})
enable_testing()
add_test(test_alex test_alex)