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)
|
||||
endif()
|
||||
|
||||
# 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
|
||||
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()
|
||||
# Core Options
|
||||
include(cmake/core-options.cmake)
|
||||
|
||||
# Build Mode
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
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
|
||||
project(minecraft-pi-reborn)
|
||||
|
||||
@ -115,10 +21,8 @@ include(cmake/util.cmake)
|
||||
|
||||
# Sanity Checks
|
||||
string(CONCAT ARM_SANITY_CHECK
|
||||
"set(IS_ARM_TARGETING FALSE)\n"
|
||||
"if(CMAKE_SYSTEM_PROCESSOR STREQUAL \"arm\" OR CMAKE_SYSTEM_PROCESSOR STREQUAL \"armv7l\")\n"
|
||||
" set(IS_ARM_TARGETING TRUE)\n"
|
||||
"endif()"
|
||||
"include(CheckSymbolExists)\n"
|
||||
"check_symbol_exists(\"__arm__\" \"\" IS_ARM_TARGETING)\n"
|
||||
)
|
||||
if(BUILD_ARM_COMPONENTS)
|
||||
string(CONCAT ARM_SANITY_CHECK
|
||||
@ -129,20 +33,35 @@ if(BUILD_ARM_COMPONENTS)
|
||||
)
|
||||
endif()
|
||||
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
|
||||
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")
|
||||
# Extra Options
|
||||
include(cmake/extra-options.cmake)
|
||||
|
||||
# Superbuild
|
||||
if(BUILD_NATIVE_COMPONENTS)
|
||||
include(ExternalProject)
|
||||
# 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()
|
||||
else()
|
||||
list(APPEND ARM_OPTIONS "-DMCPI_USE_PREBUILT_ARMHF_TOOLCHAIN:BOOL=TRUE")
|
||||
endif()
|
||||
set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "" FORCE)
|
||||
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
|
||||
# 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()
|
||||
|
||||
# Required Compile Flags
|
||||
@ -223,6 +142,11 @@ if(BUILD_NATIVE_COMPONENTS)
|
||||
add_subdirectory(images)
|
||||
endif()
|
||||
|
||||
# Install Prebuilt ARMHF Toolchain Sysroot
|
||||
if(BUILD_ARM_COMPONENTS AND MCPI_USE_PREBUILT_ARMHF_TOOLCHAIN)
|
||||
install_arm_sysroot()
|
||||
endif()
|
||||
|
||||
# Install SDK
|
||||
if(BUILD_ARM_COMPONENTS)
|
||||
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)
|
||||
FetchContent_Declare(
|
||||
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)
|
||||
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_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
|
||||
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()
|
||||
|
||||
# Install Sysroot (Skipping Empty Directories)
|
||||
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE RELATIVE "${sysroot_dir}" "${sysroot_dir}/*")
|
||||
foreach(file IN LISTS files)
|
||||
get_filename_component(parent "${file}" DIRECTORY)
|
||||
install(PROGRAMS "${sysroot_dir}/${file}" DESTINATION "${MCPI_INSTALL_DIR}/sysroot/${parent}")
|
||||
endforeach()
|
||||
function(install_arm_sysroot)
|
||||
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE RELATIVE "${sysroot_dir}" "${sysroot_dir}/*")
|
||||
foreach(file IN LISTS files)
|
||||
get_filename_component(parent "${file}" DIRECTORY)
|
||||
install(PROGRAMS "${sysroot_dir}/${file}" DESTINATION "${MCPI_INSTALL_DIR}/sysroot/${parent}")
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
6
dependencies/qemu/CMakeLists.txt
vendored
6
dependencies/qemu/CMakeLists.txt
vendored
@ -12,11 +12,9 @@ if(MCPI_IS_FLATPAK_BUILD)
|
||||
endif()
|
||||
|
||||
# Build
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(NPROC)
|
||||
include(ExternalProject)
|
||||
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
|
||||
"${CMAKE_COMMAND}" "-E" "env"
|
||||
"PKG_CONFIG_LIBDIR=$ENV{PKG_CONFIG_LIBDIR}"
|
||||
@ -31,7 +29,7 @@ ExternalProject_Add(qemu
|
||||
"--target-list=arm-linux-user"
|
||||
"--without-default-features"
|
||||
USES_TERMINAL_CONFIGURE TRUE
|
||||
BUILD_COMMAND "make" "-j${NPROC}" "qemu-arm"
|
||||
BUILD_COMMAND "make" "qemu-arm"
|
||||
USES_TERMINAL_BUILD TRUE
|
||||
INSTALL_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)
|
||||
|
||||
# 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
|
||||
if(BUILD_NATIVE_COMPONENTS)
|
||||
|
@ -83,7 +83,9 @@ static void Gui_renderChatMessages_injection(Gui *gui, int32_t y_offset, uint32_
|
||||
// Render Selected Item Text
|
||||
if (render_selected_item_text) {
|
||||
// Fix GL Mode
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
#endif
|
||||
// Calculate Selected Item Text Scale
|
||||
Minecraft *minecraft = gui->minecraft;
|
||||
int32_t screen_width = minecraft->screen_width;
|
||||
@ -122,25 +124,37 @@ static void Inventory_selectSlot_injection(Inventory *inventory, int32_t slot) {
|
||||
// Translucent Toolbar
|
||||
static void Gui_renderToolBar_injection(Gui *gui, float param_1, int32_t param_2, int32_t param_3) {
|
||||
// Call Original Method
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
int was_blend_enabled = glIsEnabled(GL_BLEND);
|
||||
if (!was_blend_enabled) {
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
#endif
|
||||
Gui_renderToolBar(gui, param_1, param_2, param_3);
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
if (!was_blend_enabled) {
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
static void Gui_renderToolBar_glColor4f_injection(GLfloat red, GLfloat green, GLfloat blue, __attribute__((unused)) GLfloat alpha) {
|
||||
// Fix Alpha
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
glColor4f(red, green, blue, 1.0f);
|
||||
#else
|
||||
(void) red;
|
||||
(void) green;
|
||||
(void) blue;
|
||||
#endif
|
||||
}
|
||||
|
||||
// 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) {
|
||||
// Fix
|
||||
#ifndef MCPI_HEADLESS_MODE
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
#endif
|
||||
// Call Original Method
|
||||
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:]')"
|
||||
|
||||
# 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}"
|
||||
fi
|
||||
# Use Build Dir
|
||||
@ -20,17 +20,9 @@ if [ -z "${DESTDIR+x}" ]; then
|
||||
mkdir -p "${DESTDIR}"
|
||||
fi
|
||||
|
||||
# Build ARM Components
|
||||
cd arm
|
||||
# Build
|
||||
cmake --build .
|
||||
cmake --install .
|
||||
cd ../
|
||||
|
||||
# Build Native Components
|
||||
cd native
|
||||
cmake --build .
|
||||
cmake --install .
|
||||
cd ../
|
||||
|
||||
# Exit
|
||||
cd ../../
|
||||
|
@ -2,9 +2,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
# ARM Toolchain File
|
||||
ARM_TOOLCHAIN_FILE="$(pwd)/cmake/toolchain/armhf-toolchain.cmake"
|
||||
|
||||
# Variables
|
||||
MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')"
|
||||
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
|
||||
@ -33,25 +30,9 @@ server_mode='OFF'
|
||||
if [ "${MODE}" = "server" ]; then
|
||||
server_mode='ON'
|
||||
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
|
||||
mkdir arm
|
||||
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 ../
|
||||
# Build Components
|
||||
cmake -GNinja -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" -DMCPI_SERVER_MODE="${server_mode}" "$@" ../../
|
||||
|
||||
# Exit
|
||||
cd ../../
|
||||
|
@ -17,7 +17,7 @@ set(SRC
|
||||
src/network/raknet/RakNet_RakString_SharedString.def
|
||||
src/network/raknet/RakNet_RakString.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_RakPeer.def
|
||||
src/network/ServerSideNetworkHandler.def
|
||||
@ -111,7 +111,7 @@ set(SRC
|
||||
src/tile/GrassTile.def
|
||||
src/tile/HeavyTile.def
|
||||
src/misc/Strings.def
|
||||
src/misc/ModelPart.def
|
||||
src/entity/ModelPart.def
|
||||
src/misc/Tesselator.def
|
||||
src/misc/AABB.def
|
||||
src/misc/Vec3.def
|
||||
|
@ -5,4 +5,4 @@ property float y1 = 0x4;
|
||||
property float z1 = 0x8;
|
||||
property float x2 = 0xc;
|
||||
property float y2 = 0x10;
|
||||
property float z2 = 0x14;
|
||||
property float z2 = 0x14;
|
||||
|
Loading…
Reference in New Issue
Block a user