-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
45 lines (34 loc) · 1.17 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
cmake_minimum_required(VERSION 3.26)
project(chipcraft C)
set(CMAKE_C_STANDARD 17)
# Locate SDL2
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
# Enable CTest
enable_testing()
add_compile_options(-Wextra -Wpedantic -c -Wall -I. -fpic -g -fbounds-check)
add_library(CHIP8_LIBRARIES SHARED
src/chip8.c
include/chip8.h
src/graphics.c
include/graphics.h
src/log.c
include/log.h
)
target_link_libraries(CHIP8_LIBRARIES ${SDL2_LIBRARIES})
add_executable(chipcraft src/main.c
include/main.h
)
target_link_libraries(chipcraft CHIP8_LIBRARIES)
# Test executables
add_executable(test_stack_new tests/test_stack_new.c)
add_executable(test_stack_push tests/test_stack_push.c)
add_executable(test_stack_pop tests/test_stack_pop.c)
# Link SDL and CHIP8 to the tests
target_link_libraries(test_stack_new CHIP8_LIBRARIES pthread)
target_link_libraries(test_stack_push CHIP8_LIBRARIES pthread)
target_link_libraries(test_stack_pop CHIP8_LIBRARIES pthread)
# Add tests to CTest
add_test(NAME StackNew COMMAND test_stack_new)
add_test(NAME StackPush COMMAND test_stack_push)
add_test(NAME StackPop COMMAND test_stack_pop)