-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
52 lines (37 loc) · 1.35 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
cmake_minimum_required(VERSION 3.5)
project(r2)
find_package(SDL2 REQUIRED)
find_package(Freetype REQUIRED)
find_package(cglm REQUIRED)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fomit-frame-pointer -ffile-prefix-map='${CMAKE_CURRENT_SOURCE_DIR}/src/sources/'=")
file(GLOB PROJECT_HEADERS src/headers/*.h)
file(GLOB PROJECT_SOURCES src/sources/*.c)
source_group("Headers" FILES ${PROJECT_HEADERS})
source_group("Sources" FILES ${PROJECT_SOURCES})
add_library(${PROJECT_NAME} STATIC ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${VENDORS_SOURCES})
target_include_directories(${PROJECT_NAME} PRIVATE
src/headers/
${FREETYPE_INCLUDE_DIRS}
${CGLM_INCLUDE_DIRS}
)
target_link_libraries(${PROJECT_NAME} PRIVATE
m
SDL2::SDL2
${FREETYPE_LIBRARIES}
${CGLM_INCLUDE_DIRS}
)
target_compile_definitions(${PROJECT_NAME} PRIVATE
-DPROJECT_SOURCE_DIR=\"${PROJECT_SOURCE_DIR}\"
)
add_executable(demo demo/main.c)
target_link_libraries(demo PRIVATE ${PROJECT_NAME})
target_include_directories(demo PRIVATE
${CMAKE_SOURCE_DIR}/src/headers
)
file(COPY ${CMAKE_SOURCE_DIR}/demo/rsc DESTINATION ${CMAKE_BINARY_DIR})
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/headers/ DESTINATION include/r2)