Simplify CMake
This commit is contained in:
parent
6e9b364f81
commit
5c607d96b8
148
CMakeLists.txt
148
CMakeLists.txt
@ -5,108 +5,14 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24.0)
|
|||||||
cmake_policy(SET CMP0135 NEW)
|
cmake_policy(SET CMP0135 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build Mode
|
# Core Options
|
||||||
set(MCPI_BUILD_MODE "native" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code")
|
include(cmake/core-options.cmake)
|
||||||
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "arm" "native")
|
|
||||||
if(MCPI_BUILD_MODE STREQUAL "arm")
|
|
||||||
set(BUILD_ARM_COMPONENTS TRUE)
|
|
||||||
set(BUILD_NATIVE_COMPONENTS FALSE)
|
|
||||||
elseif(MCPI_BUILD_MODE STREQUAL "native")
|
|
||||||
set(BUILD_ARM_COMPONENTS FALSE)
|
|
||||||
set(BUILD_NATIVE_COMPONENTS TRUE)
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Invalid Mode")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Specify Options
|
|
||||||
option(MCPI_IS_MIXED_BUILD "Whether The Architecture-Independent And ARM Code Are Different Architecture" FALSE)
|
|
||||||
option(MCPI_OPEN_SOURCE_ONLY "Only Install Open-Source Code (Will Result In Broken Install)" FALSE)
|
|
||||||
option(MCPI_IS_APPIMAGE_BUILD "AppImage Build" FALSE)
|
|
||||||
option(MCPI_IS_FLATPAK_BUILD "Flatpak Build" FALSE)
|
|
||||||
|
|
||||||
# Server/Headless Builds
|
|
||||||
option(MCPI_SERVER_MODE "Server Mode" FALSE)
|
|
||||||
option(MCPI_HEADLESS_MODE "Headless Mode" ${MCPI_SERVER_MODE})
|
|
||||||
|
|
||||||
# Media Layer
|
|
||||||
if(MCPI_HEADLESS_MODE)
|
|
||||||
set(DEFAULT_USE_MEDIA_LAYER_PROXY FALSE)
|
|
||||||
else()
|
|
||||||
set(DEFAULT_USE_MEDIA_LAYER_PROXY ${MCPI_IS_MIXED_BUILD})
|
|
||||||
endif()
|
|
||||||
option(MCPI_USE_MEDIA_LAYER_PROXY "Whether To Enable The Media Layer Proxy" ${DEFAULT_USE_MEDIA_LAYER_PROXY})
|
|
||||||
if(NOT MCPI_HEADLESS_MODE)
|
|
||||||
option(MCPI_USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" TRUE)
|
|
||||||
endif()
|
|
||||||
if(MCPI_USE_MEDIA_LAYER_PROXY)
|
|
||||||
set(BUILD_MEDIA_LAYER_CORE "${BUILD_NATIVE_COMPONENTS}")
|
|
||||||
else()
|
|
||||||
set(BUILD_MEDIA_LAYER_CORE "${BUILD_ARM_COMPONENTS}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# App ID
|
|
||||||
set(DEFAULT_APP_ID "com.thebrokenrail.MCPIReborn")
|
|
||||||
if(MCPI_SERVER_MODE)
|
|
||||||
string(APPEND DEFAULT_APP_ID "Server")
|
|
||||||
else()
|
|
||||||
string(APPEND DEFAULT_APP_ID "Client")
|
|
||||||
endif()
|
|
||||||
set(MCPI_APP_ID "${DEFAULT_APP_ID}" CACHE STRING "App ID")
|
|
||||||
|
|
||||||
# App Title
|
|
||||||
set(MCPI_APP_BASE_TITLE "Minecraft: Pi Edition: Reborn" CACHE STRING "Base App Title")
|
|
||||||
set(DEFAULT_APP_TITLE "${MCPI_APP_BASE_TITLE}")
|
|
||||||
if(MCPI_SERVER_MODE)
|
|
||||||
string(APPEND DEFAULT_APP_TITLE " (Server)")
|
|
||||||
else()
|
|
||||||
string(APPEND DEFAULT_APP_TITLE " (Client)")
|
|
||||||
endif()
|
|
||||||
set(MCPI_APP_TITLE "${DEFAULT_APP_TITLE}" CACHE STRING "App Title")
|
|
||||||
|
|
||||||
# Specify Variant Name
|
|
||||||
set(MCPI_VARIANT_NAME "minecraft-pi-reborn")
|
|
||||||
if(MCPI_SERVER_MODE)
|
|
||||||
string(APPEND MCPI_VARIANT_NAME "-server")
|
|
||||||
else()
|
|
||||||
string(APPEND MCPI_VARIANT_NAME "-client")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Skin Server
|
|
||||||
set(MCPI_SKIN_SERVER "https://raw.githubusercontent.com/MCPI-Revival/Skins/data" CACHE STRING "Skin Server")
|
|
||||||
|
|
||||||
# Specify Installation Paths
|
|
||||||
set(MCPI_INSTALL_DIR "lib/${MCPI_VARIANT_NAME}")
|
|
||||||
set(MCPI_BIN_DIR "${MCPI_INSTALL_DIR}/bin")
|
|
||||||
set(MCPI_LEGAL_DIR "${MCPI_INSTALL_DIR}/legal") # For Software Licenses
|
|
||||||
set(MCPI_SDK_DIR "${MCPI_INSTALL_DIR}/sdk")
|
|
||||||
set(MCPI_SDK_LIB_DIR "${MCPI_SDK_DIR}/lib")
|
|
||||||
set(MCPI_SDK_INCLUDE_DIR "${MCPI_SDK_DIR}/include")
|
|
||||||
|
|
||||||
# Library Directory
|
|
||||||
set(MCPI_LIB_DIR "${MCPI_INSTALL_DIR}/lib")
|
|
||||||
if(BUILD_ARM_COMPONENTS)
|
|
||||||
string(APPEND MCPI_LIB_DIR "/arm")
|
|
||||||
elseif(BUILD_NATIVE_COMPONENTS)
|
|
||||||
string(APPEND MCPI_LIB_DIR "/native")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Share Directory
|
|
||||||
set(MCPI_SHARE_DIR "share")
|
|
||||||
if(MCPI_IS_APPIMAGE_BUILD)
|
|
||||||
string(PREPEND MCPI_SHARE_DIR "usr/")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Build Mode
|
# Build Mode
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE "Release")
|
set(CMAKE_BUILD_TYPE "Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Prebuilt ARMHF Toolchain
|
|
||||||
option(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN "Whether To Use A Prebuilt ARMHF Toolchain For Building ARM Components" ${MCPI_IS_MIXED_BUILD})
|
|
||||||
if(BUILD_ARM_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
|
|
||||||
include(cmake/prebuilt-armhf-toolchain.cmake)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Start Project
|
# Start Project
|
||||||
project(minecraft-pi-reborn)
|
project(minecraft-pi-reborn)
|
||||||
|
|
||||||
@ -115,10 +21,8 @@ include(cmake/util.cmake)
|
|||||||
|
|
||||||
# Sanity Checks
|
# Sanity Checks
|
||||||
string(CONCAT ARM_SANITY_CHECK
|
string(CONCAT ARM_SANITY_CHECK
|
||||||
"set(IS_ARM_TARGETING FALSE)\n"
|
"include(CheckSymbolExists)\n"
|
||||||
"if(CMAKE_SYSTEM_PROCESSOR STREQUAL \"arm\" OR CMAKE_SYSTEM_PROCESSOR STREQUAL \"armv7l\")\n"
|
"check_symbol_exists(\"__arm__\" \"\" IS_ARM_TARGETING)\n"
|
||||||
" set(IS_ARM_TARGETING TRUE)\n"
|
|
||||||
"endif()"
|
|
||||||
)
|
)
|
||||||
if(BUILD_ARM_COMPONENTS)
|
if(BUILD_ARM_COMPONENTS)
|
||||||
string(CONCAT ARM_SANITY_CHECK
|
string(CONCAT ARM_SANITY_CHECK
|
||||||
@ -129,20 +33,35 @@ if(BUILD_ARM_COMPONENTS)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
cmake_language(EVAL CODE "${ARM_SANITY_CHECK}")
|
cmake_language(EVAL CODE "${ARM_SANITY_CHECK}")
|
||||||
if(BUILD_NATIVE_COMPONENTS AND NOT IS_ARM_TARGETING AND NOT MCPI_IS_MIXED_BUILD)
|
|
||||||
message(FATAL_ERROR "Project is configured as a mixed-buld, but MCPI_IS_MIXED_BUILD is disabled.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Specify Default Installation Prefix
|
# Extra Options
|
||||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
include(cmake/extra-options.cmake)
|
||||||
set(DEFAULT_PREFIX "/usr")
|
|
||||||
if(MCPI_IS_APPIMAGE_BUILD)
|
# Superbuild
|
||||||
set(DEFAULT_PREFIX "/")
|
if(BUILD_NATIVE_COMPONENTS)
|
||||||
elseif(MCPI_IS_FLATPAK_BUILD)
|
include(ExternalProject)
|
||||||
set(DEFAULT_PREFIX "/app")
|
# Arguments
|
||||||
|
set(ARM_OPTIONS "${MCPI_OPTIONS}")
|
||||||
|
list(APPEND ARM_OPTIONS "-DMCPI_BUILD_MODE:STRING=arm")
|
||||||
|
macro(add_arm_option option)
|
||||||
|
endmacro()
|
||||||
|
if(NOT MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
|
||||||
|
if(DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
|
list(APPEND ARM_OPTIONS "-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}")
|
||||||
endif()
|
endif()
|
||||||
set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "" FORCE)
|
else()
|
||||||
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
|
list(APPEND ARM_OPTIONS "-DMCPI_USE_PREBUILT_ARMHF_TOOLCHAIN:BOOL=TRUE")
|
||||||
|
endif()
|
||||||
|
# Build
|
||||||
|
ExternalProject_Add(arm-components
|
||||||
|
DOWNLOAD_COMMAND ""
|
||||||
|
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
CMAKE_CACHE_ARGS ${ARM_OPTIONS}
|
||||||
|
USES_TERMINAL_CONFIGURE TRUE
|
||||||
|
USES_TERMINAL_BUILD TRUE
|
||||||
|
USES_TERMINAL_INSTALL TRUE
|
||||||
|
BUILD_ALWAYS TRUE
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Required Compile Flags
|
# Required Compile Flags
|
||||||
@ -223,6 +142,11 @@ if(BUILD_NATIVE_COMPONENTS)
|
|||||||
add_subdirectory(images)
|
add_subdirectory(images)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Install Prebuilt ARMHF Toolchain Sysroot
|
||||||
|
if(BUILD_ARM_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
|
||||||
|
install_arm_sysroot()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Install SDK
|
# Install SDK
|
||||||
if(BUILD_ARM_COMPONENTS)
|
if(BUILD_ARM_COMPONENTS)
|
||||||
install(EXPORT sdk DESTINATION "${MCPI_SDK_DIR}" FILE "sdk-targets.cmake" EXPORT_LINK_INTERFACE_LIBRARIES)
|
install(EXPORT sdk DESTINATION "${MCPI_SDK_DIR}" FILE "sdk-targets.cmake" EXPORT_LINK_INTERFACE_LIBRARIES)
|
||||||
|
29
cmake/core-options.cmake
Normal file
29
cmake/core-options.cmake
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Build Mode
|
||||||
|
set(MCPI_BUILD_MODE "native" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code")
|
||||||
|
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "arm" "native")
|
||||||
|
if(MCPI_BUILD_MODE STREQUAL "arm")
|
||||||
|
set(BUILD_ARM_COMPONENTS TRUE)
|
||||||
|
set(BUILD_NATIVE_COMPONENTS FALSE)
|
||||||
|
elseif(MCPI_BUILD_MODE STREQUAL "native")
|
||||||
|
set(BUILD_ARM_COMPONENTS FALSE)
|
||||||
|
set(BUILD_NATIVE_COMPONENTS TRUE)
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Invalid Mode")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Specify Options
|
||||||
|
set(MCPI_OPTIONS "")
|
||||||
|
function(mcpi_option name description type default)
|
||||||
|
set(full_name "MCPI_${name}")
|
||||||
|
set("${full_name}" "${default}" CACHE "${type}" "${description}")
|
||||||
|
list(APPEND MCPI_OPTIONS "-D${full_name}:${type}=${${full_name}}")
|
||||||
|
set(MCPI_OPTIONS "${MCPI_OPTIONS}" PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
# Prebuilt ARMHF Toolchain
|
||||||
|
if(BUILD_ARM_COMPONENTS)
|
||||||
|
mcpi_option(USE_PREBUILT_ARMHF_TOOLCHAIN "Whether To Use A Prebuilt ARMHF Toolchain For Building ARM Components" BOOL FALSE)
|
||||||
|
if(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/prebuilt-armhf-toolchain.cmake")
|
||||||
|
endif()
|
||||||
|
endif()
|
66
cmake/extra-options.cmake
Normal file
66
cmake/extra-options.cmake
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# Specify Options
|
||||||
|
mcpi_option(OPEN_SOURCE_ONLY "Only Install Open-Source Code (Will Result In Broken Install)" BOOL FALSE)
|
||||||
|
mcpi_option(IS_APPIMAGE_BUILD "AppImage Build" BOOL FALSE)
|
||||||
|
mcpi_option(IS_FLATPAK_BUILD "Flatpak Build" BOOL FALSE)
|
||||||
|
|
||||||
|
# Server/Headless Builds
|
||||||
|
mcpi_option(SERVER_MODE "Server Mode" BOOL FALSE)
|
||||||
|
mcpi_option(HEADLESS_MODE "Headless Mode" BOOL "${MCPI_SERVER_MODE}")
|
||||||
|
|
||||||
|
# Prebuilt ARMHF Toolchain
|
||||||
|
if(BUILD_NATIVE_COMPONENTS)
|
||||||
|
set(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN FALSE)
|
||||||
|
if(NOT IS_ARM_TARGETING)
|
||||||
|
set(MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Media Layer
|
||||||
|
if(NOT MCPI_HEADLESS_MODE)
|
||||||
|
set(DEFAULT_USE_MEDIA_LAYER_PROXY FALSE)
|
||||||
|
if(BUILD_NATIVE_COMPONENTS AND NOT IS_ARM_TARGETING)
|
||||||
|
set(DEFAULT_USE_MEDIA_LAYER_PROXY TRUE)
|
||||||
|
endif()
|
||||||
|
mcpi_option(USE_MEDIA_LAYER_PROXY "Whether To Enable The Media Layer Proxy" BOOL "${DEFAULT_USE_MEDIA_LAYER_PROXY}")
|
||||||
|
mcpi_option(USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" BOOL TRUE)
|
||||||
|
else()
|
||||||
|
set(MCPI_USE_MEDIA_LAYER_PROXY FALSE)
|
||||||
|
endif()
|
||||||
|
if(MCPI_USE_MEDIA_LAYER_PROXY)
|
||||||
|
set(BUILD_MEDIA_LAYER_CORE "${BUILD_NATIVE_COMPONENTS}")
|
||||||
|
else()
|
||||||
|
set(BUILD_MEDIA_LAYER_CORE "${BUILD_ARM_COMPONENTS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Specify Variant Name
|
||||||
|
set(MCPI_VARIANT_NAME "minecraft-pi-reborn")
|
||||||
|
if(MCPI_SERVER_MODE)
|
||||||
|
string(APPEND MCPI_VARIANT_NAME "-server")
|
||||||
|
else()
|
||||||
|
string(APPEND MCPI_VARIANT_NAME "-client")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# App ID
|
||||||
|
set(DEFAULT_APP_ID "com.thebrokenrail.MCPIReborn")
|
||||||
|
if(MCPI_SERVER_MODE)
|
||||||
|
string(APPEND DEFAULT_APP_ID "Server")
|
||||||
|
else()
|
||||||
|
string(APPEND DEFAULT_APP_ID "Client")
|
||||||
|
endif()
|
||||||
|
set(MCPI_APP_ID "${DEFAULT_APP_ID}" CACHE STRING "App ID")
|
||||||
|
|
||||||
|
# App Title
|
||||||
|
mcpi_option(APP_BASE_TITLE "Base App Title" STRING "Minecraft: Pi Edition: Reborn")
|
||||||
|
set(DEFAULT_APP_TITLE "${MCPI_APP_BASE_TITLE}")
|
||||||
|
if(MCPI_SERVER_MODE)
|
||||||
|
string(APPEND DEFAULT_APP_TITLE " (Server)")
|
||||||
|
else()
|
||||||
|
string(APPEND DEFAULT_APP_TITLE " (Client)")
|
||||||
|
endif()
|
||||||
|
mcpi_option(APP_TITLE "App Title" STRING "${DEFAULT_APP_TITLE}")
|
||||||
|
|
||||||
|
# Skin Server
|
||||||
|
mcpi_option(SKIN_SERVER "Skin Server" STRING "https://raw.githubusercontent.com/MCPI-Revival/Skins/data")
|
||||||
|
|
||||||
|
# Paths
|
||||||
|
include("${CMAKE_CURRENT_LIST_DIR}/paths.cmake")
|
33
cmake/paths.cmake
Normal file
33
cmake/paths.cmake
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Specify Installation Paths
|
||||||
|
set(MCPI_INSTALL_DIR "lib/${MCPI_VARIANT_NAME}")
|
||||||
|
set(MCPI_BIN_DIR "${MCPI_INSTALL_DIR}/bin")
|
||||||
|
set(MCPI_LEGAL_DIR "${MCPI_INSTALL_DIR}/legal") # For Software Licenses
|
||||||
|
set(MCPI_SDK_DIR "${MCPI_INSTALL_DIR}/sdk")
|
||||||
|
set(MCPI_SDK_LIB_DIR "${MCPI_SDK_DIR}/lib")
|
||||||
|
set(MCPI_SDK_INCLUDE_DIR "${MCPI_SDK_DIR}/include")
|
||||||
|
|
||||||
|
# Library Directory
|
||||||
|
set(MCPI_LIB_DIR "${MCPI_INSTALL_DIR}/lib")
|
||||||
|
if(BUILD_ARM_COMPONENTS)
|
||||||
|
string(APPEND MCPI_LIB_DIR "/arm")
|
||||||
|
elseif(BUILD_NATIVE_COMPONENTS)
|
||||||
|
string(APPEND MCPI_LIB_DIR "/native")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Share Directory
|
||||||
|
set(MCPI_SHARE_DIR "share")
|
||||||
|
if(MCPI_IS_APPIMAGE_BUILD)
|
||||||
|
string(PREPEND MCPI_SHARE_DIR "usr/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Specify Default Installation Prefix
|
||||||
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
set(DEFAULT_PREFIX "/usr")
|
||||||
|
if(MCPI_IS_APPIMAGE_BUILD)
|
||||||
|
set(DEFAULT_PREFIX "/")
|
||||||
|
elseif(MCPI_IS_FLATPAK_BUILD)
|
||||||
|
set(DEFAULT_PREFIX "/app")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "" FORCE)
|
||||||
|
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
|
||||||
|
endif()
|
@ -13,7 +13,7 @@ endif()
|
|||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
prebuilt-armhf-toolchain
|
prebuilt-armhf-toolchain
|
||||||
URL "file://${CMAKE_CURRENT_LIST_DIR}/../archives/${toolchain_file}"
|
URL "${CMAKE_CURRENT_LIST_DIR}/../archives/${toolchain_file}"
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(prebuilt-armhf-toolchain)
|
FetchContent_MakeAvailable(prebuilt-armhf-toolchain)
|
||||||
set(toolchain_dir "${prebuilt-armhf-toolchain_SOURCE_DIR}")
|
set(toolchain_dir "${prebuilt-armhf-toolchain_SOURCE_DIR}")
|
||||||
@ -26,7 +26,7 @@ file(WRITE "${toolchain_dir}/toolchain.cmake"
|
|||||||
"set(CMAKE_SYSTEM_PROCESSOR \"arm\")\n"
|
"set(CMAKE_SYSTEM_PROCESSOR \"arm\")\n"
|
||||||
"set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n"
|
"set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)\n"
|
||||||
)
|
)
|
||||||
set(CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" CACHE STRING "" FORCE)
|
set(CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" CACHE FILEPATH "" FORCE)
|
||||||
|
|
||||||
# Build Sysroot
|
# Build Sysroot
|
||||||
set(sysroot_dir "${CMAKE_CURRENT_BINARY_DIR}/bundled-armhf-sysroot")
|
set(sysroot_dir "${CMAKE_CURRENT_BINARY_DIR}/bundled-armhf-sysroot")
|
||||||
@ -61,8 +61,10 @@ if("${toolchain_dir}/bin/arm-none-linux-gnueabihf-gcc" IS_NEWER_THAN "${sysroot_
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Install Sysroot (Skipping Empty Directories)
|
# Install Sysroot (Skipping Empty Directories)
|
||||||
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE RELATIVE "${sysroot_dir}" "${sysroot_dir}/*")
|
function(install_arm_sysroot)
|
||||||
foreach(file IN LISTS files)
|
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE RELATIVE "${sysroot_dir}" "${sysroot_dir}/*")
|
||||||
|
foreach(file IN LISTS files)
|
||||||
get_filename_component(parent "${file}" DIRECTORY)
|
get_filename_component(parent "${file}" DIRECTORY)
|
||||||
install(PROGRAMS "${sysroot_dir}/${file}" DESTINATION "${MCPI_INSTALL_DIR}/sysroot/${parent}")
|
install(PROGRAMS "${sysroot_dir}/${file}" DESTINATION "${MCPI_INSTALL_DIR}/sysroot/${parent}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
6
dependencies/qemu/CMakeLists.txt
vendored
6
dependencies/qemu/CMakeLists.txt
vendored
@ -12,11 +12,9 @@ if(MCPI_IS_FLATPAK_BUILD)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
include(ProcessorCount)
|
|
||||||
ProcessorCount(NPROC)
|
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
ExternalProject_Add(qemu
|
ExternalProject_Add(qemu
|
||||||
URL "file://${CMAKE_CURRENT_SOURCE_DIR}/../../archives/qemu-${QEMU_VERSION}.tar.xz"
|
URL "${CMAKE_CURRENT_SOURCE_DIR}/../../archives/qemu-${QEMU_VERSION}.tar.xz"
|
||||||
CONFIGURE_COMMAND
|
CONFIGURE_COMMAND
|
||||||
"${CMAKE_COMMAND}" "-E" "env"
|
"${CMAKE_COMMAND}" "-E" "env"
|
||||||
"PKG_CONFIG_LIBDIR=$ENV{PKG_CONFIG_LIBDIR}"
|
"PKG_CONFIG_LIBDIR=$ENV{PKG_CONFIG_LIBDIR}"
|
||||||
@ -31,7 +29,7 @@ ExternalProject_Add(qemu
|
|||||||
"--target-list=arm-linux-user"
|
"--target-list=arm-linux-user"
|
||||||
"--without-default-features"
|
"--without-default-features"
|
||||||
USES_TERMINAL_CONFIGURE TRUE
|
USES_TERMINAL_CONFIGURE TRUE
|
||||||
BUILD_COMMAND "make" "-j${NPROC}" "qemu-arm"
|
BUILD_COMMAND "make" "qemu-arm"
|
||||||
USES_TERMINAL_BUILD TRUE
|
USES_TERMINAL_BUILD TRUE
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
TEST_COMMAND ""
|
TEST_COMMAND ""
|
||||||
|
2
dependencies/symbol-processor/src
vendored
2
dependencies/symbol-processor/src
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 63ad20456c858068fb2762359695021a76fad851
|
Subproject commit 930eae47c6353a4dceba3e483f022aa76369ddaf
|
@ -1,7 +1,10 @@
|
|||||||
project(media-layer-proxy)
|
project(media-layer-proxy)
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
set(MEDIA_LAYER_PROXY_SRC src/common/common.c src/media-layer-core.c src/GLESv1_CM.c) # Media Layer Proxy Source
|
set(MEDIA_LAYER_PROXY_SRC src/common/common.c src/media-layer-core.c) # Media Layer Proxy Source
|
||||||
|
if(NOT MCPI_HEADLESS_MODE)
|
||||||
|
list(APPEND MEDIA_LAYER_PROXY_SRC src/GLESv1_CM.c)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
if(BUILD_NATIVE_COMPONENTS)
|
if(BUILD_NATIVE_COMPONENTS)
|
||||||
|
@ -83,7 +83,9 @@ static void Gui_renderChatMessages_injection(Gui *gui, int32_t y_offset, uint32_
|
|||||||
// Render Selected Item Text
|
// Render Selected Item Text
|
||||||
if (render_selected_item_text) {
|
if (render_selected_item_text) {
|
||||||
// Fix GL Mode
|
// Fix GL Mode
|
||||||
|
#ifndef MCPI_HEADLESS_MODE
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
#endif
|
||||||
// Calculate Selected Item Text Scale
|
// Calculate Selected Item Text Scale
|
||||||
Minecraft *minecraft = gui->minecraft;
|
Minecraft *minecraft = gui->minecraft;
|
||||||
int32_t screen_width = minecraft->screen_width;
|
int32_t screen_width = minecraft->screen_width;
|
||||||
@ -122,25 +124,37 @@ static void Inventory_selectSlot_injection(Inventory *inventory, int32_t slot) {
|
|||||||
// Translucent Toolbar
|
// Translucent Toolbar
|
||||||
static void Gui_renderToolBar_injection(Gui *gui, float param_1, int32_t param_2, int32_t param_3) {
|
static void Gui_renderToolBar_injection(Gui *gui, float param_1, int32_t param_2, int32_t param_3) {
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
|
#ifndef MCPI_HEADLESS_MODE
|
||||||
int was_blend_enabled = glIsEnabled(GL_BLEND);
|
int was_blend_enabled = glIsEnabled(GL_BLEND);
|
||||||
if (!was_blend_enabled) {
|
if (!was_blend_enabled) {
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
}
|
}
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
#endif
|
||||||
Gui_renderToolBar(gui, param_1, param_2, param_3);
|
Gui_renderToolBar(gui, param_1, param_2, param_3);
|
||||||
|
#ifndef MCPI_HEADLESS_MODE
|
||||||
if (!was_blend_enabled) {
|
if (!was_blend_enabled) {
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
static void Gui_renderToolBar_glColor4f_injection(GLfloat red, GLfloat green, GLfloat blue, __attribute__((unused)) GLfloat alpha) {
|
static void Gui_renderToolBar_glColor4f_injection(GLfloat red, GLfloat green, GLfloat blue, __attribute__((unused)) GLfloat alpha) {
|
||||||
// Fix Alpha
|
// Fix Alpha
|
||||||
|
#ifndef MCPI_HEADLESS_MODE
|
||||||
glColor4f(red, green, blue, 1.0f);
|
glColor4f(red, green, blue, 1.0f);
|
||||||
|
#else
|
||||||
|
(void) red;
|
||||||
|
(void) green;
|
||||||
|
(void) blue;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix Screen Rendering When GUI is Hidden
|
// Fix Screen Rendering When GUI is Hidden
|
||||||
static void Screen_render_injection(Screen *screen, int32_t param_1, int32_t param_2, float param_3) {
|
static void Screen_render_injection(Screen *screen, int32_t param_1, int32_t param_2, float param_3) {
|
||||||
// Fix
|
// Fix
|
||||||
|
#ifndef MCPI_HEADLESS_MODE
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
#endif
|
||||||
// Call Original Method
|
// Call Original Method
|
||||||
Screen_render_non_virtual(screen, param_1, param_2, param_3);
|
Screen_render_non_virtual(screen, param_1, param_2, param_3);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
|||||||
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
# Run CMake If Needed
|
# Run CMake If Needed
|
||||||
if [ ! -f "build/${MODE}-${ARCH}/arm/build.ninja" ] || [ ! -f "build/${MODE}-${ARCH}/native/build.ninja" ]; then
|
if [ ! -f "build/${MODE}-${ARCH}/build.ninja" ]; then
|
||||||
./scripts/setup.sh "${MODE}" "${ARCH}"
|
./scripts/setup.sh "${MODE}" "${ARCH}"
|
||||||
fi
|
fi
|
||||||
# Use Build Dir
|
# Use Build Dir
|
||||||
@ -20,17 +20,9 @@ if [ -z "${DESTDIR+x}" ]; then
|
|||||||
mkdir -p "${DESTDIR}"
|
mkdir -p "${DESTDIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build ARM Components
|
# Build
|
||||||
cd arm
|
|
||||||
cmake --build .
|
cmake --build .
|
||||||
cmake --install .
|
cmake --install .
|
||||||
cd ../
|
|
||||||
|
|
||||||
# Build Native Components
|
|
||||||
cd native
|
|
||||||
cmake --build .
|
|
||||||
cmake --install .
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
# Exit
|
# Exit
|
||||||
cd ../../
|
cd ../../
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# ARM Toolchain File
|
|
||||||
ARM_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain/armhf-toolchain.cmake"
|
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
||||||
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
||||||
@ -33,25 +30,9 @@ server_mode='OFF'
|
|||||||
if [ "${MODE}" = "server" ]; then
|
if [ "${MODE}" = "server" ]; then
|
||||||
server_mode='ON'
|
server_mode='ON'
|
||||||
fi
|
fi
|
||||||
# Mixed Build
|
|
||||||
mixed_build='ON'
|
|
||||||
if [ "${ARCH}" = "armhf" ]; then
|
|
||||||
mixed_build='OFF'
|
|
||||||
fi
|
|
||||||
# Extra Flags
|
|
||||||
extra_flags="-DMCPI_IS_MIXED_BUILD=${mixed_build} -DMCPI_SERVER_MODE=${server_mode}"
|
|
||||||
|
|
||||||
# Build ARM Components
|
# Build Components
|
||||||
mkdir arm
|
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DMCPI_SERVER_MODE="${server_mode}" "$@" ../../
|
||||||
cd arm
|
|
||||||
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="${ARM_TOOLCHAIN_FILE}" -DMCPI_BUILD_MODE=arm ${extra_flags} "$@" ../../..
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
# Build Native Components
|
|
||||||
mkdir native
|
|
||||||
cd native
|
|
||||||
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DMCPI_BUILD_MODE=native ${extra_flags} "$@" ../../..
|
|
||||||
cd ../
|
|
||||||
|
|
||||||
# Exit
|
# Exit
|
||||||
cd ../../
|
cd ../../
|
||||||
|
@ -17,7 +17,7 @@ set(SRC
|
|||||||
src/network/raknet/RakNet_RakString_SharedString.def
|
src/network/raknet/RakNet_RakString_SharedString.def
|
||||||
src/network/raknet/RakNet_RakString.def
|
src/network/raknet/RakNet_RakString.def
|
||||||
src/network/raknet/RakNet_SystemAddress.def
|
src/network/raknet/RakNet_SystemAddress.def
|
||||||
src/network/raknet/extra.h
|
src/network/raknet/RakNet_StartupResult.h
|
||||||
src/network/raknet/RakNet_RakNetGUID.def
|
src/network/raknet/RakNet_RakNetGUID.def
|
||||||
src/network/raknet/RakNet_RakPeer.def
|
src/network/raknet/RakNet_RakPeer.def
|
||||||
src/network/ServerSideNetworkHandler.def
|
src/network/ServerSideNetworkHandler.def
|
||||||
@ -111,7 +111,7 @@ set(SRC
|
|||||||
src/tile/GrassTile.def
|
src/tile/GrassTile.def
|
||||||
src/tile/HeavyTile.def
|
src/tile/HeavyTile.def
|
||||||
src/misc/Strings.def
|
src/misc/Strings.def
|
||||||
src/misc/ModelPart.def
|
src/entity/ModelPart.def
|
||||||
src/misc/Tesselator.def
|
src/misc/Tesselator.def
|
||||||
src/misc/AABB.def
|
src/misc/AABB.def
|
||||||
src/misc/Vec3.def
|
src/misc/Vec3.def
|
||||||
|
Loading…
Reference in New Issue
Block a user