From 63226b7e9f81229d53fdde4deacffac01c781679 Mon Sep 17 00:00:00 2001 From: Kingstom Date: Wed, 25 Oct 2023 11:14:20 +0800 Subject: [PATCH] code refine --- CMakeLists.txt | 13 +- cmake/AphExternal.cmake | 24 +- engine/CMakeLists.txt | 43 +- external/imgui/.gitattributes | 30 -- external/imgui/.github/FUNDING.yml | 1 - external/imgui/.github/issue_template.md | 46 -- .../imgui/.github/pull_request_template.md | 6 - external/imgui/.github/workflows/build.yml | 507 ------------------ .../imgui/.github/workflows/scheduled.yml | 15 - .../.github/workflows/static-analysis.yml | 46 -- external/imgui/.gitignore | 59 -- external/imgui/CMakeLists.txt | 11 + 12 files changed, 48 insertions(+), 753 deletions(-) delete mode 100644 external/imgui/.gitattributes delete mode 100644 external/imgui/.github/FUNDING.yml delete mode 100644 external/imgui/.github/issue_template.md delete mode 100644 external/imgui/.github/pull_request_template.md delete mode 100644 external/imgui/.github/workflows/build.yml delete mode 100644 external/imgui/.github/workflows/scheduled.yml delete mode 100644 external/imgui/.github/workflows/static-analysis.yml delete mode 100644 external/imgui/.gitignore create mode 100644 external/imgui/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index d985625a..00b8cb9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,14 +2,17 @@ cmake_minimum_required(VERSION 3.24) project(Aphrodite) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/") +set(APH_OUTPUT_DIR ${CMAKE_BINARY_DIR}/bin) +set(APH_ROOT_DIR ${CMAKE_SOURCE_DIR}) +set(APH_EXAMPLES_DIR ${APH_ROOT_DIR}/examples) +set(APH_ENGINE_DIR ${APH_ROOT_DIR}/engine) +set(APH_EXTERNAL_DIR ${APH_ROOT_DIR}/external) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${APH_ROOT_DIR}/cmake") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${APH_OUTPUT_DIR}") include(AphCompilerOptions) include(AphExternal) add_subdirectory(engine) add_subdirectory(examples) - -find_package(PkgConfig REQUIRED) -pkg_check_modules(xcb REQUIRED IMPORTED_TARGET xcb) diff --git a/cmake/AphExternal.cmake b/cmake/AphExternal.cmake index 856c7ee1..6c937c4a 100644 --- a/cmake/AphExternal.cmake +++ b/cmake/AphExternal.cmake @@ -19,25 +19,27 @@ set(SHADERC_SKIP_INSTALL ON CACHE BOOL "" FORCE) set(SHADERC_SKIP_TESTS ON CACHE BOOL "" FORCE) set(SHADERC_SKIP_EXAMPLES ON CACHE BOOL "" FORCE) set(SHADERC_SKIP_COPYRIGHT_CHECK ON CACHE BOOL "" FORCE) -set(SHADERC_THIRD_PARTY_ROOT_DIR "${CMAKE_SOURCE_DIR}/external" CACHE STRING "Third party path." FORCE) +set(SHADERC_THIRD_PARTY_ROOT_DIR "${APH_EXTERNAL_DIR}" CACHE STRING "Third party path." FORCE) # mimalloc set(MI_BUILD_SHARED OFF CACHE BOOL "" FORCE) set(MI_BUILD_OBJECT OFF CACHE BOOL "" FORCE) set(MI_BUILD_STATIC ON CACHE BOOL "" FORCE) - -# glfw -set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) +# glfw set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) -add_subdirectory(external) -add_subdirectory(external/mimalloc EXCLUDE_FROM_ALL) -add_subdirectory(external/glfw EXCLUDE_FROM_ALL) -add_subdirectory(external/reckless EXCLUDE_FROM_ALL) -add_subdirectory(external/volk EXCLUDE_FROM_ALL) -add_subdirectory(external/spirv-cross EXCLUDE_FROM_ALL) -add_subdirectory(external/shaderc EXCLUDE_FROM_ALL) +add_subdirectory(${APH_EXTERNAL_DIR}) +add_subdirectory(${APH_EXTERNAL_DIR}/mimalloc EXCLUDE_FROM_ALL) +add_subdirectory(${APH_EXTERNAL_DIR}/glfw EXCLUDE_FROM_ALL) +add_subdirectory(${APH_EXTERNAL_DIR}/reckless EXCLUDE_FROM_ALL) +add_subdirectory(${APH_EXTERNAL_DIR}/volk EXCLUDE_FROM_ALL) +add_subdirectory(${APH_EXTERNAL_DIR}/spirv-cross EXCLUDE_FROM_ALL) +add_subdirectory(${APH_EXTERNAL_DIR}/shaderc EXCLUDE_FROM_ALL) +add_subdirectory(${APH_EXTERNAL_DIR}/imgui EXCLUDE_FROM_ALL) # add_subdirectory(external/mmgr EXCLUDE_FROM_ALL) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(xcb REQUIRED IMPORTED_TARGET xcb) diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index ab6f1bd7..a122ea28 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -1,4 +1,3 @@ -message("source dir ${CMAKE_SOURCE_DIR}") file(GLOB base_src common/*.cpp input/*.cpp @@ -18,38 +17,28 @@ file(GLOB base_src ) -add_library(imgui SHARED - ${CMAKE_SOURCE_DIR}/external/imgui/imgui.cpp - ${CMAKE_SOURCE_DIR}/external/imgui/imgui_demo.cpp - ${CMAKE_SOURCE_DIR}/external/imgui/imgui_draw.cpp - ${CMAKE_SOURCE_DIR}/external/imgui/imgui_tables.cpp - ${CMAKE_SOURCE_DIR}/external/imgui/imgui_widgets.cpp - ${CMAKE_SOURCE_DIR}/external/imgui/imgui_impl_glfw.cpp - ${CMAKE_SOURCE_DIR}/external/imgui/imgui_impl_vulkan.cpp -) - add_library(engine STATIC ${base_src}) aph_compiler_options(engine) target_include_directories(engine SYSTEM PUBLIC - ../external/glm - ../external/reckless/reckless/include - ../external/tinyimageformat - ../external/volk + ${APH_EXTERNAL_DIR}/glm + ${APH_EXTERNAL_DIR}/reckless/reckless/include + ${APH_EXTERNAL_DIR}/tinyimageformat + ${APH_EXTERNAL_DIR}/volk PRIVATE - ./ - ../external/backward-cpp/include - ../external/mmgr - ../external/glfw/include - ../external/shaderc/libshaderc/include - ../external/imgui - ../external/vulkan - ../external/stb/include - ../external/tinygltf/include - ../external/spirv-cross - ../external/tinyktx - ../external/tinydds + ${APH_ENGINE_DIR} + ${APH_EXTERNAL_DIR}/backward-cpp/include + ${APH_EXTERNAL_DIR}/mmgr + ${APH_EXTERNAL_DIR}/glfw/include + ${APH_EXTERNAL_DIR}/shaderc/libshaderc/include + ${APH_EXTERNAL_DIR}/imgui + ${APH_EXTERNAL_DIR}/vulkan + ${APH_EXTERNAL_DIR}/stb/include + ${APH_EXTERNAL_DIR}/tinygltf/include + ${APH_EXTERNAL_DIR}/spirv-cross + ${APH_EXTERNAL_DIR}/tinyktx + ${APH_EXTERNAL_DIR}/tinydds ) target_link_libraries(engine PRIVATE diff --git a/external/imgui/.gitattributes b/external/imgui/.gitattributes deleted file mode 100644 index d48470ee..00000000 --- a/external/imgui/.gitattributes +++ /dev/null @@ -1,30 +0,0 @@ -* text=auto - -*.c text -*.cpp text -*.h text -*.m text -*.mm text -*.md text -*.txt text -*.html text -*.bat text -*.frag text -*.vert text -*.mkb text -*.icf text - -*.sln text eol=crlf -*.vcxproj text eol=crlf -*.vcxproj.filters text eol=crlf -*.natvis text eol=crlf - -Makefile text eol=lf -*.sh text eol=lf -*.pbxproj text eol=lf -*.storyboard text eol=lf -*.plist text eol=lf - -*.png binary -*.ttf binary -*.lib binary diff --git a/external/imgui/.github/FUNDING.yml b/external/imgui/.github/FUNDING.yml deleted file mode 100644 index 2aa08b44..00000000 --- a/external/imgui/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -custom: ['https://github.com/ocornut/imgui/wiki/Sponsors'] diff --git a/external/imgui/.github/issue_template.md b/external/imgui/.github/issue_template.md deleted file mode 100644 index 0172e093..00000000 --- a/external/imgui/.github/issue_template.md +++ /dev/null @@ -1,46 +0,0 @@ -(Click "Preview" above ^ to turn URL into clickable links) - -1. FOR FIRST-TIME USERS PROBLEMS COMPILING/LINKING/RUNNING or LOADING FONTS, please use [GitHub Discussions](https://github.com/ocornut/imgui/discussions). EVERYTHING ELSE CAN BE POSTED HERE! - -2. PLEASE CAREFULLY READ: [FAQ](https://github.com/ocornut/imgui/blob/master/docs/FAQ.md) - -3. PLEASE CAREFULLY READ: [Contributing Guidelines](https://github.com/ocornut/imgui/blob/master/docs/CONTRIBUTING.md) - -4. PLEASE MAKE SURE that you have: read the FAQ; explored the contents of `ShowDemoWindow()` including the Examples menu; searched among Issues; used your IDE to search for keywords in all sources and text files; and read the links above. - -5. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users. - -6. Delete points 1-6 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue. - -Thank you! - ----- - -_(you may also go to Demo>About Window, and click "Config/Build Information" to obtain a bunch of detailed information that you can paste here)_ - -**Version/Branch of Dear ImGui:** - -Version: XXX -Branch: XXX _(master/viewport/docking/etc.)_ - -**Back-end/Renderer/Compiler/OS** - -Back-ends: imgui_impl_XXX.cpp + imgui_impl_XXX.cpp _(or specify if using a custom engine/back-end)_ -Compiler: XXX _(if the question is related to building or platform specific features)_ -Operating System: XXX - -**My Issue/Question:** - -XXX _(please provide as much context as possible)_ - -**Screenshots/Video** - -XXX _(you can drag files here)_ - -**Standalone, minimal, complete and verifiable example:** _(see https://github.com/ocornut/imgui/issues/2261)_ -``` -// Here's some code anyone can copy and paste to reproduce your issue -ImGui::Begin("Example Bug"); -MoreCodeToExplainMyIssue(); -ImGui::End(); -``` diff --git a/external/imgui/.github/pull_request_template.md b/external/imgui/.github/pull_request_template.md deleted file mode 100644 index 638545bd..00000000 --- a/external/imgui/.github/pull_request_template.md +++ /dev/null @@ -1,6 +0,0 @@ -(Click "Preview" to turn any http URL into a clickable link) - -1. PLEASE CAREFULLY READ: [Contributing Guidelines](https://github.com/ocornut/imgui/blob/master/docs/CONTRIBUTING.md) - -2. Clear this template before submitting your PR. - diff --git a/external/imgui/.github/workflows/build.yml b/external/imgui/.github/workflows/build.yml deleted file mode 100644 index 45688c47..00000000 --- a/external/imgui/.github/workflows/build.yml +++ /dev/null @@ -1,507 +0,0 @@ -name: build - -on: - push: - pull_request: - workflow_run: - # Use a workflow as a trigger of scheduled builds. Forked repositories can disable scheduled builds by disabling - # "scheduled" workflow, while maintaining ability to perform local CI builds. - workflows: - - scheduled - branches: - - master - - docking - types: - - requested - -jobs: - Windows: - runs-on: windows-2019 - env: - VS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\ - MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\ - steps: - - uses: actions/checkout@v3 - - - name: Install Dependencies - shell: powershell - run: | - Invoke-WebRequest -Uri "https://www.libsdl.org/release/SDL2-devel-2.26.3-VC.zip" -OutFile "SDL2-devel-2.26.3-VC.zip" - Expand-Archive -Path SDL2-devel-2.26.3-VC.zip - echo "SDL2_DIR=$(pwd)\SDL2-devel-2.26.3-VC\SDL2-2.26.3\" >>${env:GITHUB_ENV} - - Invoke-WebRequest -Uri "https://github.com/ocornut/imgui/files/3789205/vulkan-sdk-1.1.121.2.zip" -OutFile vulkan-sdk-1.1.121.2.zip - Expand-Archive -Path vulkan-sdk-1.1.121.2.zip - echo "VULKAN_SDK=$(pwd)\vulkan-sdk-1.1.121.2\" >>${env:GITHUB_ENV} - - - name: Fix Projects - shell: powershell - run: | - # CI workers do not supporter older Visual Studio versions. Fix projects to target newer available version. - gci -recurse -filter "*.vcxproj" | ForEach-Object { - (Get-Content $_.FullName) -Replace "v\d{3}","v142" | Set-Content -Path $_.FullName - (Get-Content $_.FullName) -Replace "[\d\.]+","10.0.18362.0" | Set-Content -Path $_.FullName - } - - # Not using matrix here because it would inflate job count too much. Check out and setup is done for every job and that makes build times way too long. - - name: Build example_null (extra warnings, mingw 64-bit) - run: mingw32-make -C examples/example_null WITH_EXTRA_WARNINGS=1 - - - name: Build example_null (mingw 64-bit, as DLL) - shell: bash - run: | - echo '#ifdef _EXPORT' > example_single_file.cpp - echo '# define IMGUI_API __declspec(dllexport)' >> example_single_file.cpp - echo '#else' >> example_single_file.cpp - echo '# define IMGUI_API __declspec(dllimport)' >> example_single_file.cpp - echo '#endif' >> example_single_file.cpp - echo '#define IMGUI_IMPLEMENTATION' >> example_single_file.cpp - echo '#include "misc/single_file/imgui_single_file.h"' >> example_single_file.cpp - g++ -I. -Wall -Wformat -D_EXPORT -shared -o libimgui.dll -Wl,--out-implib,libimgui.a example_single_file.cpp -limm32 - g++ -I. -Wall -Wformat -o example_null.exe examples/example_null/main.cpp -L. -limgui - rm -f example_null.exe libimgui.* example_single_file.* - - - name: Build example_null (extra warnings, msvc 64-bit) - shell: cmd - run: | - cd examples\example_null - call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" - .\build_win32.bat /W4 - - - name: Build example_null (single file build) - shell: bash - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32 - - - name: Build example_null (with IMGUI_DISABLE_WIN32_FUNCTIONS) - shell: bash - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_DISABLE_WIN32_FUNCTIONS - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32 - - - name: Build example_null (as DLL) - shell: cmd - run: | - call "%VS_PATH%\VC\Auxiliary\Build\vcvars64.bat" - - echo #ifdef _EXPORT > example_single_file.cpp - echo # define IMGUI_API __declspec(dllexport) >> example_single_file.cpp - echo #else >> example_single_file.cpp - echo # define IMGUI_API __declspec(dllimport) >> example_single_file.cpp - echo #endif >> example_single_file.cpp - echo #define IMGUI_IMPLEMENTATION >> example_single_file.cpp - echo #include "misc/single_file/imgui_single_file.h" >> example_single_file.cpp - - cl.exe /D_USRDLL /D_WINDLL /D_EXPORT /I. example_single_file.cpp /LD /FeImGui.dll /link - cl.exe /I. ImGui.lib /Feexample_null.exe examples/example_null/main.cpp - - - name: Build Win32 example_glfw_opengl2 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' - - - name: Build Win32 example_glfw_opengl3 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build Win32 example_glfw_vulkan - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build Win32 example_sdl2_vulkan - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=Win32 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build Win32 example_sdl2_opengl2 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=Win32 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build Win32 example_sdl2_opengl3 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=Win32 /p:Configuration=Release' - - - name: Build Win32 example_sdl2_directx11 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build Win32 example_win32_directx9 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=Win32 /p:Configuration=Release' - - - name: Build Win32 example_win32_directx10 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=Win32 /p:Configuration=Release' - - - name: Build Win32 example_win32_directx11 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=Win32 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_glfw_opengl2 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl2/example_glfw_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_glfw_opengl3 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_opengl3/example_glfw_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release' - - - name: Build x64 example_glfw_vulkan - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_glfw_vulkan/example_glfw_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' - - - name: Build x64 example_sdl2_vulkan - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_vulkan/example_sdl2_vulkan.vcxproj /p:Platform=x64 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_sdl2_opengl2 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl2/example_sdl2_opengl2.vcxproj /p:Platform=x64 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_sdl2_opengl3 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_opengl3/example_sdl2_opengl3.vcxproj /p:Platform=x64 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_sdl2_directx11 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_sdl2_directx11/example_sdl2_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release' - - - name: Build x64 example_win32_directx9 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx9/example_win32_directx9.vcxproj /p:Platform=x64 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_win32_directx10 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx10/example_win32_directx10.vcxproj /p:Platform=x64 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_win32_directx11 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx11/example_win32_directx11.vcxproj /p:Platform=x64 /p:Configuration=Release' - if: github.event_name == 'workflow_run' - - - name: Build x64 example_win32_directx12 - shell: cmd - run: '"%MSBUILD_PATH%\MSBuild.exe" examples/example_win32_directx12/example_win32_directx12.vcxproj /p:Platform=x64 /p:Configuration=Release' - - Linux: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y libglfw3-dev libsdl2-dev gcc-multilib g++-multilib libfreetype6-dev libvulkan-dev - - - name: Build example_null (extra warnings, gcc 32-bit) - run: | - make -C examples/example_null clean - CXXFLAGS="$CXXFLAGS -m32 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1 - - - name: Build example_null (extra warnings, gcc 64-bit) - run: | - make -C examples/example_null clean - CXXFLAGS="$CXXFLAGS -m64 -Werror" make -C examples/example_null WITH_EXTRA_WARNINGS=1 - - - name: Build example_null (extra warnings, clang 32-bit) - run: | - make -C examples/example_null clean - CXXFLAGS="$CXXFLAGS -m32 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1 - - - name: Build example_null (extra warnings, clang 64-bit) - run: | - make -C examples/example_null clean - CXXFLAGS="$CXXFLAGS -m64 -Werror" CXX=clang++ make -C examples/example_null WITH_EXTRA_WARNINGS=1 - - - name: Build example_null (extra warnings, empty IM_ASSERT) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IM_ASSERT(x) - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -Wextra -Werror -Wno-zero-as-null-pointer-constant -Wno-double-promotion -Wno-variadic-macros -Wno-empty-body -o example_single_file example_single_file.cpp - - - name: Build example_null (freetype) - run: | - make -C examples/example_null clean - make -C examples/example_null WITH_FREETYPE=1 - - - name: Build example_null (single file build) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with ImWchar32) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_USE_WCHAR32 - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with large ImDrawIdx + pointer ImTextureID) - run: | - cat > example_single_file.cpp <<'EOF' - - #define ImTextureID void* - #define ImDrawIdx unsigned int - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_FUNCTIONS) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with IMGUI_DISABLE_OBSOLETE_KEYIO) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_DISABLE_OBSOLETE_KEYIO - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with IMGUI_DISABLE_DEMO_WINDOWS and IMGUI_DISABLE_DEBUG_TOOLS) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_DISABLE_DEMO_WINDOWS - #define IMGUI_DISABLE_DEBUG_TOOLS - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with IMGUI_DISABLE_FILE_FUNCTIONS) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_DISABLE_FILE_FUNCTIONS - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with IMGUI_USE_BGRA_PACKED_COLOR) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_USE_BGRA_PACKED_COLOR - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (with IM_VEC2_CLASS_EXTRA and IM_VEC4_CLASS_EXTRA) - run: | - cat > example_single_file.cpp <<'EOF' - - struct MyVec2 { float x; float y; MyVec2(float x, float y) : x(x), y(y) { } }; - struct MyVec4 { float x; float y; float z; float w; - MyVec4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) { } }; - #define IM_VEC2_CLASS_EXTRA \ - ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ - operator MyVec2() const { return MyVec2(x, y); } - #define IM_VEC4_CLASS_EXTRA \ - ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ - operator MyVec4() const { return MyVec4(x, y, z, w); } - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - g++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (without c++ runtime, Clang) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_IMPLEMENTATION - #define IMGUI_DISABLE_DEMO_WINDOWS - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp - - - name: Build example_glfw_opengl2 - run: make -C examples/example_glfw_opengl2 - - - name: Build example_glfw_opengl3 - run: make -C examples/example_glfw_opengl3 - if: github.event_name == 'workflow_run' - - - name: Build example_sdl2_opengl2 - run: make -C examples/example_sdl2_opengl2 - if: github.event_name == 'workflow_run' - - - name: Build example_sdl2_opengl3 - run: make -C examples/example_sdl2_opengl3 - - - name: Build with IMGUI_IMPL_VULKAN_NO_PROTOTYPES - run: g++ -c -I. -std=c++11 -DIMGUI_IMPL_VULKAN_NO_PROTOTYPES=1 backends/imgui_impl_vulkan.cpp - - MacOS: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - - name: Install Dependencies - run: | - brew install glfw3 sdl2 - - - name: Build example_null (extra warnings, clang 64-bit) - run: make -C examples/example_null WITH_EXTRA_WARNINGS=1 - - - name: Build example_null (single file build) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - clang++ -I. -std=c++11 -Wall -Wformat -o example_single_file example_single_file.cpp - - - name: Build example_null (without c++ runtime) - run: | - cat > example_single_file.cpp <<'EOF' - - #define IMGUI_IMPLEMENTATION - #include "misc/single_file/imgui_single_file.h" - #include "examples/example_null/main.cpp" - - EOF - clang++ -I. -std=c++11 -Wall -Wformat -nodefaultlibs -fno-rtti -fno-exceptions -fno-threadsafe-statics -lc -lm -o example_single_file example_single_file.cpp - - - name: Build example_glfw_opengl2 - run: make -C examples/example_glfw_opengl2 - - - name: Build example_glfw_opengl3 - run: make -C examples/example_glfw_opengl3 - if: github.event_name == 'workflow_run' - - - name: Build example_glfw_metal - run: make -C examples/example_glfw_metal - - - name: Build example_sdl2_metal - run: make -C examples/example_sdl2_metal - - - name: Build example_sdl2_opengl2 - run: make -C examples/example_sdl2_opengl2 - if: github.event_name == 'workflow_run' - - - name: Build example_sdl2_opengl3 - run: make -C examples/example_sdl2_opengl3 - - - name: Build example_apple_metal - run: xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_macos - - - name: Build example_apple_opengl2 - run: xcodebuild -project examples/example_apple_opengl2/example_apple_opengl2.xcodeproj -target example_osx_opengl2 - - iOS: - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - - name: Build example_apple_metal - run: | - # Code signing is required, but we disable it because it is irrelevant for CI builds. - xcodebuild -project examples/example_apple_metal/example_apple_metal.xcodeproj -target example_apple_metal_ios CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO - - Emscripten: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - - name: Install Dependencies - run: | - wget -q https://github.com/emscripten-core/emsdk/archive/master.tar.gz - tar -xvf master.tar.gz - emsdk-master/emsdk update - emsdk-master/emsdk install latest - emsdk-master/emsdk activate latest - - - name: Build example_sdl2_opengl3 with Emscripten - run: | - pushd emsdk-master - source ./emsdk_env.sh - popd - make -C examples/example_sdl2_opengl3 -f Makefile.emscripten - - - name: Build example_emscripten_wgpu - run: | - pushd emsdk-master - source ./emsdk_env.sh - popd - make -C examples/example_emscripten_wgpu - - Android: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - - name: Build example_android_opengl3 - run: | - cd examples/example_android_opengl3/android - gradle assembleDebug --stacktrace diff --git a/external/imgui/.github/workflows/scheduled.yml b/external/imgui/.github/workflows/scheduled.yml deleted file mode 100644 index 2a08578f..00000000 --- a/external/imgui/.github/workflows/scheduled.yml +++ /dev/null @@ -1,15 +0,0 @@ -# -# This is a dummy workflow used to trigger scheduled builds. Forked repositories most likely should disable this -# workflow to avoid daily builds of inactive repositories. -# -name: scheduled - -on: - schedule: - - cron: '0 9 * * *' - -jobs: - scheduled: - runs-on: ubuntu-latest - steps: - - run: exit 0 diff --git a/external/imgui/.github/workflows/static-analysis.yml b/external/imgui/.github/workflows/static-analysis.yml deleted file mode 100644 index caa9b3a4..00000000 --- a/external/imgui/.github/workflows/static-analysis.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: static-analysis - -on: - workflow_run: - # Perform static analysis together with build workflow. Build triggers of "build" workflow do not need to be repeated here. - workflows: - - build - types: - - requested - -jobs: - PVS-Studio: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 1 - - - name: Install Dependencies - env: - # The Secret variable setup in GitHub must be in format: "name_or_email key", on a single line - PVS_STUDIO_LICENSE: ${{ secrets.PVS_STUDIO_LICENSE }} - run: | - if [[ "$PVS_STUDIO_LICENSE" != "" ]]; - then - wget -q https://files.viva64.com/etc/pubkey.txt - sudo apt-key add pubkey.txt - sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list - sudo apt-get update - sudo apt-get install -y pvs-studio - pvs-studio-analyzer credentials -o pvs-studio.lic $PVS_STUDIO_LICENSE - fi - - - name: PVS-Studio static analysis - run: | - if [[ ! -f pvs-studio.lic ]]; - then - echo "PVS Studio license is missing. No analysis will be performed." - echo "If you have a PVS Studio license please create a project secret named PVS_STUDIO_LICENSE with your license." - echo "You may use a free license. More information at https://www.viva64.com/en/b/0457/" - exit 0 - fi - cd examples/example_null - pvs-studio-analyzer trace -- make WITH_EXTRA_WARNINGS=1 - pvs-studio-analyzer analyze -e ../../imstb_rectpack.h -e ../../imstb_textedit.h -e ../../imstb_truetype.h -l ../../pvs-studio.lic -o pvs-studio.log - plog-converter -a 'GA:1,2;OP:1' -d V1071 -t errorfile -w pvs-studio.log diff --git a/external/imgui/.gitignore b/external/imgui/.gitignore deleted file mode 100644 index 211d21dd..00000000 --- a/external/imgui/.gitignore +++ /dev/null @@ -1,59 +0,0 @@ -## OSX artifacts -.DS_Store - -## Dear ImGui artifacts -imgui.ini - -## General build artifacts -*.o -*.obj -*.exe -examples/*/Debug/* -examples/*/Release/* -examples/*/x64/* - -## Visual Studio artifacts -.vs -ipch -*.opensdf -*.log -*.pdb -*.ilk -*.user -*.sdf -*.suo -*.VC.db -*.VC.VC.opendb - -## Getting files created in JSON/Schemas/Catalog/ from a VS2022 update -JSON/ - -## Commonly used CMake directories -build*/ - -## Xcode artifacts -project.xcworkspace -xcuserdata - -## Emscripten artifacts -examples/*.o.tmp -examples/*.out.js -examples/*.out.wasm -examples/example_glfw_opengl3/web/* -examples/example_sdl2_opengl3/web/* -examples/example_emscripten_wgpu/web/* - -## JetBrains IDE artifacts -.idea -cmake-build-* - -## Unix executables from our example Makefiles -examples/example_glfw_metal/example_glfw_metal -examples/example_glfw_opengl2/example_glfw_opengl2 -examples/example_glfw_opengl3/example_glfw_opengl3 -examples/example_glut_opengl2/example_glut_opengl2 -examples/example_null/example_null -examples/example_sdl2_metal/example_sdl2_metal -examples/example_sdl2_opengl2/example_sdl2_opengl2 -examples/example_sdl2_opengl3/example_sdl2_opengl3 -examples/example_sdl2_sdlrenderer/example_sdl2_sdlrenderer diff --git a/external/imgui/CMakeLists.txt b/external/imgui/CMakeLists.txt new file mode 100644 index 00000000..18c997e8 --- /dev/null +++ b/external/imgui/CMakeLists.txt @@ -0,0 +1,11 @@ +add_library(imgui STATIC + ${APH_EXTERNAL_DIR}/imgui/imgui.cpp + ${APH_EXTERNAL_DIR}/imgui/imgui_demo.cpp + ${APH_EXTERNAL_DIR}/imgui/imgui_draw.cpp + ${APH_EXTERNAL_DIR}/imgui/imgui_tables.cpp + ${APH_EXTERNAL_DIR}/imgui/imgui_widgets.cpp + ${APH_EXTERNAL_DIR}/imgui/imgui_impl_glfw.cpp + ${APH_EXTERNAL_DIR}/imgui/imgui_impl_vulkan.cpp +) + +target_include_directories(imgui PRIVATE ${APH_EXTERNAL_DIR}/glfw/include)