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 # Avoid Warning About DOWNLOAD_EXTRACT_TIMESTAMP
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24.0)
cmake_policy(SET CMP0135 NEW) cmake_policy(SET CMP0135 NEW)
endif()
# Core Options # Core Options
include(cmake/options/core-options.cmake) include(cmake/options/core-options.cmake)

View File

@ -1,4 +1,4 @@
# Downlaod AppImage Runtime # Download AppImage Runtime
set(RUNTIME_ARCH "unknown") set(RUNTIME_ARCH "unknown")
if(CPACK_MCPI_ARCH STREQUAL "armhf") if(CPACK_MCPI_ARCH STREQUAL "armhf")
set(RUNTIME_ARCH "armhf") set(RUNTIME_ARCH "armhf")
@ -16,7 +16,7 @@ file(DOWNLOAD
list(GET DOWNLOAD_STATUS 0 STATUS_CODE) list(GET DOWNLOAD_STATUS 0 STATUS_CODE)
list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE) list(GET DOWNLOAD_STATUS 1 ERROR_MESSAGE)
if(NOT STATUS_CODE EQUAL 0) 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() else()
message(STATUS "Downloaded AppImage Runtime: ${RUNTIME}") message(STATUS "Downloaded AppImage Runtime: ${RUNTIME}")
endif() endif()
@ -41,11 +41,8 @@ execute_process(
"${CPACK_TEMPORARY_DIRECTORY}" "${CPACK_TEMPORARY_DIRECTORY}"
"${CPACK_PACKAGE_FILE_NAME}.AppImage" "${CPACK_PACKAGE_FILE_NAME}.AppImage"
WORKING_DIRECTORY "${CPACK_PACKAGE_DIRECTORY}" 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 # Rename ZSync File
file(RENAME "${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}.AppImage.zsync" "${CPACK_PACKAGE_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME_ZSYNC}.AppImage.zsync") 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") if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE "${sysroot_dir}/*") file(GLOB_RECURSE files LIST_DIRECTORIES FALSE "${sysroot_dir}/*")
foreach(file IN LISTS files) 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 # Check Result
if(NOT ret EQUAL 0) if(NOT ret EQUAL 0)
# Delete Invalid Files # Delete Invalid Files
@ -66,7 +70,7 @@ endif()
function(install_arm_sysroot) function(install_arm_sysroot)
file(GLOB_RECURSE files LIST_DIRECTORIES FALSE RELATIVE "${sysroot_dir}" "${sysroot_dir}/*") file(GLOB_RECURSE files LIST_DIRECTORIES FALSE RELATIVE "${sysroot_dir}" "${sysroot_dir}/*")
foreach(file IN LISTS files) 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}") install(PROGRAMS "${sysroot_dir}/${file}" DESTINATION "${MCPI_INSTALL_DIR}/sysroot/${parent}")
endforeach() endforeach()
endfunction() 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}") string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1," data "${data}")
# Get C Name # Get C Name
get_filename_component(name "${EMBED_IN}" NAME) cmake_path(GET EMBED_OUT STEM name)
string(MAKE_C_IDENTIFIER "${name}" name)
# Write Data # 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 # Symlink Function
function(install_symlink target link) function(install_symlink target link)
get_filename_component(parent "${link}" DIRECTORY) cmake_path(GET link PARENT_PATH parent)
if(parent STREQUAL "") if(parent STREQUAL "")
set(parent ".") set(parent ".")
endif() endif()
@ -13,7 +13,7 @@ endfunction()
set(util_list_dir "${CMAKE_CURRENT_LIST_DIR}") set(util_list_dir "${CMAKE_CURRENT_LIST_DIR}")
function(embed_resource target file) function(embed_resource target file)
# Get C Name # Get C Name
get_filename_component(name "${file}" NAME) cmake_path(GET file FILENAME name)
string(MAKE_C_IDENTIFIER "${name}" name) string(MAKE_C_IDENTIFIER "${name}" name)
# Add Command # Add Command
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.c" 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 # Link
find_library(OPENAL_LIBRARY NAMES openal REQUIRED) find_library(OPENAL_LIBRARY NAMES openal REQUIRED)
target_link_libraries(media-layer-core-real target_link_libraries(media-layer-core-real
PUBLIC media-layer-headers PUBLIC
PUBLIC reborn-util media-layer-headers
PRIVATE "${OPENAL_LIBRARY}" reborn-util
PRIVATE m GLESv1_CM
PRIVATE glfw dl
PUBLIC GLESv1_CM PRIVATE
PRIVATE LIB_LIEF "${OPENAL_LIBRARY}"
PUBLIC dl m
glfw
LIB_LIEF
) )

View File

@ -14,7 +14,14 @@ if(BUILD_NATIVE_COMPONENTS)
elseif(BUILD_ARM_COMPONENTS) elseif(BUILD_ARM_COMPONENTS)
# Guest Component # Guest Component
add_library(media-layer-core SHARED src/guest/guest.cpp ${MEDIA_LAYER_TRAMPOLINE_SRC}) 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) target_compile_definitions(media-layer-core PRIVATE -DMEDIA_LAYER_TRAMPOLINE_GUEST)
# Install # Install
if(MCPI_USE_MEDIA_LAYER_TRAMPOLINE) if(MCPI_USE_MEDIA_LAYER_TRAMPOLINE)

View File

@ -9,6 +9,26 @@ if [ "$(id -u)" -eq 0 ]; then
} }
fi 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 # Run APT
install_pkg() { install_pkg() {
sudo apt-get install --no-install-recommends -y "$@" sudo apt-get install --no-install-recommends -y "$@"
@ -19,10 +39,11 @@ run_build() {
install_pkg \ install_pkg \
`# Build System` \ `# Build System` \
git \ git \
cmake \ "cmake${BACKPORTS}" \
ninja-build \ ninja-build \
python3 \ python3 \
python3-venv \ python3-venv \
"python3-tomli${BACKPORTS}" \
`# Host Dependencies Needed For Compile` \ `# Host Dependencies Needed For Compile` \
libwayland-bin \ libwayland-bin \
`# Compiler` \ `# Compiler` \
@ -84,16 +105,5 @@ run_example_mods() {
gcc-arm-linux-gnueabihf 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 # Install Packages
"run_${MODE}" "${ARCH}" "run_${MODE}" "${ARCH}"

View File

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