Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1220 - in trunk: Engine/Factory include


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1220 - in trunk: Engine/Factory include
  • Date: Fri, 13 Oct 2006 12:55:28 -0600 (MDT)

Author: bigler
Date: Fri Oct 13 12:55:26 2006
New Revision: 1220

Added:
   trunk/include/RegisterConfigurableComponents.h.CMakeTemplate
Modified:
   trunk/Engine/Factory/RegisterKnownComponents.cc
   trunk/include/CMakeLists.txt
Log:

If you have a component that can be conditionally built, you need a
way of having the component conditionally registered.  All such
components should be placed in RegisterConfigurableComponents.h
following the guides in there.  This file contains a function that
will be called by registerKnownComponents to register these
conditionally compiled components.

Engine/Factory/RegisterKnownComponents.cc
include/CMakeLists.txt
include/RegisterConfigurableComponents.h.CMakeTemplate


Modified: trunk/Engine/Factory/RegisterKnownComponents.cc
==============================================================================
--- trunk/Engine/Factory/RegisterKnownComponents.cc     (original)
+++ trunk/Engine/Factory/RegisterKnownComponents.cc     Fri Oct 13 12:55:26 
2006
@@ -19,7 +19,6 @@
 #include <Engine/PixelSamplers/JitterSampler.h>
 #include <Engine/Renderers/Moire.h>
 #include <Engine/Renderers/NullRenderer.h>
-#include <Engine/Renderers/Raydumper.h>
 #include <Engine/Renderers/RayGen.h>
 #include <Engine/Renderers/Raytracer.h>
 #include <Engine/Shadows/HardShadows.h>
@@ -39,7 +38,10 @@
 #include <UserInterface/NullUI.h>
 #include <UserInterface/CameraPathAutomator.h>
 
-
+// If you add a component that conditionally builds based on how the
+// build is configured, please add it to
+// RegisterConfigurableComponents.h.CMakeTemplate.
+#include <RegisterConfigurableComponents.h>
 
 namespace Manta {
   void registerKnownComponents(MantaInterface* engine)
@@ -84,7 +86,6 @@
     engine->registerComponent("raygen", &RayGen::create);
     engine->registerComponent("moire", &Moire::create);
     engine->registerComponent("raytracer", &Raytracer::create);
-    engine->registerComponent("raydumper", &Raydumper::create);
 
     // Register cameras
     //engine->registerComponent("environment", &EnvironmentCamera::create);
@@ -109,5 +110,8 @@
     engine->registerObject("group", &Group::create);
     engine->registerObject("grid", &GriddedGroup::create);
     engine->registerObject("bvh", &BVH::create);
+
+    // Register the configurable components
+    RegisterConfigurableComponents(engine);
   }
 }

Modified: trunk/include/CMakeLists.txt
==============================================================================
--- trunk/include/CMakeLists.txt        (original)
+++ trunk/include/CMakeLists.txt        Fri Oct 13 12:55:26 2006
@@ -66,3 +66,21 @@
   ${CMAKE_CURRENT_SOURCE_DIR}/UseStatsCollector.h.CMakeTemplate
   ${CMAKE_BINARY_DIR}/include/UseStatsCollector.h
   )
+
+###############################################################################
+## Configure RegisterConfigurableComponents.h
+
+# For each variable you want to use in C code you need to make it a 1
+# or 0, because there are cases where the variable is undefined and
+# you get funky code "#if PABST_FOUNT" turns into "#if " instead of
+# "#if 0".
+IF(PABST_FOUND)
+  SET(PABST_FOUND_DEF "1" CACHE INTERNAL "Enable Pabst build")
+ELSE(PABST_FOUND)
+  SET(PABST_FOUND_DEF "0" CACHE INTERNAL "Disable Pabst build")
+ENDIF(PABST_FOUND)
+
+CONFIGURE_FILE(
+  ${CMAKE_CURRENT_SOURCE_DIR}/RegisterConfigurableComponents.h.CMakeTemplate
+  ${CMAKE_BINARY_DIR}/include/RegisterConfigurableComponents.h
+  )

Added: trunk/include/RegisterConfigurableComponents.h.CMakeTemplate
==============================================================================
--- (empty file)
+++ trunk/include/RegisterConfigurableComponents.h.CMakeTemplate        Fri 
Oct 13 12:55:26 2006
@@ -0,0 +1,49 @@
+/*
+  For more information, please see: http://software.sci.utah.edu
+
+  The MIT License
+
+  Copyright (c) 2005-2006
+  Scientific Computing and Imaging Institute, University of Utah
+
+  License for the specific language governing rights and limitations under
+  Permission is hereby granted, free of charge, to any person obtaining a
+  copy of this software and associated documentation files (the "Software"),
+  to deal in the Software without restriction, including without limitation
+  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  and/or sell copies of the Software, and to permit persons to whom the
+  Software is furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included
+  in all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+  DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef RegisterConfigurableComponents_H
+#define RegisterConfigurableComponents_H
+
+// Add new includes in their own block that can be defined in and out
+// of existence.  Make sure in the CMakeLists.txt file that you create
+// a variable that will be either 1 or 0 based on the configuration.
+#if ${PABST_FOUND_DEF}
+#include <Engine/Renderers/Raydumper.h>
+#endif
+
+namespace Manta {
+  static void RegisterConfigurableComponents(MantaInterface* engine)
+  {
+    // Now optionally add code
+#if ${PABST_FOUND_DEF}
+    engine->registerComponent("raydumper", &Raydumper::create);
+#endif
+  }
+} // end namespace Manta
+
+#endif // RegisterConfigurableComponents_H




  • [MANTA] r1220 - in trunk: Engine/Factory include, bigler, 10/13/2006

Archive powered by MHonArc 2.6.16.

Top of page