blob: c5412d7af7a1ef5bc9bf1907b4fc4ce5819f0680 (
plain)
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
|
# ------------------------------------------------------------ #
# -------------- DO NOT TOUCH BELOW THIS LINE ---------------- #
# ------------------------------------------------------------ #
# this must be the first line of a CMake script.
# sets the lowerbound on what CMake version can be used.
cmake_minimum_required(VERSION 3.0)
# the name of this CMake project and what language it uses
# we could list more languages if we were using more.
project(COMP6771_LAB_001 LANGUAGES CXX)
# we use C++20
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
# this is helpful for editors like VS Code
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# helpful compiler flags for gcc/clang
# the descriptions for these flags can be found on the GNU Compiler Collection's webpage.
add_compile_options(
-Wall
-Wextra
-pedantic-errors
-Wconversion
-Wsign-conversion
-Wdouble-promotion
-Wcast-align
-Wformat=2
-Wuninitialized
-Wnon-virtual-dtor
-Woverloaded-virtual
-Wdeprecated-copy-dtor
-Wold-style-cast
-Wzero-as-null-pointer-constant
-Wsuggest-override
-fstack-protector-strong
-O2
)
# debug builds should be compiled with sanitizers
# sanitizers are small libraries that check things like buffer overrun with minimal runtime overhead.
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-fsanitize=address,undefined")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-fsanitize=address,undefined")
set(CMAKE_CXX_EXE_LINKER_FLAGS_DEBUG_INIT "-fsanitize=address,undefined")
set(CMAKE_CXX_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-fsanitize=address,undefined")
# add the testing library Catch2
enable_testing()
add_library(catch2_main lib/catch2_main.cpp)
target_include_directories(catch2_main PUBLIC lib)
# link the library so that other programs can get it
link_libraries(catch2_main)
# ------------------------------------------------------------ #
# -------------- DO NOT MODIFY ABOVE THIS LINE --------------- #
# ------------------------------------------------------------ #
# make sure english.txt is with the build files
configure_file(src/english.txt english.txt COPYONLY)
# adding word_ladder library
add_library(word_ladder src/word_ladder.cpp)
link_libraries(word_ladder)
# adding main file
add_executable(debugging src/main.cpp)
# adding test file
add_executable(word_ladder_test_exe src/word_ladder.test.cpp)
add_test(word_ladder_test word_ladder_test_exe)
# adding benchmark file
add_executable(word_ladder_benchmark_exe src/word_ladder_benchmark.test.cpp)
add_test(word_ladder_benchmark word_ladder_benchmark_exe)
|