|
@@ -41,10 +41,15 @@ if(NOT CMAKE_BUILD_TYPE)
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo)
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release RelWithDebInfo)
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
|
|
+set(qtParts ON)
|
|
|
|
|
+if(ANDROID)
|
|
|
|
|
+ set(qtParts OFF)
|
|
|
|
|
+endif()
|
|
|
|
|
+
|
|
|
option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
|
|
option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF)
|
|
|
option(ENABLE_LUA "Enable compilation of LUA scripting module" OFF)
|
|
option(ENABLE_LUA "Enable compilation of LUA scripting module" OFF)
|
|
|
-option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
|
|
|
|
|
-option(ENABLE_EDITOR "Enable compilation of map editor" ON)
|
|
|
|
|
|
|
+option(ENABLE_LAUNCHER "Enable compilation of launcher" ${qtParts})
|
|
|
|
|
+option(ENABLE_EDITOR "Enable compilation of map editor" ${qtParts})
|
|
|
option(ENABLE_TRANSLATIONS "Enable generation of translations for launcher and editor" ON)
|
|
option(ENABLE_TRANSLATIONS "Enable generation of translations for launcher and editor" ON)
|
|
|
option(ENABLE_NULLKILLER_AI "Enable compilation of Nullkiller AI library" ON)
|
|
option(ENABLE_NULLKILLER_AI "Enable compilation of Nullkiller AI library" ON)
|
|
|
|
|
|
|
@@ -64,7 +69,7 @@ option(ENABLE_SINGLE_APP_BUILD "Builds client and server as single executable" O
|
|
|
option(COPY_CONFIG_ON_BUILD "Copies config folder into output directory at building phase" ON)
|
|
option(COPY_CONFIG_ON_BUILD "Copies config folder into output directory at building phase" ON)
|
|
|
|
|
|
|
|
# Used for Snap packages and also useful for debugging
|
|
# Used for Snap packages and also useful for debugging
|
|
|
-if(NOT APPLE_IOS)
|
|
|
|
|
|
|
+if(NOT APPLE_IOS AND NOT ANDROID)
|
|
|
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
|
|
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
@@ -81,8 +86,8 @@ if(ENABLE_ERM AND NOT ENABLE_LUA)
|
|
|
set(ENABLE_LUA ON)
|
|
set(ENABLE_LUA ON)
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
-# We don't want to deploy assets into build directory for iOS build
|
|
|
|
|
-if(APPLE_IOS AND COPY_CONFIG_ON_BUILD)
|
|
|
|
|
|
|
+# We don't want to deploy assets into build directory for android/iOS build
|
|
|
|
|
+if((APPLE_IOS OR ANDROID) AND COPY_CONFIG_ON_BUILD)
|
|
|
set(COPY_CONFIG_ON_BUILD OFF)
|
|
set(COPY_CONFIG_ON_BUILD OFF)
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
@@ -95,6 +100,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules ${PROJECT_SOURCE_DIR
|
|
|
|
|
|
|
|
include(VCMIUtils)
|
|
include(VCMIUtils)
|
|
|
include(VersionDefinition)
|
|
include(VersionDefinition)
|
|
|
|
|
+if(ANDROID)
|
|
|
|
|
+ set(VCMI_VERSION "${APP_SHORT_VERSION}")
|
|
|
|
|
+ configure_file("android/GeneratedVersion.java.in" "${CMAKE_SOURCE_DIR}/android/vcmi-app/src/main/java/eu/vcmi/vcmi/util/GeneratedVersion.java" @ONLY)
|
|
|
|
|
+endif()
|
|
|
|
|
|
|
|
vcmi_print_important_variables()
|
|
vcmi_print_important_variables()
|
|
|
|
|
|
|
@@ -280,6 +289,15 @@ if(MINGW OR MSVC)
|
|
|
endif(MINGW)
|
|
endif(MINGW)
|
|
|
endif(MINGW OR MSVC)
|
|
endif(MINGW OR MSVC)
|
|
|
|
|
|
|
|
|
|
+if(ANDROID)
|
|
|
|
|
+ if(ANDROID_NDK_MAJOR LESS 23 AND ANDROID_ABI MATCHES "^armeabi")
|
|
|
|
|
+ # libunwind must come before other shared libs:
|
|
|
|
|
+ # https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#Unwinding
|
|
|
|
|
+ list(APPEND SYSTEM_LIBS unwind)
|
|
|
|
|
+ endif()
|
|
|
|
|
+ list(APPEND SYSTEM_LIBS log)
|
|
|
|
|
+endif()
|
|
|
|
|
+
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32)
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32)
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith")
|
|
@@ -447,6 +465,10 @@ elseif(APPLE)
|
|
|
set(DATA_DIR ".")
|
|
set(DATA_DIR ".")
|
|
|
endif()
|
|
endif()
|
|
|
endif()
|
|
endif()
|
|
|
|
|
+elseif(ANDROID)
|
|
|
|
|
+ include(GNUInstallDirs)
|
|
|
|
|
+ set(LIB_DIR "jniLibs/${ANDROID_ABI}")
|
|
|
|
|
+ set(DATA_DIR "assets")
|
|
|
else()
|
|
else()
|
|
|
# includes lib path which determines where to install shared libraries (either /lib or /lib64)
|
|
# includes lib path which determines where to install shared libraries (either /lib or /lib64)
|
|
|
include(GNUInstallDirs)
|
|
include(GNUInstallDirs)
|
|
@@ -482,8 +504,8 @@ else()
|
|
|
endif()
|
|
endif()
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
-# iOS has flat libs directory structure
|
|
|
|
|
-if(APPLE_IOS)
|
|
|
|
|
|
|
+# iOS/Android have flat libs directory structure
|
|
|
|
|
+if(APPLE_IOS OR ANDROID)
|
|
|
set(AI_LIB_DIR "${LIB_DIR}")
|
|
set(AI_LIB_DIR "${LIB_DIR}")
|
|
|
set(SCRIPTING_LIB_DIR "${LIB_DIR}")
|
|
set(SCRIPTING_LIB_DIR "${LIB_DIR}")
|
|
|
else()
|
|
else()
|
|
@@ -535,14 +557,48 @@ endif()
|
|
|
# Installation section #
|
|
# Installation section #
|
|
|
#######################################
|
|
#######################################
|
|
|
|
|
|
|
|
-install(DIRECTORY config DESTINATION ${DATA_DIR})
|
|
|
|
|
-install(DIRECTORY Mods DESTINATION ${DATA_DIR})
|
|
|
|
|
|
|
+if(ANDROID)
|
|
|
|
|
+ if(ANDROID_STL MATCHES "_shared$")
|
|
|
|
|
+ set(stlLibName "${CMAKE_SHARED_LIBRARY_PREFIX}${ANDROID_STL}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
|
|
|
|
+ install(FILES "${CMAKE_SYSROOT}/usr/lib/${ANDROID_SYSROOT_LIB_SUBDIR}/${stlLibName}"
|
|
|
|
|
+ DESTINATION ${LIB_DIR}
|
|
|
|
|
+ )
|
|
|
|
|
+ endif()
|
|
|
|
|
+
|
|
|
|
|
+ install(FILES AUTHORS
|
|
|
|
|
+ DESTINATION res/raw
|
|
|
|
|
+ RENAME authors.txt
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # zip internal assets - 'config' and 'Mods' dirs, save md5 of the zip
|
|
|
|
|
+ install(CODE "
|
|
|
|
|
+ cmake_path(ABSOLUTE_PATH CMAKE_INSTALL_PREFIX
|
|
|
|
|
+ OUTPUT_VARIABLE absolute_install_prefix
|
|
|
|
|
+ )
|
|
|
|
|
+ set(absolute_data_dir \"\${absolute_install_prefix}/${DATA_DIR}\")
|
|
|
|
|
+ file(MAKE_DIRECTORY \"\${absolute_data_dir}\")
|
|
|
|
|
+
|
|
|
|
|
+ set(internal_data_zip \"\${absolute_data_dir}/internalData.zip\")
|
|
|
|
|
+ execute_process(COMMAND
|
|
|
|
|
+ \"${CMAKE_COMMAND}\" -E tar c \"\${internal_data_zip}\" --format=zip -- config Mods
|
|
|
|
|
+ WORKING_DIRECTORY \"${CMAKE_SOURCE_DIR}\"
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ file(MD5 \"\${internal_data_zip}\" internal_data_zip_md5)
|
|
|
|
|
+ file(WRITE \"\${absolute_data_dir}/internalDataHash.txt\"
|
|
|
|
|
+ \${internal_data_zip_md5}
|
|
|
|
|
+ )
|
|
|
|
|
+ ")
|
|
|
|
|
+else()
|
|
|
|
|
+ install(DIRECTORY config DESTINATION ${DATA_DIR})
|
|
|
|
|
+ install(DIRECTORY Mods DESTINATION ${DATA_DIR})
|
|
|
|
|
+endif()
|
|
|
if(ENABLE_LUA)
|
|
if(ENABLE_LUA)
|
|
|
install(DIRECTORY scripts DESTINATION ${DATA_DIR})
|
|
install(DIRECTORY scripts DESTINATION ${DATA_DIR})
|
|
|
endif()
|
|
endif()
|
|
|
|
|
|
|
|
-# that script is useless for Windows and iOS
|
|
|
|
|
-if(NOT WIN32 AND NOT APPLE_IOS)
|
|
|
|
|
|
|
+# that script is useless for Windows / iOS / Android
|
|
|
|
|
+if(NOT WIN32 AND NOT APPLE_IOS AND NOT ANDROID)
|
|
|
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
|
|
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
|
|
|
OWNER_WRITE OWNER_READ OWNER_EXECUTE
|
|
OWNER_WRITE OWNER_READ OWNER_EXECUTE
|
|
|
GROUP_READ GROUP_EXECUTE
|
|
GROUP_READ GROUP_EXECUTE
|