From 158672a88f52dce3a3e36f5c3826bc7290f682c5 Mon Sep 17 00:00:00 2001 From: Webster Sheets Date: Tue, 21 Nov 2023 20:44:25 -0500 Subject: [PATCH 1/4] Don't explicitly set CMake generator on linux This change allows users to select their preferred CMake Generator (e.g. Ninja) and not be forced to use Unix Makefiles - Requires bumping CMakePresets.json version to 3 for compatibility with VSCode --- CMakePresets.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 812ad8d5608..6663a2b1301 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,5 +1,5 @@ { - "version": 2, + "version": 3, "configurePresets": [ { "name": "x64-Debug", @@ -73,7 +73,6 @@ "displayName": "Linux x64 Debug", "description": "Use system compiler; Profiler=yes", "binaryDir": "${sourceDir}/build/", - "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", @@ -93,7 +92,6 @@ "displayName": "Linux x64 Profiling", "description": "Use system compiler; Profiler=yes", "binaryDir": "${sourceDir}/build/", - "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", @@ -113,7 +111,6 @@ "displayName": "Linux x64 Release", "description": "Use system compiler; Profiler=no", "binaryDir": "${sourceDir}/build/", - "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", @@ -132,7 +129,6 @@ "displayName": "Linux x64 Debug (Clang)", "description": "CC=clang CXX=clang++; Profiler=yes", "binaryDir": "${sourceDir}/build/", - "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", @@ -154,7 +150,6 @@ "displayName": "Linux x64 Profiling (Clang)", "description": "CC=clang CXX=clang++; Profiler=yes", "binaryDir": "${sourceDir}/build/", - "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", @@ -176,7 +171,6 @@ "displayName": "Linux x64 Release (Clang)", "description": "CC=clang CXX=clang++; Profiler=no", "binaryDir": "${sourceDir}/build/", - "generator": "Unix Makefiles", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": true, "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", From 7ddedccdd6aab71d5a43031c4a87020b5514c0b2 Mon Sep 17 00:00:00 2001 From: Webster Sheets Date: Tue, 21 Nov 2023 20:45:40 -0500 Subject: [PATCH 2/4] CI: build with Ninja for automatic parallelism Allows us to make maximal use of multicore runners and reduce compile times. Ninja automatically selects an appropriate parallelism level so we don't have to make changes if the underlying runner hardware changes. --- .github/workflows/build-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 5299cac4c1a..c2ccf62299c 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -28,6 +28,7 @@ env: libassimp-dev libsdl2-dev libsdl2-image-dev + ninja-build # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -100,7 +101,7 @@ jobs: - name: Setup CMake run: | cp scripts/CMakeBuildPresetsCI.json CMakeUserPresets.json - cmake --preset linux-x64-release + cmake -G Ninja --preset linux-x64-release - name: Build GCC run: cmake --build ./build --target all @@ -134,7 +135,7 @@ jobs: - name: Setup CMake run: | cp scripts/CMakeBuildPresetsCI.json CMakeUserPresets.json - cmake --preset linux-x64-release-avx + cmake -G Ninja --preset linux-x64-release-avx - name: Build GCC run: cmake --build ./build --target all @@ -171,7 +172,7 @@ jobs: run: | cp scripts/CMakeBuildPresetsCI.json CMakeUserPresets.json export CC=clang CXX=clang++ - cmake --preset linux-x64-release + cmake -G Ninja --preset linux-x64-release - name: Build Clang run: cmake --build ./build --target all From dcc27dc66937e79fedf232be2acf21afeb434edb Mon Sep 17 00:00:00 2001 From: Webster Sheets Date: Tue, 21 Nov 2023 20:50:16 -0500 Subject: [PATCH 3/4] Update clang-format version used by CI --- .github/workflows/clang-format.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 80486373e22..161af380158 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -19,8 +19,7 @@ jobs: clang-format-check: timeout-minutes: 5 - # Ubuntu 18.04 at the time of writing includes clang-format-9 as default - runs-on: [ubuntu-20.04] + runs-on: ubuntu-latest # We want to check all changed files between the pull-request base and the head of the pull request env: From c410eb316494855118b2d4e13a032947f6251841 Mon Sep 17 00:00:00 2001 From: Webster Sheets Date: Tue, 24 Oct 2023 01:44:56 -0400 Subject: [PATCH 4/4] ModelViewer: make PostRender an extension delegate --- src/editor/ModelViewerWidget.cpp | 2 +- src/editor/ModelViewerWidget.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/editor/ModelViewerWidget.cpp b/src/editor/ModelViewerWidget.cpp index a1753715c1e..bc70a4404df 100644 --- a/src/editor/ModelViewerWidget.cpp +++ b/src/editor/ModelViewerWidget.cpp @@ -484,7 +484,7 @@ void ModelViewerWidget::OnRender(Graphics::Renderer *r) } // Render any extra effects - PostRender(); + m_extPostRender(); // helper rendering if (m_options.showLandingPad) { diff --git a/src/editor/ModelViewerWidget.h b/src/editor/ModelViewerWidget.h index c3b6de20b90..c2d756dbcb1 100644 --- a/src/editor/ModelViewerWidget.h +++ b/src/editor/ModelViewerWidget.h @@ -89,6 +89,8 @@ namespace Editor const matrix4x4f &GetModelViewMat() const { return m_modelViewMat; } + // Extend to render in-world using Graphics::Renderer + UIDelegate &GetUIExtPostRender() { return m_extPostRender; } // Extend to render on top of the viewport surface using ImDrawList UIDelegate &GetUIExtOverlay() { return m_extOverlay; } // Extend to add additional viewport menu buttons @@ -105,8 +107,7 @@ namespace Editor bool OnCloseRequested() override { return true; }; - virtual void PostRender() {}; - + UIDelegate m_extPostRender; UIDelegate m_extOverlay; UIDelegate m_extMenus; UIDelegate m_extViewportControls;