Skip to content

Commit

Permalink
Use target definition instead of vtkF3DConfigure.h (#1783)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal authored Dec 12, 2024
1 parent cd29ebe commit 9d08a55
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 39 deletions.
5 changes: 0 additions & 5 deletions application/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ if (F3D_MODULE_EXR)
target_compile_definitions(f3d PRIVATE F3D_MODULE_EXR)
endif ()

# ui
if (F3D_MODULE_UI)
target_compile_definitions(f3d PRIVATE F3D_MODULE_UI)
endif ()

if(VTK_VERSION VERSION_LESS 9.3.20240914)
# Headless EGL build
if (VTK_OPENGL_HAS_EGL)
Expand Down
15 changes: 15 additions & 0 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,21 @@ target_link_libraries(libf3d PRIVATE ${F3D_VTK_MODULES} ${F3D_STATIC_PLUGIN_TARG
target_compile_options(libf3d PUBLIC ${f3d_compile_options_public} PRIVATE ${f3d_compile_options_private})
target_link_options(libf3d PUBLIC ${f3d_link_options_public})

# exr
if (F3D_MODULE_EXR)
target_compile_definitions(libf3d PRIVATE F3D_MODULE_EXR)
endif ()

# ui
if (F3D_MODULE_UI)
target_compile_definitions(libf3d PRIVATE F3D_MODULE_UI)
endif ()

# raytracing
if (F3D_MODULE_RAYTRACING)
target_compile_definitions(libf3d PRIVATE F3D_MODULE_RAYTRACING)
endif ()

if(F3D_STRICT_BUILD AND MSVC)
# There are warnings in VTK related to deprecated features in C++17
target_compile_definitions(libf3d PRIVATE _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS)
Expand Down
2 changes: 0 additions & 2 deletions library/src/config.cxx.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "config.h"

#include "vtkF3DConfigure.h"

namespace f3d::detail
{
const std::string LibVersion = "@F3D_VERSION@"; // Version is synchronized with F3D
Expand Down
1 change: 0 additions & 1 deletion library/src/engine.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#include "factory.h"

#include "vtkF3DConfigure.h"
#include "vtkF3DNoRenderWindow.h"

#include <vtkVersion.h>
Expand Down
1 change: 0 additions & 1 deletion library/src/init.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "log.h"

#include "vtkF3DConfigure.h"
#include "vtkF3DObjectFactory.h"

#if F3D_MODULE_EXR
Expand Down
1 change: 0 additions & 1 deletion library/src/interactor_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "utils.h"
#include "window_impl.h"

#include "vtkF3DConfigure.h"
#include "vtkF3DConsoleOutputWindow.h"
#include "vtkF3DInteractorEventRecorder.h"
#include "vtkF3DInteractorStyle.h"
Expand Down
2 changes: 0 additions & 2 deletions library/src/options.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#include "log.h"
#include "utils.h"

#include "vtkF3DConfigure.h"

#include <algorithm>
#include <limits>
#include <string>
Expand Down
1 change: 0 additions & 1 deletion library/src/window_impl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "log.h"
#include "options.h"

#include "vtkF3DConfigure.h"
#include "vtkF3DExternalRenderWindow.h"

#include "vtkF3DGenericImporter.h"
Expand Down
4 changes: 4 additions & 0 deletions library/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ if(VTK_VERSION VERSION_GREATER_EQUAL 9.3.20240729)
target_compile_definitions(libf3dSDKTests PRIVATE F3D_SSIM_COMPARE)
endif()

if (F3D_MODULE_EXR)
target_compile_definitions(libf3dSDKTests PRIVATE F3D_MODULE_EXR)
endif ()

# List tests that do not require rendering
list(APPEND libf3dSDKTestsNoRender_list
TestSDKEngineExceptions
Expand Down
12 changes: 7 additions & 5 deletions vtkext/private/module/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/vtkF3DConfigure.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/vtkF3DConfigure.h"
@ONLY)

set(F3D_DEFAULT_HDRI "${F3D_SOURCE_DIR}/resources/defaultHDRI.png" CACHE STRING "Default HDRI when no HDRI file is provided")
mark_as_advanced(F3D_DEFAULT_HDRI)
include("f3dEmbed")
Expand Down Expand Up @@ -132,12 +127,14 @@ if(MSVC)
vtk_module_definitions(f3d::vtkextPrivate PRIVATE _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS _CRT_SECURE_NO_WARNINGS)
endif()

# exr
if(F3D_MODULE_EXR)
vtk_module_link(f3d::vtkextPrivate PRIVATE OpenEXR::OpenEXR)
endif()

# imgui
if (F3D_MODULE_UI)
vtk_module_definitions(f3d::vtkextPrivate PRIVATE F3D_MODULE_UI)
if(F3D_USE_EXTERNAL_IMGUI)
vtk_module_link(f3d::vtkextPrivate PRIVATE imgui::imgui)
else()
Expand All @@ -146,3 +143,8 @@ if (F3D_MODULE_UI)
"${F3D_SOURCE_DIR}/external/imgui")
endif ()
endif ()

# raytracing
if (F3D_MODULE_RAYTRACING)
vtk_module_definitions(f3d::vtkextPrivate PRIVATE F3D_MODULE_RAYTRACING)
endif ()
1 change: 0 additions & 1 deletion vtkext/private/module/F3DLog.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "F3DLog.h"

#include "vtkF3DConfigure.h"
#include "vtkF3DConsoleOutputWindow.h"

F3DLog::Severity F3DLog::VerboseLevel = F3DLog::Severity::Info;
Expand Down
4 changes: 4 additions & 0 deletions vtkext/private/module/Testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ if(F3D_MODULE_EXR)
PROPERTIES
FAIL_REGULAR_EXPRESSION "")
endif()

if (F3D_MODULE_UI)
target_compile_definitions(vtkextPrivateTests PRIVATE F3D_MODULE_UI)
endif ()
1 change: 0 additions & 1 deletion vtkext/private/module/Testing/TestF3DObjectFactory.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "vtkF3DConfigure.h"
#include "vtkF3DObjectFactory.h"
#include "vtkF3DPolyDataMapper.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include <vtkRenderWindow.h>
#include <vtkXMLUnstructuredGridReader.h>

#include "vtkF3DConfigure.h"
#include "vtkF3DGenericImporter.h"
#include "vtkF3DRenderer.h"

Expand Down
10 changes: 0 additions & 10 deletions vtkext/private/module/vtkF3DConfigure.h.in

This file was deleted.

1 change: 0 additions & 1 deletion vtkext/private/module/vtkF3DInteractorEventRecorder.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "vtkF3DInteractorEventRecorder.h"
#include "vtkF3DConfigure.h"

#include <vtkCallbackCommand.h>
#include <vtkObjectFactory.h>
Expand Down
1 change: 0 additions & 1 deletion vtkext/private/module/vtkF3DObjectFactory.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <vtkVersion.h>

#include "vtkF3DConfigure.h"
#include "vtkF3DPolyDataMapper.h"

#if !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && \
Expand Down
7 changes: 3 additions & 4 deletions vtkext/private/module/vtkF3DRenderPass.cxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "vtkF3DRenderPass.h"

#include "vtkF3DConfigure.h"
#include "vtkF3DHexagonalBokehBlurPass.h"

#include <vtkBoundingBox.h>
Expand Down Expand Up @@ -138,16 +137,16 @@ void vtkF3DRenderPass::Initialize(const vtkRenderState* s)
this->OverlayPass->SetColorFormat(vtkTextureObject::Float32);

// main pass
if (F3D_MODULE_RAYTRACING && this->UseRaytracing)
{
#if F3D_MODULE_RAYTRACING
if (this->UseRaytracing)
{
vtkNew<vtkOSPRayPass> ospP;
this->MainPass = vtkSmartPointer<vtkFramebufferPass>::New();
this->MainPass->SetDelegatePass(ospP);
this->MainPass->SetColorFormat(vtkTextureObject::Float32);
#endif
}
else
#endif
{
vtkNew<vtkLightsPass> lightsP;
vtkNew<vtkOpaquePass> opaqueP;
Expand Down
5 changes: 3 additions & 2 deletions vtkext/private/module/vtkF3DRenderer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "F3DColoringInfoHandler.h"
#include "vtkF3DCachedLUTTexture.h"
#include "vtkF3DCachedSpecularTexture.h"
#include "vtkF3DConfigure.h"
#include "vtkF3DDropZoneActor.h"
#include "vtkF3DOpenGLGridMapper.h"
#include "vtkF3DRenderPass.h"
Expand Down Expand Up @@ -343,7 +342,9 @@ void vtkF3DRenderer::ConfigureRenderPasses()
}

vtkNew<vtkF3DRenderPass> newPass;
newPass->SetUseRaytracing(F3D_MODULE_RAYTRACING && this->UseRaytracing);
#if F3D_MODULE_RAYTRACING
newPass->SetUseRaytracing(this->UseRaytracing);
#endif
newPass->SetUseSSAOPass(this->UseSSAOPass);
newPass->SetUseDepthPeelingPass(this->UseDepthPeelingPass);
newPass->SetUseBlurBackground(this->UseBlurBackground);
Expand Down

0 comments on commit 9d08a55

Please sign in to comment.