-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
73 lines (57 loc) · 1.66 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
cmake_minimum_required(VERSION 3.10)
project(fnt_creator)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(OutBinDir ${CMAKE_BINARY_DIR}/Bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OutBinDir}/$<CONFIG>")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OutBinDir}/$<CONFIG>")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OutBinDir}/$<CONFIG>")
set(CMAKE_VS_DEBUGGER_WORKING_DIRECTORY "${OutBinDir}/$<CONFIG>")
# 添加glfw库
add_subdirectory(3rd/glfw)
# refskia
add_subdirectory(3rd/refskia)
# asyncplusplus
add_subdirectory(3rd/asyncplusplus)
# 设置编译条件
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /MTd")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -std=c++11")
if(NOT WIN32)
set(GLAD_LIBRARIES dl)
endif()
endif()
# 包含头文件的目录
include_directories(
3rd/glad/include/
3rd/glfw/include/
3rd/glm/
3rd/stb/
3rd/imgui/
3rd/imgui/backends/
)
# 收集项目文件
file(
GLOB VENDORS_SOURCES
3rd/glad/src/glad.c
3rd/imgui/backends/imgui_impl_glfw.cpp
3rd/imgui/backends/imgui_impl_opengl3.cpp
3rd/imgui/imgui*.cpp
)
# 添加文件分组
source_group("vendors" FILES ${VENDORS_SOURCES})
############################################# fnt_creator #############################################
set(APP_NAME fnt_creator)
file(GLOB APP_SOURCES
apps/fnt_creator/*.h
apps/fnt_creator/*.cpp
)
# 链接可执行文件
add_executable(${APP_NAME} ${APP_SOURCES} ${VENDORS_SOURCES})
# 链接库
target_link_libraries(${APP_NAME} glfw refskia Async++ ${GLAD_LIBRARIES})
set_target_properties(${APP_NAME} PROPERTIES
FOLDER "apps"
)