Skip to content

Commit 028bd26

Browse files
committed
chore: add cmake i use it in clion for debugging
1 parent 0217b30 commit 028bd26

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(clox C)
3+
4+
set(CMAKE_C_STANDARD 99)
5+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-parameter -g")
6+
7+
# Source files
8+
set(CLOX_SOURCES
9+
src/scanner.c
10+
src/chunk.c
11+
src/compiler.c
12+
src/debug.c
13+
src/memory.c
14+
src/value.c
15+
src/vm.c
16+
src/object.c
17+
src/table.c
18+
)
19+
20+
# Main executable
21+
add_executable(clox src/main.c ${CLOX_SOURCES})
22+
target_include_directories(clox PRIVATE ${CMAKE_SOURCE_DIR})
23+
24+
# Test executable
25+
set(TEST_SOURCES
26+
tests/scanner_test.c
27+
tests/compiler_test.c
28+
)
29+
30+
add_executable(test_runner ${TEST_SOURCES} ${CLOX_SOURCES})
31+
target_include_directories(test_runner PRIVATE ${CMAKE_SOURCE_DIR})
32+
target_link_libraries(test_runner criterion)

0 commit comments

Comments
 (0)