diff --git a/.gitmodules b/.gitmodules index 4e7bc273a2..2ba4463f8d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 98f4027f81..536d2293a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/cmake/options/paths.cmake b/cmake/options/paths.cmake index 18bd11c710..eaf05cf176 100644 --- a/cmake/options/paths.cmake +++ b/cmake/options/paths.cmake @@ -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() diff --git a/cmake/options/prebuilt-armhf-toolchain.cmake b/cmake/options/prebuilt-armhf-toolchain.cmake index 41e7f04404..be24232f79 100644 --- a/cmake/options/prebuilt-armhf-toolchain.cmake +++ b/cmake/options/prebuilt-armhf-toolchain.cmake @@ -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") diff --git a/cmake/util/util.cmake b/cmake/util/util.cmake index e614693d9b..0f91f21f60 100644 --- a/cmake/util/util.cmake +++ b/cmake/util/util.cmake @@ -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() \ No newline at end of file diff --git a/dependencies/LIEF/CMakeLists.txt b/dependencies/LIEF/CMakeLists.txt index 0f2b4088d8..64c773f00b 100644 --- a/dependencies/LIEF/CMakeLists.txt +++ b/dependencies/LIEF/CMakeLists.txt @@ -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) diff --git a/dependencies/glfw/CMakeLists.txt b/dependencies/glfw/CMakeLists.txt index ac8b69ea66..7378fb9f6d 100644 --- a/dependencies/glfw/CMakeLists.txt +++ b/dependencies/glfw/CMakeLists.txt @@ -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) diff --git a/dependencies/imgui/CMakeLists.txt b/dependencies/imgui/CMakeLists.txt index 6d5a5a33e7..d89d58b631 100644 --- a/dependencies/imgui/CMakeLists.txt +++ b/dependencies/imgui/CMakeLists.txt @@ -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") diff --git a/dependencies/imgui/glad/CMakeLists.txt b/dependencies/imgui/glad/CMakeLists.txt new file mode 100644 index 0000000000..83edb0c87b --- /dev/null +++ b/dependencies/imgui/glad/CMakeLists.txt @@ -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) \ No newline at end of file diff --git a/dependencies/imgui/glad/include/GL/gl.h b/dependencies/imgui/glad/include/GL/gl.h new file mode 100644 index 0000000000..1b5350434b --- /dev/null +++ b/dependencies/imgui/glad/include/GL/gl.h @@ -0,0 +1,2 @@ +#pragma once +#include \ No newline at end of file diff --git a/dependencies/imgui/glad/src b/dependencies/imgui/glad/src new file mode 160000 index 0000000000..f49229523c --- /dev/null +++ b/dependencies/imgui/glad/src @@ -0,0 +1 @@ +Subproject commit f49229523c58ad7698e941f7c51454e77dd9d6a8 diff --git a/dependencies/runtime/CMakeLists.txt b/dependencies/runtime/CMakeLists.txt index 694a5257be..6dd0d87054 100644 --- a/dependencies/runtime/CMakeLists.txt +++ b/dependencies/runtime/CMakeLists.txt @@ -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 diff --git a/launcher/src/ui/frame.cpp b/launcher/src/ui/frame.cpp index 60f48e7930..61cab743f7 100644 --- a/launcher/src/ui/frame.cpp +++ b/launcher/src/ui/frame.cpp @@ -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(); diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index b645f36f7c..8c23e87a29 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -61,8 +61,6 @@ run_build() { "libxext-dev:$1" \ `# QEMU Dependencies` \ "libglib2.0-dev:$1" \ - `# ImGui Dependencies` \ - "libglvnd-dev:$1" \ `# AppStream Verification` \ appstream