1 Star 0 Fork 96

swordcoder/chcore-lab-v2

forked from kikiyu/chcore-lab-v2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 1.90 KB
一键复制 编辑 原始数据 按行查看 历史
richardchien 提交于 2022-02-28 03:52 . lab1
cmake_minimum_required(VERSION 3.14)
project(ChCore)
set(_cmake_script_dir ${CMAKE_CURRENT_SOURCE_DIR}/scripts/build/cmake)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${_cmake_script_dir}/Modules)
include(SubProject)
include(CommonTools)
chcore_dump_chcore_vars()
chcore_get_nproc(_nproc)
if(CHCORE_VERBOSE_BUILD)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
set(_common_args
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
-DCHCORE_PROJECT_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE})
# Construct cache args list for subprojects (kernel, libchcore, etc)
macro(chcore_config _config_name _config_type _default _description)
if(NOT DEFINED ${_config_name})
message(
FATAL_ERROR
"Do not run CMake command directly, use `./chbuild` instead")
endif()
list(APPEND _cache_args
-D${_config_name}:${_config_type}=${${_config_name}})
endmacro()
include(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake)
# --- Kernel ---
set(_kernel_source_dir ${CMAKE_CURRENT_SOURCE_DIR}/kernel)
set(_kernel_build_dir ${_kernel_source_dir}/_build)
set(_kernel_install_dir ${CMAKE_CURRENT_BINARY_DIR})
# Main targets for kernel
chcore_add_subproject(
kernel
SOURCE_DIR ${_kernel_source_dir}
BINARY_DIR ${_kernel_build_dir}
INSTALL_DIR ${_kernel_install_dir}
CMAKE_ARGS
${_common_args}
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
-DCMAKE_TOOLCHAIN_FILE=${_cmake_script_dir}/Toolchains/kernel.cmake
CMAKE_CACHE_ARGS ${_cache_args}
BUILD_ALWAYS TRUE)
# Clean target for kernel
add_custom_target(
kernel-clean
COMMAND /bin/rm -rf ${_kernel_build_dir}
COMMAND [ -f ${_kernel_install_dir}/install_manifest.txt ] && cat
${_kernel_install_dir}/install_manifest.txt | xargs rm -rf || true)
# --- Clean All ---
add_custom_target(
clean-all
COMMAND ${CMAKE_COMMAND} --build . --target kernel-clean)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/swordcoder/chcore-lab-v2.git
git@gitee.com:swordcoder/chcore-lab-v2.git
swordcoder
chcore-lab-v2
chcore-lab-v2
lab1

搜索帮助