-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
123 lines (97 loc) · 2.54 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#########################################
# Prepare primary library project
#########################################
message(STATUS "Configuring cwaybeams now")
cmake_minimum_required(VERSION 3.10)
project(cwaybeams LANGUAGES C VERSION 0.1)
include(FindPkgConfig)
include(GNUInstallDirs)
configure_file(include/version.h.in include/version.h)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# set(OpenGL_GL_PREFERENCE GLVND)
#find_package(glfw3 3.3 REQUIRED)
#find_package(OpenGL REQUIRED)
find_package(sdl2 REQUIRED)
if (MSVC)
add_compile_options(/W3 /WX)
else()
add_compile_options(-W -Wall -Werror)
endif()
set(TODO_EXAMPLE_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/examples/todo/main_todo.c"
)
set(FAST_HASH_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/hash/fast_hash.c"
)
# set(SDL_STATIC ON CACHE BOOL "" FORCE)
# set(SDL_SHARED OFF CACHE BOOL "" FORCE)
# add_subdirectory(vendor/sdl3)
add_subdirectory(src)
# Shared library build
add_library(cwaybeams SHARED
${BEAM_SOURCES}
${SDL_RENDERER_SOURCES}
# ${GLFW_RENDERER_SOURCES}
${FAST_HASH_SOURCES}
)
# if(TARGET SDL2)
# target_compile_options(SDL2 PRIVATE
# $<$<OR:$<C_COMPILER_ID:GNU>,$<C_COMPILER_ID:Clang>>:
# -Wno-unused-parameter
# -Wno-sign-compare>
# )
# endif()
target_link_libraries(cwaybeams SDL2
SDL2main
SDL2_ttf
)
set_target_properties(cwaybeams PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(cwaybeams PROPERTIES SOVERSION 0)
target_include_directories(cwaybeams PUBLIC include)
target_include_directories(cwaybeams PRIVATE
src
vendor/hash
)
# target_link_libraries(cwaybeams glfw)
# target_link_libraries(cwaybeams OpenGL::GL)
set(CMAKE_BUILD_TYPE Debug)
add_subdirectory(test)
# Test executable
add_executable(cwaybeams-test
${UNIT_SOURCES}
${BEAM_SOURCES}
# ${SDL_RENDERER_SOURCES}
# ${GLFW_RENDERER_SOURCES}
)
target_compile_definitions(cwaybeams-test PRIVATE
# LOG_VERBOSE_FILE=1 <- Enables full path display on log output
LOG_TEST_MODE=1
)
target_include_directories(cwaybeams-test PRIVATE
include
src
test
vendor/hash
)
# target_link_libraries(cwaybeams-test glfw)
# target_link_libraries(cwaybeams-test OpenGL::GL)
# Example executable
add_executable(todo-example
${TODO_EXAMPLE_SOURCES}
${BEAM_SOURCES}
${SDL_RENDERER_SOURCES}
)
target_link_libraries(todo-example SDL2
SDL2main
SDL2_ttf
)
target_include_directories(todo-example PRIVATE
examples/todo
include
src
vendor/hash
)
# target_link_libraries(todo-example glfw)
# target_link_libraries(todo-example OpenGL::GL)