Some Updates

This commit is contained in:
TheBrokenRail 2024-11-15 15:26:33 -05:00
parent f501f9a7c9
commit 58a6706cf9
11 changed files with 68 additions and 50 deletions

View File

@ -1,9 +1,7 @@
cmake_minimum_required(VERSION 3.17.0)
cmake_minimum_required(VERSION 3.24.0)
# Avoid Warning About DOWNLOAD_EXTRACT_TIMESTAMP
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24.0)
cmake_policy(SET CMP0135 NEW)
endif()
cmake_policy(SET CMP0135 NEW)
# Core Options
include(cmake/options/core-options.cmake)

View File

@ -1,4 +1,4 @@
# Downlaod AppImage Runtime
# Download AppImage Runtime
set(RUNTIME_ARCH "unknown")
if(CPACK_MCPI_ARCH STREQUAL "armhf")
set(RUNTIME_ARCH "armhf")
@ -16,7 +16,7 @@ file(DOWNLOAD
list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
if(NOT STATUS_CODE EQUAL 0)
message(FATAL_ERROR "Unable To Downlopad AppImage Runtime: ${ERROR_MESSAGE}")
message(FATAL_ERROR "Unable To Download AppImage Runtime: ${ERROR_MESSAGE}")
else()
message(STATUS "Downloaded AppImage Runtime: ${RUNTIME}")
endif()
@ -41,11 +41,8 @@ execute_process(
"${CPACK_TEMPORARY_DIRECTORY}"
"${CPACK_PACKAGE_FILE_NAME}.AppImage"
WORKING_DIRECTORY "${CPACK_PACKAGE_DIRECTORY}"
RESULT_VARIABLE APPIMAGETOOL_RESULT
COMMAND_ERROR_IS_FATAL ANY
)
if(NOT APPIMAGETOOL_RESULT EQUAL 0)
message(FATAL_ERROR "Unable Package AppImage")
endif()
# Rename ZSync File
file(RENAME "${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}.AppImage.zsync" "${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME_ZSYNC}.AppImage.zsync")

View File

@ -52,7 +52,11 @@ if("${toolchain_dir}/bin/arm-none-linux-gnueabihf-gcc" IS_NEWER_THAN "${sysroot_
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE "${sysroot_dir}/*")
foreach(file IN LISTS files)
execute_process(COMMAND "${toolchain_dir}/bin/arm-none-linux-gnueabihf-strip" "${file}" RESULT_VARIABLE ret)
execute_process(
COMMAND "${toolchain_dir}/bin/arm-none-linux-gnueabihf-strip" "${file}"
RESULT_VARIABLE ret
ERROR_QUIET
)
# Check Result
if(NOT ret EQUAL 0)
# Delete Invalid Files
@ -66,7 +70,7 @@ endif()
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)
cmake_path(GET file PARENT_PATH parent)
install(PROGRAMS "${sysroot_dir}/${file}" DESTINATION "${MCPI_INSTALL_DIR}/sysroot/${parent}")
endforeach()
endfunction()

View File

@ -5,8 +5,11 @@ file(READ "${EMBED_IN}" data HEX)
string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," data "${data}")
# Get C Name
get_filename_component(name "${EMBED_IN}" NAME)
string(MAKE_C_IDENTIFIER "${name}" name)
cmake_path(GET EMBED_OUT STEM name)
# Write Data
file(WRITE "${EMBED_OUT}" "#include <stddef.h>\nconst unsigned char ${name}[] = {${data}};\nconst size_t ${name}_len = sizeof (${name});\n")
file(WRITE "${EMBED_OUT}"
"#include <stddef.h>\n"
"const unsigned char ${name}[] = {${data}};\n"
"const size_t ${name}_len = sizeof (${name});\n"
)

View File

@ -1,6 +1,6 @@
# Symlink Function
function(install_symlink target link)
get_filename_component(parent "${link}" DIRECTORY)
cmake_path(GET link PARENT_PATH parent)
if(parent STREQUAL "")
set(parent ".")
endif()
@ -13,7 +13,7 @@ endfunction()
set(util_list_dir "${CMAKE_CURRENT_LIST_DIR}")
function(embed_resource target file)
# Get C Name
get_filename_component(name "${file}" NAME)
cmake_path(GET file FILENAME name)
string(MAKE_C_IDENTIFIER "${name}" name)
# Add Command
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"

@ -1 +1 @@
Subproject commit bae887e095d87e756d1bf4aa4f95a97693a97b62
Subproject commit f4d68357cb51fc251555e69e2679f5bb11af75ea

@ -1 +1 @@
Subproject commit bf46eaf1c596fa34c760f26ea5eab679c3e66336
Subproject commit b42021ba5d45c29e22cbdd887e2fae5a1c1334a1

View File

