-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
103 lines (83 loc) · 2.18 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
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
cmake_minimum_required (VERSION 3.16)
project(etripator
VERSION 0.9.0
LANGUAGES C)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_compile_definitions(_XOPEN_SOURCE=700)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
enable_testing()
include(CheckSymbolExists)
check_symbol_exists(strdup "string.h" HAVE_STRDUP)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}")
find_package(Doxygen)
find_package(Jansson)
set(CMAKE_C_STANDARDS 11)
add_subdirectory(externals)
set(etripator_SRC
message.c
message/file.c
message/console.c
jsonhelpers.c
decode.c
section.c
section/load.c
section/save.c
opcodes.c
comment.c
label.c
label/load.c
label/save.c
irq.c
memory.c
memorymap.c
rom.c
cd.c
ipl.c
)
set(etripator_HDR
config.h
message.h
message/file.h
message/console.h
jsonhelpers.h
decode.h
section.h
opcodes.h
comment.h
label.h
irq.h
memory.h
memorymap.h
rom.h
cd.h
ipl.h
)
add_library(etripator STATIC ${etripator_SRC} ${etripator_HDR})
set_target_properties(etripator PROPERTIES C_STANDARD 11)
target_include_directories(etripator PUBLIC ${JANSSON_INCLUDE_DIRS} ${EXTRA_INCLUDE} externals)
target_compile_definitions(etripator PRIVATE _POSIX_C_SOURCE)
target_link_libraries(etripator PUBLIC ${JANSSON_LIBRARIES} cwalk)
add_executable(etripator_cli cli/etripator.c cli/options.c)
set_target_properties(etripator_cli
PROPERTIES
OUTPUT_NAME etripator
C_STANDARD 11
)
target_include_directories(etripator_cli PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(etripator_cli etripator argparse)
set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in)
set(DOXYFILE ${CMAKE_CURRENT_BINARY_DIR}/doxyfile)
configure_file(${DOXYFILE_IN} ${DOXYFILE} @ONLY IMMEDIATE)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE}
SOURCES ${DOXYFILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)
add_subdirectory(test)
install(TARGETS etripator_cli DESTINATION bin)