blob: 85f302485f56ee7cbdfdeb050cf3566e7846019a (
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
80
81
82
83
84
85
86
87
88
|
cmake_minimum_required(VERSION 3.2)
project(honeysuckle
VERSION 0.1.0
DESCRIPTION "A C library to make writing lua bindings simple")
find_package(Lua51 REQUIRED)
include_directories(${LUA_INCLUDE_DIR})
# build and link the library
set(HS_ROOT ${CMAKE_SOURCE_DIR}/src)
set(HONEYSUCKLE_SOURCES
${HS_ROOT}/hs_type_to_string.c
${HS_ROOT}/hs_pushstring.c
${HS_ROOT}/hs_throw_error.c
${HS_ROOT}/hs_parse_args.c
${HS_ROOT}/hs_create_table.c
${HS_ROOT}/hs_process_table.c
)
add_library(honeysuckle ${HONEYSUCKLE_SOURCES})
set_target_properties(honeysuckle PROPERTIES
C_STANDARD 99
CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic")
target_link_libraries(honeysuckle ${LUA_LIBRARIES})
set_target_properties(honeysuckle PROPERTIES
VERSION ${PROJECT_VERSION}
PUBLIC_HEADER src/honeysuckle.h)
# optionally build the tests
set(TEST_ROOT ${CMAKE_SOURCE_DIR}/src/tests)
set(TEST_SOURCES
${TEST_ROOT}/tests_main.c
${TEST_ROOT}/hs_type_to_string_tests.c
${TEST_ROOT}/hs_parse_args_tests.c
${TEST_ROOT}/hs_parse_overloaded_tests.c
${TEST_ROOT}/hs_create_table_tests.c
${TEST_ROOT}/hs_process_table_tests.c
${TEST_ROOT}/hs_throw_error_tests.c
# ${TEST_ROOT}/hs_traceback_tests.c
# ${TEST_ROOT}/hs_call_tests.c
# ${TEST_ROOT}/hs_call_args_tests.c
${TEST_ROOT}/hs_pushstring_tests.c
# ${TEST_ROOT}/hs_rxx_tests.c
)
add_executable(test EXCLUDE_FROM_ALL ${TEST_SOURCES})
set_target_properties(test PROPERTIES
C_STANDARD 99
CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic")
target_link_libraries(test ${LUA_LIBRARIES} honeysuckle)
# optionally build the examples
set(EX_ROOT ${CMAKE_SOURCE_DIR}/examples)
add_executable(example_table_creation EXCLUDE_FROM_ALL
${EX_ROOT}/table_creation/table_creation.c)
set_target_properties(example_table_creation PROPERTIES
C_STANDARD 99
CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic")
target_link_libraries(example_table_creation ${LUA_LIBRARIES} honeysuckle)
add_executable(example_argument_parsing EXCLUDE_FROM_ALL
${EX_ROOT}/argument_parsing/argument_parsing.c)
set_target_properties(example_argument_parsing PROPERTIES
C_STANDARD 99
CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic")
target_link_libraries(example_argument_parsing ${LUA_LIBRARIES} honeysuckle)
add_executable(example_table_processing EXCLUDE_FROM_ALL
${EX_ROOT}/table_processing/table_processing.c)
set_target_properties(example_table_processing PROPERTIES
C_STANDARD 99
CMAKE_C_FLAGS "-Wall -Wextra -Werror -Wfatal-errors -Wpedantic")
target_link_libraries(example_table_processing ${LUA_LIBRARIES} honeysuckle)
add_custom_target(examples)
add_dependencies(examples
example_table_creation
example_argument_parsing
example_table_processing)
include(GNUInstallDirs)
install(TARGETS honeysuckle
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|