@ -25,12 +25,14 @@ install(TARGETS media-layer-core-real DESTINATION "${MCPI_LIB_DIR}")
# Link
find_library(OPENAL_LIBRARY NAMES openal REQUIRED)
target_link_libraries(media-layer-core-real
PUBLIC media-layer-headers
PUBLIC reborn-util
PRIVATE "${OPENAL_LIBRARY}"
PRIVATE m
PRIVATE glfw
PUBLIC GLESv1_CM
PRIVATE LIB_LIEF
PUBLIC dl
PUBLIC
media-layer-headers
reborn-util
GLESv1_CM
dl
PRIVATE
"${OPENAL_LIBRARY}"
m
glfw
LIB_LIEF
)

View File

@ -14,7 +14,14 @@ if(BUILD_NATIVE_COMPONENTS)
elseif(BUILD_ARM_COMPONENTS)
# Guest Component
add_library(media-layer-core SHARED src/guest/guest.cpp ${MEDIA_LAYER_TRAMPOLINE_SRC})
target_link_libraries(media-layer-core PUBLIC media-layer-headers PRIVATE reborn-util PRIVATE trampoline-headers PRIVATE rt)
target_link_libraries(media-layer-core
PUBLIC
media-layer-headers
PRIVATE
reborn-util
trampoline-headers
rt
)
target_compile_definitions(media-layer-core PRIVATE -DMEDIA_LAYER_TRAMPOLINE_GUEST)
# Install
if(MCPI_USE_MEDIA_LAYER_TRAMPOLINE)

View File

@ -9,6 +9,26 @@ if [ "$(id -u)" -eq 0 ]; then
}
fi
# Setup Backports
CODENAME="$(. /etc/os-release && echo "${VERSION_CODENAME}")"
BACKPORTS=''
if [ "${CODENAME}" = 'bullseye' ]; then
BACKPORTS="${CODENAME}-backports"
echo "deb http://deb.debian.org/debian ${BACKPORTS} main" | sudo tee "/etc/apt/sources.list.d/${BACKPORTS}.list" > /dev/null
BACKPORTS="/${BACKPORTS}"
fi
# Variables
MODE="$1"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
# Add ARM Repository
sudo dpkg --add-architecture "${ARCH}"
# Update APT
sudo apt-get update
sudo apt-get dist-upgrade -y
# Run APT
install_pkg() {
sudo apt-get install --no-install-recommends -y "$@"
@ -19,10 +39,11 @@ run_build() {
install_pkg \
`# Build System` \
git \
cmake \
"cmake${BACKPORTS}" \
ninja-build \
python3 \
python3-venv \
"python3-tomli${BACKPORTS}" \
`# Host Dependencies Needed For Compile` \
libwayland-bin \
`# Compiler` \
@ -84,16 +105,5 @@ run_example_mods() {
gcc-arm-linux-gnueabihf
}
# Variables
MODE="$1"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
# Add ARM Repository
sudo dpkg --add-architecture "${ARCH}"
# Update APT
sudo apt-get update
sudo apt-get dist-upgrade -y
# Install Packages
"run_${MODE}" "${ARCH}"

View File

@ -214,18 +214,18 @@ set(HEADER_OUTPUT_FILE "${HEADER_OUTPUT_DIR}/minecraft.h")
# Generated Source Files
set(SRC_OUTPUT_FILES "")
foreach(FILE IN LISTS SRC)
get_filename_component(FILE_EXT "${FILE}" EXT)
if(FILE_EXT STREQUAL ".def")
get_filename_component(FILE "${FILE}" NAME_WE)
list(APPEND SRC_OUTPUT_FILES "${SRC_OUTPUT_DIR}/${FILE}.cpp")
foreach(file IN LISTS SRC)
cmake_path(GET file EXTENSION file_ext)
if(file_ext STREQUAL ".def")
cmake_path(GET file STEM file)
list(APPEND SRC_OUTPUT_FILES "${SRC_OUTPUT_DIR}/${file}.cpp")
endif()
endforeach()
# Generate
set(INPUT_FILES "")
foreach(FILE IN LISTS SRC)
list(APPEND INPUT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
foreach(file IN LISTS SRC)
list(APPEND INPUT_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
endforeach()
set(OUTPUT_FILES ${SRC_OUTPUT_FILES} "${HEADER_OUTPUT_FILE}")
add_custom_command(
@ -239,9 +239,6 @@ add_custom_command(
# Build
add_library(symbols SHARED ${OUTPUT_FILES})
# Speed Up Compilation
#target_precompile_headers(symbols PRIVATE "${HEADER_OUTPUT_FILE}")
# Show In IDE
add_custom_target(symbols-src
DEPENDS "${SRC_OUTPUT_FILE}" "${HEADER_OUTPUT_FILE}"