mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 05:39:19 +02:00
let betterRenderer import the modules
The module file set moves to its own eu07_modules library: a target can only consume C++20 modules by linking the target that owns them, and betterRenderer is a separate add_library. Its project includes become imports. CXX_EXTENSIONS must match across the two - a BMI built with -std=c++20 is refused by a unit compiled with -std=gnu++20.
This commit is contained in:
@@ -484,11 +484,6 @@ if (NOT WITH_OPENVR)
|
||||
list(REMOVE_ITEM MODULE_INTERFACES "${CMAKE_CURRENT_SOURCE_DIR}/vr/openvr_imp.cppm")
|
||||
endif()
|
||||
|
||||
target_sources(${PROJECT_NAME}
|
||||
PUBLIC FILE_SET CXX_MODULES
|
||||
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
FILES ${MODULE_INTERFACES})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
|
||||
|
||||
|
||||
@@ -664,6 +659,35 @@ if(WIN32 AND WITH_PYTHON)
|
||||
)
|
||||
endif()
|
||||
|
||||
# The module interface units live in their own library so that other targets --
|
||||
# betterRenderer, which is a separate add_library -- can import them. A target
|
||||
# can only consume C++20 modules by linking the target that owns the file set,
|
||||
# and the executable's own modules are not reachable that way.
|
||||
#
|
||||
# The interfaces need exactly the flags the executable was given, so they are
|
||||
# copied off it rather than restated; this has to happen after all the
|
||||
# third-party wiring above and before betterRenderer is added, or the mirrored
|
||||
# link list would point back at betterRenderer and make the dependency circular.
|
||||
add_library(eu07_modules STATIC)
|
||||
|
||||
get_target_property(EU07_INCLUDES ${PROJECT_NAME} INCLUDE_DIRECTORIES)
|
||||
get_target_property(EU07_DEFINITIONS ${PROJECT_NAME} COMPILE_DEFINITIONS)
|
||||
get_target_property(EU07_LINKS ${PROJECT_NAME} LINK_LIBRARIES)
|
||||
|
||||
target_sources(eu07_modules
|
||||
PUBLIC FILE_SET CXX_MODULES
|
||||
BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
FILES ${MODULE_INTERFACES})
|
||||
|
||||
target_include_directories(eu07_modules PUBLIC ${EU07_INCLUDES})
|
||||
target_compile_definitions(eu07_modules PUBLIC ${EU07_DEFINITIONS})
|
||||
target_link_libraries(eu07_modules PUBLIC ${EU07_LINKS})
|
||||
set_target_properties(eu07_modules PROPERTIES
|
||||
CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF
|
||||
POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} eu07_modules)
|
||||
|
||||
if (WITH_BETTER_RENDERER)
|
||||
add_subdirectory("betterRenderer")
|
||||
set_target_properties(betterRenderer betterRenderer_fsr2 betterRenderer_shaders PROPERTIES FOLDER "renderers")
|
||||
|
||||
@@ -36,6 +36,14 @@ file(GLOB_RECURSE src
|
||||
|
||||
add_library(${LIBMANUL_NAME} ${src})
|
||||
|
||||
# The project's own types reach this renderer as C++20 modules; linking the
|
||||
# target that owns the module file set is what makes them importable.
|
||||
target_link_libraries(${LIBMANUL_NAME} eu07_modules)
|
||||
# CXX_EXTENSIONS must match eu07_modules: a BMI built with -std=c++20 is
|
||||
# refused by a translation unit compiled with -std=gnu++20.
|
||||
set_target_properties(${LIBMANUL_NAME} PROPERTIES
|
||||
CXX_STANDARD 20 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
|
||||
|
||||
target_include_directories(${LIBMANUL_NAME} PUBLIC
|
||||
"renderer/include")
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "utilities/Logs.h"
|
||||
import eu07.utilities.logs;
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
#include <mutex>
|
||||
|
||||
// EU07 includes
|
||||
#include <utilities/Classes.h>
|
||||
#include <scene/scene.h>
|
||||
import eu07.utilities.classes;
|
||||
import eu07.simcore;
|
||||
|
||||
#include "nvrenderer_enums.h"
|
||||
#include "quadtree.h"
|
||||
#include "rendering/renderer.h"
|
||||
import eu07.rendering.renderer;
|
||||
#include "resource_registry.h"
|
||||
#include "environment/sky.h"
|
||||
import eu07.environment.sky;
|
||||
|
||||
namespace Rt {
|
||||
struct IRtModel;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
#include "nvrendererbackend.h"
|
||||
#include "nvtexture.h"
|
||||
#include "simulation/simulationenvironment.h"
|
||||
import eu07.simulation.simulationenvironment;
|
||||
#include "sky.h"
|
||||
|
||||
int MaEnvironment::GetCurrentSetIndex() {
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
#include "nvrenderer_vulkan.h"
|
||||
#endif
|
||||
|
||||
#include "utilities/Globals.h"
|
||||
#include "utilities/Globals_macros.h"
|
||||
import eu07.utilities.globals;
|
||||
#include "gbuffer.h"
|
||||
#include "gbufferblitpass.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "gbufferblitpass.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <utilities/Timer.h>
|
||||
import eu07.utilities.timer;
|
||||
#include <nvrhi/utils.h>
|
||||
|
||||
#include "contactshadows.h"
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
|
||||
#include <utilities/Globals.h>
|
||||
#include <utilities/Logs.h>
|
||||
#include "utilities/Globals_macros.h"
|
||||
import eu07.utilities.globals;
|
||||
import eu07.utilities.logs;
|
||||
#include <fmt/format.h>
|
||||
#include <model/material.h>
|
||||
import eu07.model.material;
|
||||
#include <parser.h>
|
||||
#include <utilities/utilities.h>
|
||||
#include "utilities/utilities_macros.h"
|
||||
import eu07.utilities.utilities;
|
||||
#include <yaml-cpp/yaml.h>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <fmt/format.h>
|
||||
#include <nvrhi/utils.h>
|
||||
|
||||
#include "utilities/Logs.h"
|
||||
import eu07.utilities.logs;
|
||||
#include "csm.h"
|
||||
#include "environment.h"
|
||||
#include "gbuffer.h"
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
|
||||
#include <model/AnimModel.h>
|
||||
#include <utilities/Logs.h>
|
||||
#include <model/Model3d.h>
|
||||
#include <utilities/Timer.h>
|
||||
#include <application/application.h>
|
||||
import eu07.simcore;
|
||||
import eu07.utilities.logs;
|
||||
import eu07.utilities.timer;
|
||||
import eu07.application.application;
|
||||
#include <nvrhi/utils.h>
|
||||
#include <simulation/simulation.h>
|
||||
import eu07.simulation.simulation;
|
||||
|
||||
#include <future>
|
||||
#include <glm/gtx/transform.hpp>
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "utilities/Globals.h"
|
||||
#include "utilities/Logs.h"
|
||||
#include "utilities/Globals_macros.h"
|
||||
import eu07.utilities.globals;
|
||||
import eu07.utilities.logs;
|
||||
#include "config.h"
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "utilities/Globals.h"
|
||||
#include "utilities/Logs.h"
|
||||
#include "utilities/Globals_macros.h"
|
||||
import eu07.utilities.globals;
|
||||
import eu07.utilities.logs;
|
||||
#include "config.h"
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "nvrendererbackend.h"
|
||||
|
||||
#include "utilities/Logs.h"
|
||||
import eu07.utilities.logs;
|
||||
#include <fmt/format.h>
|
||||
|
||||
void NvRendererMessageCallback::message(nvrhi::MessageSeverity severity,
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#include "nvtexture.h"
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
|
||||
#include <utilities/Globals.h>
|
||||
#include <scripting/PyInt.h>
|
||||
#include <application/application.h>
|
||||
#include <utilities/dictionary.h>
|
||||
#include "utilities/Globals_macros.h"
|
||||
import eu07.utilities.globals;
|
||||
import eu07.scripting.pyint;
|
||||
import eu07.application.application;
|
||||
import eu07.utilities.dictionary;
|
||||
#include <fmt/format.h>
|
||||
#include <utilities/utilities.h>
|
||||
#include "utilities/utilities_macros.h"
|
||||
import eu07.utilities.utilities;
|
||||
|
||||
#include "utilities/Logs.h"
|
||||
import eu07.utilities.logs;
|
||||
// #include "Texture.h"
|
||||
#include "nvrendererbackend.h"
|
||||
#include "stbi/stb_image.h"
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
#include <nvrhi/nvrhi.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include "interfaces/ITexture.h"
|
||||
#include "global_include/interfaces/ITexture_macros.h"
|
||||
import eu07.global_include.interfaces.itexture;
|
||||
#include "nvrenderer/nvrenderer_enums.h"
|
||||
|
||||
enum MaTextureTraits {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "nvrenderer/resource_registry.h"
|
||||
|
||||
#include "utilities/Logs.h"
|
||||
import eu07.utilities.logs;
|
||||
#include "fmt/compile.h"
|
||||
#include "nvtexture.h"
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "model/Model3d.h"
|
||||
import eu07.simcore;
|
||||
|
||||
namespace Rt {
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "environment.h"
|
||||
#include "nvrendererbackend.h"
|
||||
#include "simulation/simulationenvironment.h"
|
||||
#include "simulation/simulationtime.h"
|
||||
import eu07.simulation.simulationenvironment;
|
||||
import eu07.simulation.simulationtime;
|
||||
|
||||
namespace {
|
||||
static const float PI = 3.14159265358979323846f;
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
#include "nvrenderer/nvrenderer.h"
|
||||
#include "nvrendererbackend.h"
|
||||
|
||||
#include <utilities/Timer.h>
|
||||
#include <model/AnimModel.h>
|
||||
#include <simulation/simulation.h>
|
||||
import eu07.utilities.timer;
|
||||
import eu07.simcore;
|
||||
import eu07.simulation.simulation;
|
||||
|
||||
namespace BatchingUtils {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user