diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 6ff96aadd..f5373358e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -66,7 +66,7 @@ jobs: # Setup compilation mode and install project dependencies - name: Configure xmake and install dependencies - run: xmake config --shadernodes=y --tests=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes + run: xmake config --shadernodes=y --tests=y --unitybuild=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes # Build the engine - name: Build Nazara diff --git a/.github/workflows/linux-build-sanitizer.yml b/.github/workflows/linux-build-sanitizer.yml index 529d9c7da..2ada09d3c 100644 --- a/.github/workflows/linux-build-sanitizer.yml +++ b/.github/workflows/linux-build-sanitizer.yml @@ -79,7 +79,7 @@ jobs: # Configure xmake with honggfuzz to build the engine - name: Configure xmake with honggfuzz - run: xmake config --shadernodes=y --tests=y --arch=${{ matrix.arch }} --mode=fuzz --verbose --toolchain=hfuzz-clang + run: xmake config --shadernodes=y --tests=y --unitybuild=y --arch=${{ matrix.arch }} --mode=fuzz --verbose --toolchain=hfuzz-clang # Build the engine - name: Build Nazara diff --git a/.github/workflows/linux-build.yml b/.github/workflows/linux-build.yml index b108228b6..6087cf8b5 100644 --- a/.github/workflows/linux-build.yml +++ b/.github/workflows/linux-build.yml @@ -65,7 +65,7 @@ jobs: # Setup compilation mode and install project dependencies - name: Configure xmake and install dependencies - run: xmake config --shadernodes=y --tests=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes + run: xmake config --shadernodes=y --tests=y --unitybuild=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes # Build the engine - name: Build Nazara diff --git a/.github/workflows/msys2-build.yml b/.github/workflows/msys2-build.yml index 64b2a0f78..420f1e111 100644 --- a/.github/workflows/msys2-build.yml +++ b/.github/workflows/msys2-build.yml @@ -74,7 +74,7 @@ jobs: # Setup compilation mode and install project dependencies - name: Configure xmake and install dependencies - run: xmake config --shadernodes=y --tests=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes + run: xmake config --shadernodes=y --tests=y --unitybuild=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes # Build the engine - name: Build Nazara diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 8949fc64a..44c3f1769 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -57,7 +57,7 @@ jobs: # Setup compilation mode and install project dependencies - name: Configure xmake and install dependencies - run: xmake.exe config --shadernodes=y --tests=y --usepch=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes + run: xmake.exe config --shadernodes=y --tests=y --usepch=y --unitybuild=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes # Build the engine - name: Build Nazara diff --git a/src/ShaderNode/Widgets/ShaderInfoDialog.hpp b/src/ShaderNode/Widgets/ShaderInfoDialog.hpp index 210323a8e..4c53e3ba0 100644 --- a/src/ShaderNode/Widgets/ShaderInfoDialog.hpp +++ b/src/ShaderNode/Widgets/ShaderInfoDialog.hpp @@ -1,7 +1,7 @@ #pragma once -#ifndef NAZARA_SHADERNODES_BUFFEREDITDIALOG_HPP -#define NAZARA_SHADERNODES_BUFFEREDITDIALOG_HPP +#ifndef NAZARA_SHADERNODES_SHADERINFODIALOG_HPP +#define NAZARA_SHADERNODES_SHADERINFODIALOG_HPP #include #include diff --git a/src/ShaderNode/Widgets/StructMemberEditDialog.hpp b/src/ShaderNode/Widgets/StructMemberEditDialog.hpp index e482766dc..c99077cfb 100644 --- a/src/ShaderNode/Widgets/StructMemberEditDialog.hpp +++ b/src/ShaderNode/Widgets/StructMemberEditDialog.hpp @@ -1,7 +1,7 @@ #pragma once -#ifndef NAZARA_SHADERNODES_OUTPUTEDITDIALOG_HPP -#define NAZARA_SHADERNODES_OUTPUTEDITDIALOG_HPP +#ifndef NAZARA_SHADERNODES_STRUCTMEMBEREDITODIALOG_HPP +#define NAZARA_SHADERNODES_STRUCTMEMBEREDITODIALOG_HPP #include #include diff --git a/tests/xmake.lua b/tests/xmake.lua index 99be3e96f..dbf8ffd12 100644 --- a/tests/xmake.lua +++ b/tests/xmake.lua @@ -24,16 +24,20 @@ if has_config("tests") then add_files("Engine/**.cpp") add_includedirs(".") + if has_config("unitybuild") then + add_rules("c++.unity_build") + end + target("NazaraClientUnitTests") add_deps("NazaraAudio") - add_files("main_client.cpp") + add_files("main_client.cpp", {unity_ignored = true}) if has_config("usepch") then set_pcxxheader("Engine/ClientModules.hpp") end target("NazaraUnitTests") - add_files("main.cpp") + add_files("main.cpp", {unity_ignored = true}) remove_headerfiles("Engine/Audio/**") remove_files("Engine/Audio/**") diff --git a/tools/xmake.lua b/tools/xmake.lua index 4b4ad2166..0208f5eb1 100644 --- a/tools/xmake.lua +++ b/tools/xmake.lua @@ -110,8 +110,13 @@ if has_config("shadernodes") then add_cxflags("-fPIC") end + if has_config("unitybuild") then + add_rules("c++.unity_build") + end + add_includedirs("../src") add_headerfiles("../src/ShaderNode/**.hpp", "../src/ShaderNode/**.inl") add_files("../src/ShaderNode/**.cpp") + add_files("../src/ShaderNode/Previews/PreviewValues.cpp", {unity_ignored = true}) -- fixes an issue with MSVC and operator* end diff --git a/xmake.lua b/xmake.lua index a0b1797b7..30da6938a 100644 --- a/xmake.lua +++ b/xmake.lua @@ -35,6 +35,10 @@ local modules = { remove_files("src/Nazara/Network/Posix/SocketPollerImpl.hpp") remove_files("src/Nazara/Network/Posix/SocketPollerImpl.cpp") end + + if has_config("unitybuild") then + add_rules("c++.unity_build") + end end }, OpenGLRenderer = { @@ -50,15 +54,29 @@ local modules = { if not is_plat("linux") then remove_files("src/Nazara/OpenGLRenderer/Wrapper/Linux/**.cpp") end + + if has_config("unitybuild") then + add_rules("c++.unity_build") + end end }, Physics2D = { Deps = {"NazaraUtility"}, - Packages = {"chipmunk2d"} + Packages = {"chipmunk2d"}, + Custom = function() + if has_config("unitybuild") then + add_rules("c++.unity_build") + end + end }, Physics3D = { Deps = {"NazaraUtility"}, - Packages = {"entt", "newtondynamics"} + Packages = {"entt", "newtondynamics"}, + Custom = function() + if has_config("unitybuild") then + add_rules("c++.unity_build") + end + end }, Platform = { Deps = {"NazaraUtility"}, @@ -75,7 +93,12 @@ local modules = { end }, Renderer = { - Deps = {"NazaraPlatform", "NazaraShader"} + Deps = {"NazaraPlatform", "NazaraShader"}, + Custom = function() + if has_config("unitybuild") then + add_rules("c++.unity_build") + end + end }, Shader = { Deps = {"NazaraUtility"} @@ -97,11 +120,20 @@ local modules = { elseif is_plat("macosx") then add_defines("VK_USE_PLATFORM_MACOS_MVK") end + + if has_config("unitybuild") then + add_rules("c++.unity_build") + end end }, Widgets = { Deps = {"NazaraGraphics"}, - Packages = {"entt", "kiwisolver"} + Packages = {"entt", "kiwisolver"}, + Custom = function() + if has_config("unitybuild") then + add_rules("c++.unity_build") + end + end } } @@ -115,6 +147,12 @@ option("usepch") set_description("Use precompiled headers to speedup compilation") option_end() +option("unitybuild") + set_default(false) + set_showmenu(true) + set_description("Build the engine using unity build") +option_end() + set_project("NazaraEngine") set_xmakever("2.6.3")