2022-03-03 19:13:50 +03:00
|
|
|
# SPDX-FileCopyrightText: 2021 Mikhail Zolotukhin <mail@gikari.com>
|
2021-11-08 23:58:03 +03:00
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
|
|
|
project(bismuth)
|
|
|
|
|
2021-11-20 03:48:17 +03:00
|
|
|
option(
|
|
|
|
USE_TSC
|
|
|
|
"Use TypeScript Compler to check the code before bundling \
|
|
|
|
using esbuild. This could be useful, if you know, that the \
|
|
|
|
code is correct and you want to speed up building times. \
|
|
|
|
For example - you are a packager."
|
2022-03-19 13:21:06 +03:00
|
|
|
ON)
|
2021-11-20 03:48:17 +03:00
|
|
|
|
2021-11-20 04:49:08 +03:00
|
|
|
option(
|
|
|
|
USE_NPM
|
|
|
|
"Use npm installed packages during the build. You might \
|
|
|
|
want to disable this option, if you want to use natively \
|
|
|
|
installed tools. In particular build systems won't use \
|
|
|
|
\"npx\" prefix before commands."
|
2022-03-19 13:21:06 +03:00
|
|
|
ON)
|
2021-11-20 04:49:08 +03:00
|
|
|
|
2021-11-16 01:25:33 +03:00
|
|
|
set(QT_MIN_VERSION "5.15.0")
|
2022-02-09 21:01:18 +03:00
|
|
|
set(KF5_MIN_VERSION "5.78.0")
|
2021-11-16 01:25:33 +03:00
|
|
|
|
2022-03-19 13:21:06 +03:00
|
|
|
# HACK: Use git to get the recent version We could explicitly set the version
|
|
|
|
# via project declaration But this would conflict with package.json and would
|
2021-11-28 16:28:59 +03:00
|
|
|
# Require automatic change via Release Please time CI
|
2022-03-19 13:21:06 +03:00
|
|
|
execute_process(COMMAND "git" "describe" "--tags" "--abbrev=0"
|
|
|
|
OUTPUT_VARIABLE CMAKE_PROJECT_VERSION)
|
2021-11-28 16:28:59 +03:00
|
|
|
string(REPLACE "\n" "" CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION}")
|
|
|
|
string(REPLACE "v" "" CMAKE_PROJECT_VERSION "${CMAKE_PROJECT_VERSION}")
|
|
|
|
|
2022-03-19 13:21:06 +03:00
|
|
|
# TODO: Less hacky solution, however it requires CMake 3.19 which is not so
|
|
|
|
# common across distros as of now. Uncomment when cmake_minimum_required >=
|
|
|
|
# 3.19.
|
2021-11-28 16:28:59 +03:00
|
|
|
#
|
2022-03-19 13:21:06 +03:00
|
|
|
# # Set the project version file(READ ${CMAKE_CURRENT_SOURCE_DIR}/package.json
|
|
|
|
# PACKAGE_JSON) string(JSON CMAKE_PROJECT_VERSION GET ${PACKAGE_JSON} version)
|
2021-11-28 16:28:59 +03:00
|
|
|
# unset(PACKAGE_JSON)
|
|
|
|
|
2021-11-16 01:25:33 +03:00
|
|
|
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
|
2022-02-07 22:41:28 +03:00
|
|
|
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
2021-11-16 01:25:33 +03:00
|
|
|
|
|
|
|
include(KDEInstallDirs)
|
|
|
|
include(KDECMakeSettings)
|
2022-01-14 21:59:40 +03:00
|
|
|
include(KDEClangFormat)
|
2021-11-16 01:25:33 +03:00
|
|
|
include(ECMInstallIcons)
|
2022-02-10 15:53:28 +03:00
|
|
|
include(ECMQtDeclareLoggingCategory)
|
2021-11-16 01:25:33 +03:00
|
|
|
|
2022-02-07 15:47:58 +03:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2022-03-19 13:21:06 +03:00
|
|
|
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS DBus Quick Svg
|
|
|
|
Test)
|
|
|
|
|
|
|
|
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
|
|
|
|
COMPONENTS I18n KCMUtils Declarative GlobalAccel Config)
|
2021-11-16 01:25:33 +03:00
|
|
|
|
2022-02-07 22:41:28 +03:00
|
|
|
include_directories("${PROJECT_SOURCE_DIR}/external")
|
|
|
|
|
2022-03-03 19:13:50 +03:00
|
|
|
if(NOT BUILD_TESTING)
|
2022-02-08 15:18:30 +03:00
|
|
|
add_compile_definitions(DOCTEST_CONFIG_DISABLE)
|
2022-02-07 22:41:28 +03:00
|
|
|
endif()
|
|
|
|
|
2021-11-08 23:58:03 +03:00
|
|
|
add_subdirectory(src)
|
2022-02-07 22:41:28 +03:00
|
|
|
|
2022-03-03 19:13:50 +03:00
|
|
|
if(BUILD_TESTING)
|
2022-02-07 22:41:28 +03:00
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|