Enable unity build on modules that support it

This commit is contained in:
Jérôme Leclercq 2022-03-13 13:09:42 +01:00
parent bf44672354
commit 0a4fd8f56d
10 changed files with 62 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <ShaderNode/Enums.hpp>
#include <QtWidgets/QDialog>

View File

@ -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 <ShaderNode/Enums.hpp>
#include <QtWidgets/QDialog>

View File

@ -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/**")

View File

@ -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

View File

@ -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")