2022-01-24 13:25:23 +08:00
|
|
|
project(CDROID C CXX)
|
2021-06-24 10:12:55 +08:00
|
|
|
cmake_minimum_required (VERSION 3.2)
|
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
2023-04-11 18:14:57 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2021-06-24 10:12:55 +08:00
|
|
|
|
2023-09-13 10:17:11 +08:00
|
|
|
|
2023-04-11 10:53:24 +08:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules)
|
2021-06-24 10:12:55 +08:00
|
|
|
include(cmake/common_functions.cmake)
|
|
|
|
include(cmake/options.cmake)
|
|
|
|
|
2023-09-08 09:12:03 +08:00
|
|
|
if(COMMAND cmake_policy)
|
|
|
|
cmake_policy(SET CMP0003 NEW)
|
|
|
|
#make vcpkg happy:)
|
|
|
|
endif(COMMAND cmake_policy)
|
|
|
|
|
2022-11-26 23:21:07 +08:00
|
|
|
set(DISABLE_FORCE_DEBUG_POSTFIX ON)
|
2022-11-30 17:11:10 +08:00
|
|
|
|
2021-06-24 10:12:55 +08:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
|
|
|
add_definitions(-DDEBUG)
|
|
|
|
endif()
|
2023-09-14 18:54:09 +08:00
|
|
|
if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
|
2023-09-20 09:33:16 +08:00
|
|
|
add_link_options("LINKER:-rpath-link,${CMAKE_SOURCE_DIR}/src/porting/${CDROID_CHIPSET}/lib")
|
2023-09-14 18:54:09 +08:00
|
|
|
endif()
|
2021-06-24 10:12:55 +08:00
|
|
|
add_subdirectory(src/porting)
|
2022-12-23 11:39:34 +08:00
|
|
|
add_subdirectory(src/gui)
|
|
|
|
add_subdirectory(src/modules)
|
2023-04-21 08:49:04 +08:00
|
|
|
add_subdirectory(src/3rdparty/pinyin)
|
2022-12-23 11:39:34 +08:00
|
|
|
|
2021-06-24 10:12:55 +08:00
|
|
|
add_subdirectory(apps)
|
|
|
|
|
|
|
|
add_subdirectory(tests)
|
|
|
|
|
2024-03-08 09:28:34 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND git describe --tags --abbrev=0
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_TAG
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
2023-08-31 18:06:42 +08:00
|
|
|
execute_process(
|
|
|
|
COMMAND git rev-parse --short HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND git rev-parse --abbrev-ref HEAD
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE GIT_BRANCH_NAME
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2024-03-08 09:28:34 +08:00
|
|
|
message("Git Tag: ${GIT_TAG}")
|
|
|
|
message("Git Commit Hash: ${GIT_COMMIT_HASH}")
|
|
|
|
message("Git Branch: ${GIT_BRANCH}")
|
2023-08-31 18:06:42 +08:00
|
|
|
string(TIMESTAMP COMPILE_TIME "%Y%m%d_%H%M%S")
|
|
|
|
set(CPACK_PACKAGE_NAME "CDROID-${COMPILE_TIME}-${GIT_COMMIT_HASH}")
|
|
|
|
set(CPACK_PACKAGE_VERSION "1.0.0")
|
|
|
|
set(CPACK_GENERATOR "ZIP") # Choose the desired generator (e.g., ZIP, TGZ, NSIS, etc.)
|
|
|
|
include(CPack)
|
2023-04-11 10:53:24 +08:00
|
|
|
|
2021-06-24 10:12:55 +08:00
|
|
|
if(BUILD_DOCS)
|
2022-11-30 17:11:10 +08:00
|
|
|
include(cmake/build_doxygen.cmake)
|
|
|
|
build_doxygen()
|
2021-06-24 10:12:55 +08:00
|
|
|
endif()
|
|
|
|
|