-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (44 loc) · 1.4 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
cmake_minimum_required(VERSION 3.16)
project(scene C ASM)
# 设置参数
set(CMAKE_C_STANDARD 99)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
# 设置构建开关
set(BUILD_TEST on)
# 设置工程相关属性
set(PROJECT_SCRIPT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/scripts/cmake)
# 设置CMake组件
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SCRIPT_PATH}/Modules)
# 检查工具
if (EXISTS ${CMAKE_LINKER})
message(STATUS "Check for linker: ${CMAKE_LINKER}")
else()
message(FATAL_ERROR "Linker not found!")
endif()
if (EXISTS ${CMAKE_OBJCOPY})
message(STATUS "Check for objcopy: ${CMAKE_OBJCOPY}")
else()
message(FATAL_ERROR "Command objcopy not found!")
endif()
find_program(CMAKE_DD dd)
if (EXISTS ${CMAKE_DD})
message(STATUS "Check for dd: ${CMAKE_DD}")
else()
message(FATAL_ERROR "Command dd not found!")
endif()
# 设置全局可见目标名称
set(TOOLS_TARGET tools)
set(BOOT_BLOCK_TARGET boot) # 引导
set(LOADER_TARGET loader) # 加载
set(KERNEL_TARGET kernel)
set(FINAL_TARGET scene)
add_subdirectory(src)
if (BUILD_TEST)
add_subdirectory(test)
endif()
add_custom_target(rebuild
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target all
)