From c57b0d493c30b063068bdf631b1129de339a6296 Mon Sep 17 00:00:00 2001
From: "David C. Lonie" <loniedavid@gmail.com>
Date: Mon, 20 Jun 2011 18:17:49 -0400
Subject: [PATCH] Added a Chemistry kit layout.

Change-Id: I93c3f53fb76ad0fda78533a69d55e67eee9d33ab
---
 CMakeLists.txt                         | 14 +++++++-
 Chemistry/CMakeLists.txt               | 12 +++++++
 Chemistry/Testing/CMakeLists.txt       |  1 +
 Chemistry/Testing/Cxx/CMakeLists.txt   | 46 ++++++++++++++++++++++++++
 Common/vtkWin32Header.h                |  7 ++++
 Utilities/Doxygen/doc_makeall.cmake.in |  1 +
 vtkIncludeDirectories.cmake            |  2 ++
 7 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 Chemistry/CMakeLists.txt
 create mode 100644 Chemistry/Testing/CMakeLists.txt
 create mode 100644 Chemistry/Testing/Cxx/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c15f07e9a45..a2c0cf06fd8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -350,6 +350,9 @@ VTK_DEPENDENT_OPTION(VTK_USE_GLSL_SHADERS "Build pixel and vertex shader support
 VTK_DEPENDENT_OPTION(VTK_USE_CHARTS "Build VTK chart support (OpenGL based)" ON
   "VTK_USE_RENDERING;VTK_USE_VIEWS" OFF)
 
+VTK_DEPENDENT_OPTION(VTK_USE_CHEMISTRY "Build VTK chemistry support" OFF
+  "VTK_USE_RENDERING" OFF)
+
 SET(VTK_DEFAULT_SHADERS_DIR
    "${VTK_BINARY_DIR}/Utilities/MaterialLibrary/Repository"
    CACHE INTERNAL
@@ -463,6 +466,10 @@ IF(VTK_USE_CHARTS)
   SET(VTK_KITS ${VTK_KITS} CHARTS)
 ENDIF(VTK_USE_CHARTS)
 
+IF(VTK_USE_CHEMISTRY)
+  SET(VTK_KITS ${VTK_KITS} CHEMISTRY)
+ENDIF(VTK_USE_CHEMISTRY)
+
 #-----------------------------------------------------------------------------
 # Determine GUI.
 
@@ -1366,6 +1373,9 @@ ENDIF(VTK_USE_GUISUPPORT)
 IF(VTK_USE_CHARTS)
   ADD_SUBDIRECTORY(Charts)
 ENDIF(VTK_USE_CHARTS)
+IF(VTK_USE_CHEMISTRY)
+  ADD_SUBDIRECTORY(Chemistry)
+ENDIF(VTK_USE_CHEMISTRY)
 
 # Wrapping.
 IF(VTK_WRAP_TCL)
@@ -1413,9 +1423,11 @@ IF(BUILD_TESTING)
   IF(VTK_USE_CHARTS)
     ADD_SUBDIRECTORY(Charts/Testing)
   ENDIF(VTK_USE_CHARTS)
+  IF(VTK_USE_CHEMISTRY)
+    ADD_SUBDIRECTORY(Chemistry/Testing)
+  ENDIF(VTK_USE_CHEMISTRY)
 ENDIF(BUILD_TESTING)
 
-
 # Include the examples if they are enabled.  Note that the in-tree
 # build adds tests and a custom target to build the examples project
 # in a separate build tree.  The examples are not directly included in
diff --git a/Chemistry/CMakeLists.txt b/Chemistry/CMakeLists.txt
new file mode 100644
index 00000000000..737322de71c
--- /dev/null
+++ b/Chemistry/CMakeLists.txt
@@ -0,0 +1,12 @@
+SET(KIT Chemistry)
+SET(UKIT CHEMISTRY)
+
+SET(KIT_LIBS vtkRendering vtkFiltering)
+
+SET(Kit_SRCS
+  )
+
+#-----------------------------------------------------------------------------
+# Include CMake code common to all kits.
+INCLUDE(${VTK_CMAKE_DIR}/KitCommonBlock.cmake)
+#-----------------------------------------------------------------------------
diff --git a/Chemistry/Testing/CMakeLists.txt b/Chemistry/Testing/CMakeLists.txt
new file mode 100644
index 00000000000..08f15ee14df
--- /dev/null
+++ b/Chemistry/Testing/CMakeLists.txt
@@ -0,0 +1 @@
+ADD_SUBDIRECTORY(Cxx)
diff --git a/Chemistry/Testing/Cxx/CMakeLists.txt b/Chemistry/Testing/Cxx/CMakeLists.txt
new file mode 100644
index 00000000000..ae21d10629f
--- /dev/null
+++ b/Chemistry/Testing/Cxx/CMakeLists.txt
@@ -0,0 +1,46 @@
+IF (VTK_USE_RENDERING AND VTK_USE_CHEMISTRY)
+
+  SET(KIT Chemistry)
+
+  SET(MyTests
+
+    )
+
+  # Tests with data
+  IF(VTK_DATA_ROOT)
+    SET(MyTests
+      ${MyTests}
+      )
+  ENDIF(VTK_DATA_ROOT)
+
+  # Use the testing object factory, to reduce boilerplate code in tests.
+  INCLUDE("${VTK_SOURCE_DIR}/Rendering/vtkTestingObjectFactory.cmake")
+  ADD_EXECUTABLE(${KIT}CxxTests ${Tests})
+  TARGET_LINK_LIBRARIES(${KIT}CxxTests
+                        vtkChemistry
+                        vtkRendering
+                        vtkVolumeRendering)
+
+  SET (TestsToRun ${Tests})
+  REMOVE (TestsToRun ${KIT}CxxTests.cxx)
+
+  # Add all the executables
+  FOREACH (test ${TestsToRun})
+    GET_FILENAME_COMPONENT(TName ${test} NAME_WE)
+    IF (VTK_DATA_ROOT)
+      IF(${${TName}Error})
+        SET(_error_threshold ${${TName}Error})
+      ELSE()
+        SET(_error_threshold 10)
+      ENDIF()
+      ADD_TEST(Chemistry-${TName} ${CXX_TEST_PATH}/${KIT}CxxTests ${TName}
+        -D ${VTK_DATA_ROOT}
+        -T ${VTK_BINARY_DIR}/Testing/Temporary
+        -V Baseline/${KIT}/${TName}.png
+        -E ${_error_threshold})
+    ELSE (VTK_DATA_ROOT)
+      ADD_TEST(Chemistry-${TName} ${CXX_TEST_PATH}/${KIT}CxxTests ${TName})
+    ENDIF (VTK_DATA_ROOT)
+  ENDFOREACH (test)
+
+ENDIF (VTK_USE_RENDERING AND VTK_USE_CHEMISTRY)
diff --git a/Common/vtkWin32Header.h b/Common/vtkWin32Header.h
index a3edb908a8c..6141f04ee85 100644
--- a/Common/vtkWin32Header.h
+++ b/Common/vtkWin32Header.h
@@ -263,6 +263,12 @@ Do_not_include_vtkWin32Header_directly__vtkSystemIncludes_includes_it;
   #define VTK_CHARTS_EXPORT VTK_ABI_IMPORT
  #endif
 
+ #if defined(vtkChemistry_EXPORTS)
+  #define VTK_CHEMISTRY_EXPORT VTK_ABI_EXPORT
+ #else
+  #define VTK_CHEMISTRY_EXPORT VTK_ABI_IMPORT
+ #endif
+
 #else
  #define VTK_COMMON_EXPORT
  #define VTK_FILTERING_EXPORT
@@ -281,6 +287,7 @@ Do_not_include_vtkWin32Header_directly__vtkSystemIncludes_includes_it;
  #define VTK_PARALLEL_EXPORT
  #define VTK_VIEWS_EXPORT
  #define VTK_CHARTS_EXPORT
+ #define VTK_CHEMISTRY_EXPORT
  #define VTK_EXPORT
 #endif
 
diff --git a/Utilities/Doxygen/doc_makeall.cmake.in b/Utilities/Doxygen/doc_makeall.cmake.in
index 8a70fb160d2..bdbd82f6839 100644
--- a/Utilities/Doxygen/doc_makeall.cmake.in
+++ b/Utilities/Doxygen/doc_makeall.cmake.in
@@ -182,6 +182,7 @@ set(VTK_TAGFILE_DEST_DIR "${DOXTEMP}")
 #
 set(SOURCE_DIRECTORIES
   "${SOURCE_DIR}/${REL_PATH_TO_TOP}/Charts"
+  "${SOURCE_DIR}/${REL_PATH_TO_TOP}/Chemistry"
   "${SOURCE_DIR}/${REL_PATH_TO_TOP}/Common"
   "${SOURCE_DIR}/${REL_PATH_TO_TOP}/Filtering"
   "${SOURCE_DIR}/${REL_PATH_TO_TOP}/GenericFiltering"
diff --git a/vtkIncludeDirectories.cmake b/vtkIncludeDirectories.cmake
index 20397773f75..46f96e8ed58 100644
--- a/vtkIncludeDirectories.cmake
+++ b/vtkIncludeDirectories.cmake
@@ -134,6 +134,8 @@ IF(VTK_USE_RENDERING)
   SET(VTK_INCLUDE_DIRS_BUILD_TREE ${VTK_INCLUDE_DIRS_BUILD_TREE} ${VTK_BINARY_DIR}/Rendering)
   SET(VTK_INCLUDE_DIRS_SOURCE_TREE ${VTK_INCLUDE_DIRS_SOURCE_TREE} ${VTK_SOURCE_DIR}/Charts)
   SET(VTK_INCLUDE_DIRS_BUILD_TREE ${VTK_INCLUDE_DIRS_BUILD_TREE} ${VTK_BINARY_DIR}/Charts)
+  SET(VTK_INCLUDE_DIRS_SOURCE_TREE ${VTK_INCLUDE_DIRS_SOURCE_TREE} ${VTK_SOURCE_DIR}/Chemistry)
+  SET(VTK_INCLUDE_DIRS_BUILD_TREE ${VTK_INCLUDE_DIRS_BUILD_TREE} ${VTK_BINARY_DIR}/Chemistry)
 # Access to vtkRegressionTestImage.h.
 SET(VTK_INCLUDE_DIRS_SOURCE_TREE ${VTK_INCLUDE_DIRS_SOURCE_TREE}
   ${VTK_SOURCE_DIR}/Rendering/Testing/Cxx
-- 
GitLab