-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
65 lines (52 loc) · 1.85 KB
/
CMakeLists.txt
File metadata and controls
65 lines (52 loc) · 1.85 KB
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(Warthog
VERSION 0.5.0
LANGUAGES CXX C)
set_property(GLOBAL PROPERTY WARTHOG_warthog-core ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
option(WARTHOG_INT128 "Enable support for __int128 on gcc and clang" OFF)
option(WARTHOG_BMI "Enable support cpu BMI for WARTHOG_INTRIN_HAS(BMI)" OFF)
option(WARTHOG_BMI2 "Enable support cpu BMI2 for WARTHOG_INTRIN_HAS(BMI2), use for Zen 3+" OFF)
option(WARTHOG_INTRIN_ALL "Enable march=native and support x86 intrinsics if able (based on system), supersedes all manual instruction sets" OFF)
include(cmake/warthog.cmake)
add_library(warthog_compile INTERFACE)
add_library(warthog::compile ALIAS warthog_compile)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(warthog_compile INTERFACE
$<$<BOOL:${WARTHOG_INT128}>:-march=native>)
endif()
add_library(warthog_core)
add_library(warthog::core ALIAS warthog_core)
target_include_directories(warthog_core PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
)
target_link_libraries(warthog_core PUBLIC warthog::compile)
include(cmake/headers.cmake)
add_executable(warthog_app)
add_executable(warthog::warthog ALIAS warthog_app)
set_target_properties(warthog_app PROPERTIES OUTPUT_NAME "warthog")
target_link_libraries(warthog_app PUBLIC warthog::core)
add_subdirectory(src)
add_subdirectory(apps)
#
# Testing setup
#
warthog_top_level()
if(_is_top)
option(BUILD_TESTING "Building testing suite" OFF)
include(CTest)
include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.7.1
)
if(BUILD_TESTING)
FetchContent_MakeAvailable(Catch2)
include(Catch)
add_subdirectory(tests)
endif()
endif()