Commit 536666b4 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Refactoring pipeline concept #7: Implemented automatic parsing of include...

Refactoring pipeline concept #7: Implemented automatic parsing of include files for pipeline registration
parent 8d37c3b5
......@@ -23,6 +23,20 @@ MACRO(WRITE_PIPELINE_REGISTRATION FileName)
FILE(WRITE ${FileName} ${PipelineRegistrationSource})
ENDMACRO(WRITE_PIPELINE_REGISTRATION)
MACRO(PARSE_HEADER_FOR_PIPELINE FileName)
FILE(READ ${FileName} content)
# Find all class definitions inheriting from a Pipeline
STRING(REGEX MATCHALL "class ([A-Za-z0-9_]+) : public [A-Za-z0-9_]+Pipeline {" matches ${content})
FOREACH(m ${matches})
# Extract class name and register
STRING(REGEX REPLACE "(class )([A-Za-z0-9_]+)( : public [A-Za-z0-9_]+Pipeline {)" "\\2" RESULT ${m})
ADD_PIPELINE_REGISTRATION(${FileName} ${RESULT})
ENDFOREACH()
ENDMACRO(PARSE_HEADER_FOR_PIPELINE)
# copy and pasted from Voreen...
MACRO(LIST_SUBDIRECTORIES Result Directory AbsolutePath)
......
......@@ -45,6 +45,11 @@ FOREACH(ModDir ${ModDirs})
# add definition that this module is activated
LIST(APPEND CampvisGlobalDefinitions -DCAMPVIS_HAS_MODULE_${ModDirUpper})
# parse all header files for pipeline classes to add them to the pipeline registration
FOREACH(HeaderFile ${ThisModHeaders})
PARSE_HEADER_FOR_PIPELINE("modules/${HeaderFile}")
ENDFOREACH()
# unset module settings to avoid duplicates if module cmake file misses sth.
UNSET(ThisModDefinitions)
UNSET(ThisModIncludeDirs)
......
......@@ -15,6 +15,3 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
)
SET(ThisModShaderDirectories "modules/advancedusvis/glsl")
ADD_PIPELINE_REGISTRATION("modules/advancedusvis/pipelines/advancedusvis.h" "AdvancedUsVis")
ADD_PIPELINE_REGISTRATION("modules/advancedusvis/pipelines/cmbatchgeneration.h" "CmBatchGeneration")
......@@ -19,4 +19,3 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
SET(ThisModShaderDirectories "modules/columbia/glsl")
ADD_PIPELINE_REGISTRATION("modules/columbia/pipelines/columbia1.h" "Columbia1")
......@@ -20,4 +20,3 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
LIST(APPEND ThisModExternalLibs kisscl)
SET(ThisModShaderDirectories "modules/opencl/cl")
ADD_PIPELINE_REGISTRATION("modules/opencl/pipelines/openclpipeline.h" "OpenCLPipeline")
......@@ -40,5 +40,3 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
)
SET(ThisModShaderDirectories "modules/scr_msk/glsl")
ADD_PIPELINE_REGISTRATION("modules/scr_msk/pipelines/uscompounding.h" "UsCompounding")
......@@ -16,8 +16,3 @@ FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
SET(ThisModShaderDirectories "modules/vis/glsl")
ADD_PIPELINE_REGISTRATION("modules/vis/pipelines/dvrvis.h" "DVRVis")
ADD_PIPELINE_REGISTRATION("modules/vis/pipelines/ixpvdemo.h" "IxpvDemo")
ADD_PIPELINE_REGISTRATION("modules/vis/pipelines/slicevis.h" "SliceVis")
ADD_PIPELINE_REGISTRATION("modules/vis/pipelines/volumeexplorerdemo.h" "VolumeExplorerDemo")
ADD_PIPELINE_REGISTRATION("modules/vis/pipelines/volumerendererdemo.h" "VolumeRendererDemo")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment