hunting/CMakeLists.txt
2023-07-20 08:18:17 -07:00

66 lines
2.0 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

cmake_minimum_required(VERSION 3.5.1)
include(build/global_config.cmake)
project(app)
message("platform = ${TARGET_PLATFORM}")
message("platform PATH = ${PLATFORM_PATH}")
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
include(build/cmake/toolchain/linux.toolchain.cmake)
endif()
#gdb debug
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
message("---------------------------Debug mode.-----------------------")
SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
# asan
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=leak -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=leak -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined")
endif()
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
#编译脚本确定具体平台或者芯片型号,定义宏来进行代码编译
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
add_definitions("-DPLATFORM_LINUX")
endif()
if($ENV{BUILD_COVERAGE} MATCHES "true")
message("you choose to build gcno file")
add_definitions("-fprofile-arcs")
add_definitions("-ftest-coverage")
endif()
#查看是工具链支持情况
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
if(${TARGET_PLATFORM} MATCHES ${DEFINE_LINUX})
# execute_process(COMMAND sh build_lvgl_for_cmakelist.sh ${TARGET_PLATFORM} ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${EXTERNAL_SOURCE_PATH}/lvglLinux-x86/)
# add_subdirectory(external/lvglLinux-x86)
endif()
#添加编译目录
# add_subdirectory(application)
# add_subdirectory(component)
# add_subdirectory(hal)
add_subdirectory(utils)
add_subdirectory(test)
string(COMPARE EQUAL "${PLATFORM_PATH}" "" value)
message("The platform path is ${PLATFORM_PATH}.")
if (value EQUAL 0) #变量被设置了
message("build chip board code.")
add_subdirectory(${PLATFORM_PATH})
endif()