-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
118 lines (104 loc) · 6.25 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
cmake_minimum_required(VERSION 3.1)
project(mcpelauncher-ui-qt LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# protobuf now requires c++14
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
find_package(Qt5 COMPONENTS Core Quick Concurrent Svg REQUIRED)
find_package(OpenSSL 1.1.1)
option(ENABLE_UPDATE_CHECK "Enables update checking with a remote server")
set(UPDATE_CHECK_URL "" CACHE STRING "Specify the URL for the server to check for updates on")
set(UPDATE_CHECK_BUILD_ID "" CACHE STRING "Specify the numeral version number for the current build")
set(LAUNCHER_VERSIONDB_URL "" CACHE STRING "Specify the remote url of the versiondb to use")
set(LAUNCHER_VERSIONDB_PATH "" CACHE STRING "Specify a local versiondb checkout to embed into this binary")
set(LAUNCHER_CHANGE_LOG "" CACHE STRING "Specify the changelog to show after update")
set(LAUNCHER_VERSION_NAME "" CACHE STRING "Specify the version name shown in settings")
set(LAUNCHER_VERSION_CODE "" CACHE STRING "Specify the version code (integer) shown in settings")
option(LAUNCHER_DISABLE_DEV_MODE "Disables the dev tab by default" ON)
option(LAUNCHER_ENABLE_GOOGLE_PLAY_LICENCE_CHECK "Enables checking license of the Game" ON)
option(LAUNCHER_MACOS_HAVE_ARMLAUNCHER "Enables use of the arm launcher" ON)
option(LAUNCHER_ENABLE_GLFW "Enables glfw integration" ON)
find_package(Qt5LinguistTools)
set(LAUNCHER_LINGUIST_RESOURCES "")
if (Qt5LinguistTools_FOUND)
qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} mcpelauncher_en.ts mcpelauncher_de.ts mcpelauncher_fr.ts)
configure_file(translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
set(LAUNCHER_LINGUIST_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc ${QM_FILES})
endif()
find_package(Qt5QuickCompiler)
if (Qt5QuickCompiler_FOUND)
qtquick_compiler_add_resources(RESOURCES qml.qrc)
set(RESOURCES ${RESOURCES} ${LAUNCHER_LINGUIST_RESOURCES})
else ()
set(RESOURCES qml.qrc ${RESOURCES} ${LAUNCHER_LINGUIST_RESOURCES})
endif ()
if (NOT "${LAUNCHER_VERSIONDB_PATH}" STREQUAL "")
configure_file(archivalversionlist.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file("${LAUNCHER_VERSIONDB_PATH}/versions.armeabi-v7a.json.min" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file("${LAUNCHER_VERSIONDB_PATH}/versions.x86.json.min" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file("${LAUNCHER_VERSIONDB_PATH}/versions.arm64-v8a.json.min" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
configure_file("${LAUNCHER_VERSIONDB_PATH}/versions.x86_64.json.min" ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
set(RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/archivalversionlist.qrc ${RESOURCES})
endif()
add_executable(${PROJECT_NAME} main.cpp launcherapp.cpp launcherapp.h googleloginhelper.cpp googleloginhelper.h googleaccount.h versionmanager.cpp versionmanager.h apkextractiontask.cpp apkextractiontask.h googleplayapi.cpp googleplayapi.h googleversionchannel.cpp googleversionchannel.h googleapkdownloadtask.cpp googleapkdownloadtask.h gamelauncher.cpp gamelauncher.h profilemanager.cpp profilemanager.h qmlurlutils.h archivalversionlist.cpp archivalversionlist.h launchersettings.h troubleshooter.cpp troubleshooter.h updatechecker.cpp updatechecker.h supportedandroidabis.cpp supportedandroidabis.h cpuid.cpp cpuid.h gamepad.h encryption.h encrypted_file_login_cache.cpp encrypted_file_login_cache.h ${RESOURCES})
if (ENABLE_UPDATE_CHECK)
target_compile_definitions(${PROJECT_NAME} PUBLIC UPDATE_CHECK UPDATE_CHECK_BUILD_ID=${UPDATE_CHECK_BUILD_ID} UPDATE_CHECK_URL="${UPDATE_CHECK_URL}")
endif()
if (NOT "${LAUNCHER_VERSIONDB_URL}" STREQUAL "")
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_VERSIONDB_URL="${LAUNCHER_VERSIONDB_URL}")
endif()
if (NOT "${LAUNCHER_CHANGE_LOG}" STREQUAL "")
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_CHANGE_LOG="${LAUNCHER_CHANGE_LOG}")
endif()
if (NOT "${LAUNCHER_VERSION_CODE}" STREQUAL "")
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_VERSION_CODE="${LAUNCHER_VERSION_CODE}")
endif()
if (NOT "${LAUNCHER_VERSION_NAME}" STREQUAL "")
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_VERSION_NAME="${LAUNCHER_VERSION_NAME}")
endif()
if(LAUNCHER_DISABLE_DEV_MODE)
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_DISABLE_DEV_MODE)
endif()
if(LAUNCHER_ENABLE_GOOGLE_PLAY_LICENCE_CHECK)
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_ENABLE_GOOGLE_PLAY_LICENCE_CHECK)
endif()
if(LAUNCHER_MACOS_HAVE_ARMLAUNCHER)
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_MACOS_HAVE_ARMLAUNCHER)
endif()
if(LAUNCHER_ENABLE_GLFW)
include(ext/glfw.cmake)
target_compile_definitions(${PROJECT_NAME} PUBLIC LAUNCHER_ENABLE_GLFW)
target_link_libraries(${PROJECT_NAME} glfw)
endif()
if (APPLE)
target_sources(${PROJECT_NAME} PUBLIC launcherapp_osx.mm supportedandroidabis.mm)
target_link_libraries(${PROJECT_NAME} "-framework AppKit")
if(ENABLE_SPARKLE_UPDATE_CHECK)
target_sources(${PROJECT_NAME} PUBLIC sparkle_updatechecker.mm)
target_compile_definitions(${PROJECT_NAME} PUBLIC SPARKLE_UPDATE_CHECK=1 SPARKLE_UPDATE_CHECK_URL="${SPARKLE_UPDATE_CHECK_URL}")
target_link_libraries(${PROJECT_NAME} "-framework Sparkle")
endif()
endif()
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick Qt5::Svg Qt5::Concurrent playdl-signin-ui-qt-lib mcpelauncher-extract-lib mcpelauncher-common mcpelauncher-apkinfo file-util gplayapi)
if(OpenSSL_FOUND)
target_link_libraries(${PROJECT_NAME} OpenSSL::Crypto)
target_sources(${PROJECT_NAME} PUBLIC encryption.cpp)
else()
target_sources(${PROJECT_NAME} PUBLIC encryption_stub.cpp)
endif()
if (ENABLE_APPIMAGE_UPDATE_CHECK)
target_compile_definitions(${PROJECT_NAME} PUBLIC APPIMAGE_UPDATE_CHECK=1)
target_link_libraries(${PROJECT_NAME} z libappimageupdate)
endif()
install(TARGETS mcpelauncher-ui-qt RUNTIME COMPONENT mcpelauncher-ui-qt DESTINATION bin)
if (NOT APPLE)
install(FILES mcpelauncher-ui-qt.desktop COMPONENT mcpelauncher-ui-qt DESTINATION share/applications)
install(FILES Resources/mcpelauncher-icon.svg RENAME mcpelauncher-ui-qt.svg
COMPONENT mcpelauncher-ui-qt DESTINATION share/pixmaps)
endif()
include(CPackSettings.cmake)