This commit is contained in:
TheBrokenRail 2024-11-24 17:42:36 -05:00
parent 983e474b33
commit 890bd537b2
14 changed files with 67 additions and 35 deletions

3
.gitmodules vendored
View File

@ -24,3 +24,6 @@
path = dependencies/imgui/src
url = https://github.com/ocornut/imgui.git
ignore = dirty
[submodule "dependencies/imgui/glad/src"]
path = dependencies/imgui/glad/src
url = https://github.com/Dav1dde/glad.git

View File

@ -8,7 +8,7 @@ include(cmake/options/core-options.cmake)
# Build Mode
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE)
endif()
# Start Project

View File

@ -28,6 +28,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
elseif(MCPI_IS_FLATPAK_BUILD)
set(DEFAULT_PREFIX "/app")
endif()
set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "" FORCE)
set(CMAKE_INSTALL_PREFIX "${DEFAULT_PREFIX}" CACHE PATH "Install Prefix" FORCE)
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
endif()

View File

@ -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(MCPI_CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" CACHE FILEPATH "" FORCE)
force_set(MCPI_CMAKE_TOOLCHAIN_FILE "${toolchain_dir}/toolchain.cmake" FILEPATH)
# Build Sysroot
set(sysroot_dir "${CMAKE_CURRENT_BINARY_DIR}/bundled-armhf-sysroot")

View File

@ -76,4 +76,10 @@ function(setup_library target should_install should_export)
if(should_export AND BUILD_ARM_COMPONENTS)
install(TARGETS "${target}" EXPORT sdk DESTINATION "${MCPI_SDK_LIB_DIR}")
endif()
endfunction()
# Force Set Configuration Variable
function(force_set name value type)
set("${name}" "${value}" CACHE "${type}" "" FORCE)
mark_as_advanced(FORCE "${name}")
endfunction()

View File

@ -6,22 +6,21 @@ add_compile_options(-w -Wno-psabi)
## LIEF
# Options
set(BUILD_SHARED_LIBS TRUE CACHE BOOL "" FORCE)
set(LIEF_C_API FALSE CACHE BOOL "" FORCE)
set(LIEF_EXAMPLES FALSE CACHE BOOL "" FORCE)
set(LIEF_PYTHON_API FALSE CACHE BOOL "" FORCE)
set(LIEF_TESTS FALSE CACHE BOOL "" FORCE)
set(LIEF_USE_CCACHE FALSE CACHE BOOL "" FORCE)
set(LIEF_LOGGING FALSE CACHE BOOL "" FORCE)
set(LIEF_LOGGING_DEBUG FALSE CACHE BOOL "" FORCE)
set(LIEF_ENABLE_JSON FALSE CACHE BOOL "" FORCE)
set(LIEF_ELF TRUE CACHE BOOL "" FORCE)
set(LIEF_PE FALSE CACHE BOOL "" FORCE)
set(LIEF_MACHO FALSE CACHE BOOL "" FORCE)
set(LIEF_DEX FALSE CACHE BOOL "" FORCE)
set(LIEF_ART FALSE CACHE BOOL "" FORCE)
set(LIEF_OAT FALSE CACHE BOOL "" FORCE)
set(LIEF_VDEX FALSE CACHE BOOL "" FORCE)
force_set(LIEF_C_API FALSE BOOL)
force_set(LIEF_EXAMPLES FALSE BOOL)
force_set(LIEF_PYTHON_API FALSE BOOL)
force_set(LIEF_TESTS FALSE BOOL)
force_set(LIEF_USE_CCACHE FALSE BOOL)
force_set(LIEF_LOGGING FALSE BOOL)
force_set(LIEF_LOGGING_DEBUG FALSE BOOL)
force_set(LIEF_ENABLE_JSON FALSE BOOL)
force_set(LIEF_ELF TRUE BOOL)
force_set(LIEF_PE FALSE BOOL)
force_set(LIEF_MACHO FALSE BOOL)
force_set(LIEF_DEX FALSE BOOL)
force_set(LIEF_ART FALSE BOOL)
force_set(LIEF_OAT FALSE BOOL)
force_set(LIEF_VDEX FALSE BOOL)
# Download
set(MESSAGE_QUIET TRUE)

View File

@ -6,15 +6,15 @@ add_compile_options(-w)
## GLFW
# Download
set(GLFW_BUILD_EXAMPLES FALSE CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS FALSE CACHE BOOL "" FORCE)
set(GLFW_BUILD_DOCS FALSE CACHE BOOL "" FORCE)
set(GLFW_INSTALL FALSE CACHE BOOL "" FORCE)
set(GLFW_BUILD_WIN32 FALSE CACHE BOOL "" FORCE)
set(GLFW_BUILD_COCOA FALSE CACHE BOOL "" FORCE)
set(GLFW_BUILD_X11 TRUE CACHE BOOL "" FORCE)
set(GLFW_BUILD_WAYLAND TRUE CACHE BOOL "" FORCE)
set(GLFW_LIBRARY_TYPE "SHARED" CACHE BOOL "" FORCE)
force_set(GLFW_BUILD_EXAMPLES FALSE BOOL)
force_set(GLFW_BUILD_TESTS FALSE BOOL)
force_set(GLFW_BUILD_DOCS FALSE BOOL)
force_set(GLFW_INSTALL FALSE BOOL)
force_set(GLFW_BUILD_WIN32 FALSE BOOL)
force_set(GLFW_BUILD_COCOA FALSE BOOL)
force_set(GLFW_BUILD_X11 TRUE BOOL)
force_set(GLFW_BUILD_WAYLAND TRUE BOOL)
force_set(GLFW_LIBRARY_TYPE "SHARED" STRING)
set(MESSAGE_QUIET TRUE)
add_subdirectory(src EXCLUDE_FROM_ALL)
unset(MESSAGE_QUIET)

View File

@ -20,8 +20,10 @@ setup_header_dirs(imgui
"${CMAKE_CURRENT_SOURCE_DIR}/src/backends"
"${CMAKE_CURRENT_SOURCE_DIR}/src/misc/cpp"
)
find_package(OpenGL REQUIRED QUIET)
target_link_libraries(imgui PUBLIC glfw OpenGL::GL)
# OpenGL
add_subdirectory(glad)
target_link_libraries(imgui PUBLIC glfw glad)
# Fonts
embed_resource(imgui src/misc/fonts/Roboto-Medium.ttf)
@ -44,7 +46,7 @@ execute_process(
)
# Install
setup_library(imgui TRUE TRUE)
setup_library(imgui TRUE FALSE)
# License
install(FILES src/LICENSE.txt src/docs/FONTS.md DESTINATION "${MCPI_LEGAL_DIR}/ImGui")

13
dependencies/imgui/glad/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,13 @@
project(imgui-glad)
# Setup GLAD
set(MESSAGE_QUIET TRUE)
add_subdirectory(src/cmake)
glad_add_library(glad SHARED REPRODUCIBLE QUIET API gl:compatibility=1.1)
set(MESSAGE_QUIET FALSE)
# Fix GL/gl.h
setup_header_dirs(glad "${CMAKE_CURRENT_SOURCE_DIR}/include")
# Install
setup_library(glad TRUE FALSE)

View File

@ -0,0 +1,2 @@
#pragma once
#include <glad/gl.h>

1
dependencies/imgui/glad/src vendored Submodule

@ -0,0 +1 @@
Subproject commit f49229523c58ad7698e941f7c51454e77dd9d6a8

View File

@ -4,9 +4,9 @@ project(runtime)
# QEMU
set(QEMU_VERSION "9.1.1")
set(RUNTIME_QEMU_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../archives/qemu-${QEMU_VERSION}.tar.xz" CACHE FILEPATH "" FORCE)
force_set(RUNTIME_QEMU_ARCHIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../archives/qemu-${QEMU_VERSION}.tar.xz" FILEPATH)
if(NOT BUILD_NATIVE_COMPONENTS)
set(TRAMPOLINE_HEADERS_ONLY TRUE CACHE BOOL "" FORCE)
force_set(TRAMPOLINE_HEADERS_ONLY TRUE BOOL)
endif()
# Build

View File

@ -13,10 +13,17 @@
Frame::Frame(const char *title, const int width, const int height) {
// Create Window
init_glfw();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 1);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
window = create_glfw_window(title, width, height);
// Load OpenGL
gladLoadGL(glfwGetProcAddress);
// Disable V-Sync
// (On Wayland, This Fixes Issues With The Clipboard)
glfwSwapInterval(0);
// Setup ImGui Context
IMGUI_CHECKVERSION();
ImGui::CreateContext();
@ -24,6 +31,7 @@ Frame::Frame(const char *title, const int width, const int height) {
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.IniFilename = nullptr;
io.LogFilename = nullptr;
// Setup Platform/Renderer Backends
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL2_Init();

View File

@ -61,8 +61,6 @@ run_build() {
"libxext-dev:$1" \
`# QEMU Dependencies` \
"libglib2.0-dev:$1" \
`# ImGui Dependencies` \
"libglvnd-dev:$1" \
`# AppStream Verification` \
appstream