diff --git a/.gitmodules b/.gitmodules index 30b1a879fc..9c9c34237e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,9 @@ [submodule "engine/lib/imgui"] path = engine/lib/imgui url = https://github.com/ocornut/imgui.git +[submodule "core/lib/json"] + path = core/lib/json + url = https://github.com/nlohmann/json.git +[submodule "core/lib/glad"] + path = core/lib/glad + url = git@github.com:Dav1dde/glad.git diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 71efde320e..373b6b47f0 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -93,8 +93,10 @@ cubos_common_target_options(cubos-core) # Link dependencies if (WITH_OPENGL) - add_subdirectory(lib/glad) - target_link_libraries(cubos-core PRIVATE glad) + set(GLAD_SOUURCES_DIR "lib/glad") + add_subdirectory("${GLAD_SOUURCES_DIR}/cmake" glad_cmake) + glad_add_library(glad REPRODUCIBLE API gl:core=3.3) + target_link_libraries(cubos-core PUBLIC glad) target_compile_definitions(cubos-core PRIVATE WITH_OPENGL) endif () @@ -147,6 +149,7 @@ else () find_package(spdlog REQUIRED) endif () +set(JSON_BuildTests OFF CACHE INTERNAL "") add_subdirectory(lib/json) add_subdirectory(lib/stduuid) @@ -156,8 +159,8 @@ set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) target_compile_definitions(cubos-core PUBLIC GLM_FORCE_SILENT_WARNINGS) # Needed for compilation to succeed on MSVC -target_link_libraries(cubos-core PUBLIC glm::glm spdlog fmt::fmt json ${CMAKE_DL_LIBS}) -target_link_libraries(cubos-core PRIVATE glad Threads::Threads) +target_link_libraries(cubos-core PUBLIC glm::glm spdlog nlohmann_json::nlohmann_json fmt::fmt ${CMAKE_DL_LIBS}) +target_link_libraries(cubos-core PRIVATE Threads::Threads) # Add core tests diff --git a/core/lib/glad b/core/lib/glad new file mode 160000 index 0000000000..d08b1aa01f --- /dev/null +++ b/core/lib/glad @@ -0,0 +1 @@ +Subproject commit d08b1aa01f8fe57498f04d47b5fa8c48725be877 diff --git a/core/lib/glfw b/core/lib/glfw index 814b7929c5..7482de6071 160000 --- a/core/lib/glfw +++ b/core/lib/glfw @@ -1 +1 @@ -Subproject commit 814b7929c5add4b0541ccad26fb81f28b71dc4d8 +Subproject commit 7482de6071d21db77a7236155da44c172a7f6c9e diff --git a/core/lib/glm b/core/lib/glm index efec5db081..bf71a83494 160000 --- a/core/lib/glm +++ b/core/lib/glm @@ -1 +1 @@ -Subproject commit efec5db081e3aad807d0731e172ac597f6a39447 +Subproject commit bf71a834948186f4097caa076cd2663c69a10e1e diff --git a/core/lib/json b/core/lib/json new file mode 160000 index 0000000000..bc889afb4c --- /dev/null +++ b/core/lib/json @@ -0,0 +1 @@ +Subproject commit bc889afb4c5bf1c0d8ee29ef35eaaf4c8bef8a5d diff --git a/core/lib/openal-soft b/core/lib/openal-soft index 862628966d..d3875f333f 160000 --- a/core/lib/openal-soft +++ b/core/lib/openal-soft @@ -1 +1 @@ -Subproject commit 862628966dc3fd61efb04baa9ac285719af107d2 +Subproject commit d3875f333fb6abe2f39d82caca329414871ae53b diff --git a/core/src/cubos/core/gl/ogl_render_device.cpp b/core/src/cubos/core/gl/ogl_render_device.cpp index 3851049a07..1291fa9810 100644 --- a/core/src/cubos/core/gl/ogl_render_device.cpp +++ b/core/src/cubos/core/gl/ogl_render_device.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include diff --git a/core/src/cubos/core/io/glfw_window.cpp b/core/src/cubos/core/io/glfw_window.cpp index 19c0466d06..c13f349e45 100644 --- a/core/src/cubos/core/io/glfw_window.cpp +++ b/core/src/cubos/core/io/glfw_window.cpp @@ -1,6 +1,6 @@ #include "glfw_window.hpp" -#include +#include #include @@ -69,7 +69,7 @@ GLFWWindow::GLFWWindow(const std::string& title, const glm::ivec2& size) // Create OpenGL render device glfwMakeContextCurrent(mHandle); - if (gladLoadGLLoader((GLADloadproc)glfwGetProcAddress) == 0) + if (gladLoadGL(glfwGetProcAddress) == 0) { CUBOS_CRITICAL("OpenGL loader failed"); abort(); diff --git a/engine/lib/imgui b/engine/lib/imgui index 94da5842ef..c6e0284ac5 160000 --- a/engine/lib/imgui +++ b/engine/lib/imgui @@ -1 +1 @@ -Subproject commit 94da5842ef8a5f57b5cf668a19425bd49b233842 +Subproject commit c6e0284ac58b3f205c95365478888f7b53b077e2 diff --git a/flake.lock b/flake.lock index 1749cffcd3..dc1d79d540 100644 --- a/flake.lock +++ b/flake.lock @@ -17,16 +17,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1675757258, - "narHash": "sha256-pIRer8vdsoherlRKpzfnHbMZ5TsAcvRlXHCIaHkIUbg=", + "lastModified": 1695825837, + "narHash": "sha256-4Ne11kNRnQsmSJCRSSNkFRSnHC4Y5gPDBIQGjjPfJiU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "af96094e9b8eb162d70a84fa3b39f4b7a8b264d2", + "rev": "5cfafa12d57374f48bcc36fda3274ada276cf69e", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-22.11", + "ref": "nixos-23.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 718cd1b6fd..7b12a7233b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ # Flake used for development with nix { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; flake-utils.url = "github:numtide/flake-utils"; }; @@ -13,6 +13,14 @@ { devShell = pkgs.mkShell { buildInputs = with pkgs; [ + xorg.libX11 + xorg.libXrandr + xorg.libXinerama + xorg.libXcursor + xorg.libXi + libxkbcommon + libGL + libglvnd pkg-config cmake gcc @@ -24,13 +32,15 @@ graphviz clang_14 doctest - ccache + ccache lcov (python3.withPackages (ps: with ps; [ jinja2 pygments - ])) + ])) ]; + + LD_LIBRARY_PATH = "/run/opengl-driver/lib:/run/opengl-driver-32/lib"; }; }); }