From 019cf416faaee2274e947824dba58776bd738630 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Thu, 2 Jun 2022 21:28:00 +0100 Subject: [PATCH] meta: move submodules to 3rdparty/ (still internal) This properly separates the libraries developed here from the (now clearly) third-part software that we build at the same time. There is still no install script for these libraries, they are only usable from the main CMakeLists.txt. This will change soon. --- .gitmodules | 6 +-- {imgui-builds => 3rdparty}/CMakeLists.txt | 52 +++++++++++++++++------ gl3w => 3rdparty/gl3w | 0 glm => 3rdparty/glm | 0 imgui => 3rdparty/imgui | 0 CMakeLists.txt | 8 +--- gl3w-builds/CMakeLists.txt | 12 ------ glm-builds/CMakeLists.txt | 5 --- 8 files changed, 45 insertions(+), 38 deletions(-) rename {imgui-builds => 3rdparty}/CMakeLists.txt (51%) rename gl3w => 3rdparty/gl3w (100%) rename glm => 3rdparty/glm (100%) rename imgui => 3rdparty/imgui (100%) delete mode 100644 gl3w-builds/CMakeLists.txt delete mode 100644 glm-builds/CMakeLists.txt diff --git a/.gitmodules b/.gitmodules index 0289cd5..737291f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "imgui"] - path = imgui + path = 3rdparty/imgui url = https://github.com/ocornut/imgui [submodule "glm"] - path = glm + path = 3rdparty/glm url = https://github.com/g-truc/glm [submodule "gl3w"] - path = gl3w + path = 3rdparty/gl3w url = https://github.com/skaslev/gl3w diff --git a/imgui-builds/CMakeLists.txt b/3rdparty/CMakeLists.txt similarity index 51% rename from imgui-builds/CMakeLists.txt rename to 3rdparty/CMakeLists.txt index 94d9d2c..dc1ddc9 100644 --- a/imgui-builds/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -1,20 +1,48 @@ +#--- +# gl3w +#--- + +# Use GL3W as an OpenGL loader on desktop +if(AZUR_GRAPHICS_OPENGL_3_3) + add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/gl3w/src/gl3w.c" + COMMAND ./gl3w_gen.py + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/gl3w") + add_library(gl3w gl3w/src/gl3w.c) + target_include_directories(gl3w PUBLIC gl3w/include) + # Link with GLX for GL3W to find the extensions, and -ldl + target_link_libraries(gl3w INTERFACE PkgConfig::glx -ldl) +endif() + +#--- +# GLM +#--- + +# Define the header-only library +add_library(glm INTERFACE) + +# Set the include directory +target_include_directories(glm INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/glm") + +#--- # The Dear ImGui library for SDL + OpenGL3/OpenGLES2 +#--- + set(SOURCES - ../imgui/imgui.cpp - ../imgui/imgui_demo.cpp - ../imgui/imgui_draw.cpp - ../imgui/imgui_tables.cpp - ../imgui/imgui_widgets.cpp - ../imgui/backends/imgui_impl_opengl3.cpp - ../imgui/backends/imgui_impl_sdl.cpp) + imgui/imgui.cpp + imgui/imgui_demo.cpp + imgui/imgui_draw.cpp + imgui/imgui_tables.cpp + imgui/imgui_widgets.cpp + imgui/backends/imgui_impl_opengl3.cpp + imgui/backends/imgui_impl_sdl.cpp) # Use Freetype if the library is installed, or the emscripten port if(AZUR_PLATFORM_EMSCRIPTEN) - list(APPEND SOURCES ../imgui/misc/freetype/imgui_freetype.cpp) + list(APPEND SOURCES imgui/misc/freetype/imgui_freetype.cpp) else() pkg_check_modules(freetype2 freetype2 IMPORTED_TARGET) if(freetype2_FOUND) - list(APPEND SOURCES ../imgui/misc/freetype/imgui_freetype.cpp) + list(APPEND SOURCES imgui/misc/freetype/imgui_freetype.cpp) endif() endif() @@ -37,14 +65,14 @@ endif() # FreeType2 settings if(freetype2_FOUND) target_compile_definitions(imgui PUBLIC -DIMGUI_ENABLE_FREETYPE) - target_include_directories(imgui PRIVATE ../imgui/misc/freetype) + target_include_directories(imgui PRIVATE imgui/misc/freetype) target_link_libraries(imgui PUBLIC PkgConfig::freetype2) elseif(AZUR_PLATFORM_EMSCRIPTEN) target_compile_definitions(imgui PUBLIC -DIMGUI_ENABLE_FREETYPE) - target_include_directories(imgui PRIVATE ../imgui/misc/freetype) + target_include_directories(imgui PRIVATE imgui/misc/freetype) target_compile_options(imgui PUBLIC -sUSE_FREETYPE=1) target_link_options(imgui INTERFACE -sUSE_FREETYPE=1) endif() # Provide include directories -target_include_directories(imgui PUBLIC ../imgui ../imgui/backends) +target_include_directories(imgui PUBLIC imgui imgui/backends) diff --git a/gl3w b/3rdparty/gl3w similarity index 100% rename from gl3w rename to 3rdparty/gl3w diff --git a/glm b/3rdparty/glm similarity index 100% rename from glm rename to 3rdparty/glm diff --git a/imgui b/3rdparty/imgui similarity index 100% rename from imgui rename to 3rdparty/imgui diff --git a/CMakeLists.txt b/CMakeLists.txt index d1fee6a..1a16997 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,13 +112,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED TRUE) # Subdirectory selection #--- +# Exclud third-party software from the build on gint; it wouldn't work if(NOT AZUR_PLATFORM STREQUAL gint) - # This provides GL3W on desktop - add_subdirectory(gl3w-builds) - # This provides Dear ImGui - add_subdirectory(imgui-builds) - # This provide GLM - add_subdirectory(glm-builds) + add_subdirectory(3rdparty) endif() add_subdirectory(libnum) diff --git a/gl3w-builds/CMakeLists.txt b/gl3w-builds/CMakeLists.txt deleted file mode 100644 index 92be929..0000000 --- a/gl3w-builds/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Use GL3W as an OpenGL loader on desktop -if(AZUR_GRAPHICS_OPENGL_3_3) - add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/../gl3w/src/gl3w.c" - COMMAND ./gl3w_gen.py - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../gl3w") - add_library(gl3w - ../gl3w/src/gl3w.c) - target_include_directories(gl3w PUBLIC - ../gl3w/include) - # Link with GLX for GL3W to find the extensions, and -ldl - target_link_libraries(gl3w INTERFACE PkgConfig::glx -ldl) -endif() diff --git a/glm-builds/CMakeLists.txt b/glm-builds/CMakeLists.txt deleted file mode 100644 index 9ea42fb..0000000 --- a/glm-builds/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Define the header-only library -add_library(glm INTERFACE) - -# Set the include directory -target_include_directories(glm INTERFACE ../glm)