-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
151 lines (126 loc) · 3.68 KB
/
Copy pathCMakeLists.txt
File metadata and controls
151 lines (126 loc) · 3.68 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
cmake_minimum_required (VERSION 3.24 FATAL_ERROR)
project (sort VERSION 0.1 LANGUAGES C CXX ASM)
# Make including this file idempotent
#
if(TARGET sort OR TARGET sort::sort)
return()
endif()
# Setup symlinks for this architecture
#
# set(SORT_ARCH_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/words/${CMAKE_SYSTEM_PROCESSOR})
# if (EXISTS ${SORT_ARCH_INCLUDE_DIR})
# message("-- sort: Creating architecture symlink to ${CMAKE_SYSTEM_PROCESSOR}")
# execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
# ${SORT_ARCH_INCLUDE_DIR}
# ${CMAKE_SOURCE_DIR}/include/words/arch)
# endif()
# set(SORT_ARCH_SRC_DIR ${CMAKE_SOURCE_DIR}/src/words/${CMAKE_SYSTEM_PROCESSOR})
# if (EXISTS ${SORT_ARCH_SRC_DIR})
# message("-- sort: Creating architecture symlink ${CMAKE_SYSTEM_PROCESSOR}")
# execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
# ${SORT_ARCH_SRC_DIR}
# ${CMAKE_SOURCE_DIR}/src/words/arch)
# endif()
# If this is the current project.
#
if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME)
# Laod the cmake recipes and utilities.
#
include(${CMAKE_CURRENT_LIST_DIR}/cmake/load_cmake_helpers.cmake)
# Options for generating tests and documentation
#
option(SORT_TEST "Generate the tests." ON)
option(SORT_DOCS "Generate the docs." OFF)
# compile_commands.json
#
symlink_compile_commands()
# Convenience targets for git operations
#
make_submodule_pull_target()
# Setup compilation parameters
#
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-Wall)
add_compile_options(-g)
add_compile_options(-O)
# add_compile_options(-fno-omit-frame-pointer)
# add_compile_options(-fsanitize=address)
# add_link_options(-fsanitize=address)
else()
option(SORT_TEST "Generate the tests." OFF)
option(SORT_DOCS "Generate the docs." OFF)
endif()
# Put executables in the top-level binary directory
#
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Output configuration
#
message("-- sort: Configuration: ${CMAKE_CURRENT_SOURCE_DIR}")
message("-- sort: Included from: ${CMAKE_SOURCE_DIR}")
message("-- sort: Install prefix: ${CMAKE_INSTALL_PREFIX}")
message("-- sort: test ${SORT_TEST}")
message("-- sort: docs ${SORT_DOCS}")
# Add our dependencies
#
find_package(Threads REQUIRED)
add_boost_sort()
add_fmt()
add_repo(cpp-core/argparse)
add_repo(cpp-core/record)
add_repo(cpp-core/timer)
# Build the library
#
set(SOURCES
placeholder
)
set(ASM_SOURCES
)
set(FILES)
foreach(SOURCE ${SOURCES})
list(APPEND FILES "src/core/sort/${SOURCE}.cpp")
endforeach()
foreach(SOURCE ${ASM_SOURCES})
set(FILE "src/words/${CMAKE_SYSTEM_PROCESSOR}/${SOURCE}.s")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
list(APPEND FILES ${FILE})
endif()
endforeach()
add_library(sort ${FILES})
add_library(sort::sort ALIAS sort)
# Define the header files for this library.
#
file(GLOB_RECURSE PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h)
target_sources(sort INTERFACE FILE_SET HEADERS BASE_DIRS include FILES ${PUBLIC_INCLUDE_FILES})
target_include_directories(sort PUBLIC ${GMP_INCLUDE_DIRS})
target_link_libraries(sort PUBLIC record::record timer::timer fmt::fmt argparse::argparse)
foreach(prog
example0
example1
measure_sequential
sort0
# sort1
sort2
sort3
sort4
sort5
sort6
)
add_executable(${prog} src/tools/${prog}.cpp)
target_link_libraries(${prog} sort::sort Threads::Threads boost_sort)
endforeach()
# Optionally configure the tests
#
if(SORT_TEST)
add_gtest()
add_subdirectory(test)
endif()
# Optionally configure the documentation
#
# if(SORT_DOCS)
# add_subdirectory(docs)
# endif()
# Installation
#
# install_config(sort)