Use GLAD
This commit is contained in:
parent
983e474b33
commit
890bd537b2
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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")
|
||||
|
@ -77,3 +77,9 @@ function(setup_library target should_install should_export)
|
||||
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()
|
31
dependencies/LIEF/CMakeLists.txt
vendored
31
dependencies/LIEF/CMakeLists.txt
vendored
@ -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)
|
||||
|
18
dependencies/glfw/CMakeLists.txt
vendored
18
dependencies/glfw/CMakeLists.txt
vendored
@ -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)
|
||||
|
8
dependencies/imgui/CMakeLists.txt
vendored
8
dependencies/imgui/CMakeLists.txt
vendored
@ -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
13
dependencies/imgui/glad/CMakeLists.txt
vendored
Normal 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)
|
2
dependencies/imgui/glad/include/GL/gl.h
vendored
Normal file
2
dependencies/imgui/glad/include/GL/gl.h
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
#pragma once
|
||||
#include <glad/gl.h>
|
1
dependencies/imgui/glad/src
vendored
Submodule
1
dependencies/imgui/glad/src
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit f49229523c58ad7698e941f7c51454e77dd9d6a8
|
4
dependencies/runtime/CMakeLists.txt
vendored
4
dependencies/runtime/CMakeLists.txt
vendored
@ -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
|
||||
|
@ -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();
|
||||
|
@ -61,8 +61,6 @@ run_build() {
|
||||
"libxext-dev:$1" \
|
||||
`# QEMU Dependencies` \
|
||||
"libglib2.0-dev:$1" \
|
||||
`# ImGui Dependencies` \
|
||||
"libglvnd-dev:$1" \
|
||||
`# AppStream Verification` \
|
||||
appstream
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user