Hanoi-Towers/CMakeLists.txt

156 lines
3.8 KiB
CMake
Raw Permalink Normal View History

2020-03-31 12:00:43 +03:00
#
# Copyright (C) 2018-2021 QuasarApp.
2020-03-31 12:00:43 +03:00
# Distributed under the lgplv3 software license, see the accompanying
# Everyone is permitted to copy and distribute verbatim copies
# of this license document, but changing it is not allowed.
#
cmake_minimum_required(VERSION 3.1)
2020-05-03 20:38:35 +03:00
project(HanoiTowers)
2020-03-31 12:00:43 +03:00
2020-10-23 14:15:58 +03:00
set(BUILD_SHARED_LIBS ON)
2022-02-23 13:45:52 +03:00
set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/HanoiTowers/client/android")
2021-04-12 12:30:24 +03:00
2021-04-20 18:42:04 +03:00
include(submodules/Heart/QuasarAppLib/CMake/QuasarApp.cmake)
2021-04-12 17:25:05 +03:00
include(submodules/Heart/QuasarAppLib/CMake/Version.cmake)
2021-05-09 10:20:39 +03:00
initAll()
2021-04-12 12:30:24 +03:00
2021-04-12 12:25:45 +03:00
if (DEFINED TARGET_PLATFORM_TOOLCHAIN)
if (${TARGET_PLATFORM_TOOLCHAIN} STREQUAL "wasm32")
return()
endif()
endif()
2021-05-04 14:11:52 +03:00
if (NOT DEFINED ONLINE_FUNCTIONS)
set(ONLINE_FUNCTIONS OFF)
endif()
if(ONLINE_FUNCTIONS)
add_definitions(-DONLINE_FUNCTIONS)
2021-05-10 18:58:00 +03:00
else()
2021-05-10 19:27:27 +03:00
set(HEART_SSL OFF)
2021-05-04 14:11:52 +03:00
endif()
2021-04-12 17:25:05 +03:00
if (NOT DEFINED HANOI_TESTS)
set(HANOI_TESTS ON)
if (ANDROID)
set(HANOI_TESTS OFF)
endif()
endif()
2021-05-11 11:30:39 +03:00
if (NOT DEFINED HANOI_ADMOD)
set(HANOI_ADMOD OFF)
if (ANDROID)
set(HANOI_ADMOD OFF)
endif()
endif()
if (HANOI_ADMOD)
add_definitions(-DHANOI_ADMOD)
endif()
2021-04-12 17:25:05 +03:00
if (NOT DEFINED HANOI_SERVER)
2022-02-22 17:02:45 +03:00
set(HANOI_SERVER OFF)
2021-04-12 17:25:05 +03:00
if (ANDROID OR WIN32)
set(HANOI_SERVER OFF)
endif()
2021-05-10 18:58:00 +03:00
if ( NOT ONLINE_FUNCTIONS)
2021-05-04 14:11:52 +03:00
set(HANOI_SERVER OFF)
endif()
2021-04-12 17:25:05 +03:00
endif()
if (NOT DEFINED HANOI_CLIENT)
set(HANOI_CLIENT ON)
endif()
SET(INSTALLER_DIR "${CMAKE_CURRENT_SOURCE_DIR}/installer/")
SET(DATA_DIR "${INSTALLER_DIR}/packages/HanoiTowers/data")
2020-04-09 21:47:05 +03:00
SET(TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Distro")
2022-02-22 21:50:05 +03:00
updateGitVars()
set(HANOI_TOWERS_SHORT_VERSION "1.${GIT_COMMIT_COUNT}")
2022-02-22 22:43:08 +03:00
set(HANOI_TOWERS_VERSION "${HANOI_TOWERS_SHORT_VERSION}.${GIT_COMMIT_HASH}")
2022-02-22 21:50:05 +03:00
2020-05-04 11:58:54 +03:00
file(MAKE_DIRECTORY ${TARGET_DIR})
2021-04-12 12:24:02 +03:00
addDoc(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/doxygen.conf)
2020-05-09 00:42:29 +03:00
2021-04-12 12:27:06 +03:00
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
2020-04-21 21:31:05 +03:00
2021-07-20 11:28:55 +03:00
if(${QT_VERSION_MAJOR} GREATER 5)
2021-07-20 12:11:45 +03:00
message("This project not support qt6 libraries. Please use the qt5 libraries for building.")
2021-07-20 11:28:55 +03:00
return()
endif()
2021-07-20 11:56:39 +03:00
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
2021-07-20 11:28:55 +03:00
2020-04-21 21:31:05 +03:00
# Add sub directories
2021-04-12 17:25:05 +03:00
if (HANOI_TESTS)
set (CREDITS_TESTS ON)
set (HEART_TESTS ON)
set (PATRONUM_TESTS ON)
else()
set (CREDITS_TESTS OFF)
set (HEART_TESTS OFF)
set (PATRONUM_TESTS OFF)
endif()
2022-02-23 13:45:52 +03:00
option(HEART_SSL "This option enable or disabled ssl functions of nodes" OFF)
2021-04-12 17:25:05 +03:00
add_subdirectory(submodules/Heart)
add_subdirectory(HanoiTowers/Protockol)
if (HANOI_CLIENT)
set (CREDITS_EXAMPLES OFF)
set (LOGINVIEW_EXAMPLES OFF)
set (VIEWSOLUTIONS_EXAMPLES OFF)
add_subdirectory(submodules/QMLLoginView)
add_subdirectory(submodules/SimpleQmlNotify)
add_subdirectory(submodules/ViewSolutions)
add_subdirectory(submodules/Credits)
2021-05-06 17:15:22 +03:00
2021-05-07 12:47:15 +03:00
if (ANDROID)
2022-02-21 00:06:06 +03:00
if (HANOI_ADMOD)
set(QTAT_APP_PERMISSIONS OFF)
set(QTAT_APK_EXPANSION_FILES OFF)
set(QTAT_APK_INFO OFF)
set(QTAT_SCREEN OFF)
set(QTAT_SYSTEM OFF)
set(QTAT_BATTERY_STATE OFF)
set(QTAT_SIGNAL_STRENGTH OFF)
set(QTAT_IMAGES OFF)
set(QTAT_NOTIFICATION OFF)
set(QTAT_ADMOB_BANNER OFF)
set(QTAT_ADMOB_INTERSTITIAL ON)
set(QTAT_ADMOB_REWARDED_VIDEO OFF)
set(QTAT_PLAY_STORE OFF)
set(QTAT_GOOGLE_ACCOUNT OFF)
set(QTAT_GOOGLE_DRIVE OFF)
set(QTAT_SHARING OFF)
set(QTAT_USER_MESSAGING_PLATFORM OFF)
set(QTAT_AUDIO OFF)
add_subdirectory(submodules/QtAndroidTools/QtAndroidTools)
include_directories(submodules/QtAndroidTools/QtAndroidTools)
endif()
2021-05-07 12:47:15 +03:00
endif()
2021-05-06 17:15:22 +03:00
2021-04-12 17:25:05 +03:00
add_subdirectory(HanoiTowers/client)
2021-05-06 17:15:22 +03:00
2021-04-12 17:25:05 +03:00
endif()
if (HANOI_SERVER)
add_subdirectory(submodules/Patronum)
add_subdirectory(HanoiTowers/Server)
endif()