-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
executable file
·59 lines (50 loc) · 1.59 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
# This file is a part of Simple-XX/SimpleRenderer
# (https://github.com/Simple-XX/SimpleRenderer).
#
# CMakeLists.txt for Simple-XX/SimpleRenderer.
# 设置最小 cmake 版本
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)
# 设置项目名与版本
project(SimpleRenderer
VERSION 0.0.1)
# 禁止原地编译
if (${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
# 如果你看到这句话,cmake 此时已经在根目录下生成了一些临时文件,你需要删除它们
# CMakeFiles, CMakeCache.txt
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif ()
# 设置辅助 cmake 脚本路径
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# 导入函数
include(functions)
# 导入第三方依赖
include(3rd)
# 导入编译配置
include(compile_config)
# obj 文件路径
set(OBJ_FILE_PATH "${PROJECT_SOURCE_DIR}/obj/")
# 字体文件路径
set(FONT_FILE_PATH "${wqy_font_SOURCE_DIR}/wqy-zenhei.ttc")
# 线程数
include(ProcessorCount)
ProcessorCount(NPROC)
# 日志文件路径
set(LOG_FILE_PATH "${EXECUTABLE_OUTPUT_PATH}/logs/SimpleRendererLog.log")
# 日志文件大小
set(LOG_FILE_MAX_SIZE 1024*1024*4)
# 日志文件数量
set(LOG_FILE_MAX_COUNT 8)
#Debug Type (for cmake debug)
# set(CMAKE_BUILD_TYPE "Debug")
# 生成配置头文件
configure_file(
"${PROJECT_SOURCE_DIR}/cmake/config.h.in"
"${PROJECT_SOURCE_DIR}/src/include/config.h"
)
# 添加要编译的目录
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(doc)