Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
451917ca
Commit
451917ca
authored
Dec 17, 2014
by
Christian Schulte zu Berge
Browse files
Updated CMake script to generate pipeline registration file to (limitedly) support namespaces.
parent
dc1b0b16
Changes
1
Show whitespace changes
Inline
Side-by-side
cmake/macros.cmake
View file @
451917ca
...
@@ -37,13 +37,12 @@ MACRO(WRITE_PIPELINE_REGISTRATION FileName)
...
@@ -37,13 +37,12 @@ MACRO(WRITE_PIPELINE_REGISTRATION FileName)
LIST
(
APPEND PipelineRegistrationSource
"#include
\"
${
IncludeFile
}
\"\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"#include
\"
${
IncludeFile
}
\"\n
"
)
ENDFOREACH
()
ENDFOREACH
()
LIST
(
APPEND PipelineRegistrationSource
"
\n
namespace campvis {
\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"
\n
// Instantiate templated PipelineRegistrars to register the pipelines.
\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"
\t
// Instantiate templated PipelineRegistrars to register the pipelines.
\n
"
)
FOREACH
(
ClassName
${
PipelineRegistrationClassNames
}
)
FOREACH
(
ClassName
${
PipelineRegistrationClassNames
}
)
LIST
(
APPEND PipelineRegistrationSource
"
\t
template class PipelineRegistrar<
${
ClassName
}
>
\;\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"template class
campvis::
PipelineRegistrar<
${
ClassName
}
>
\;\n
"
)
ENDFOREACH
()
ENDFOREACH
()
LIST
(
APPEND PipelineRegistrationSource
"
}
\n
\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"
\n
"
)
FILE
(
WRITE
${
FileName
}
${
PipelineRegistrationSource
}
)
FILE
(
WRITE
${
FileName
}
${
PipelineRegistrationSource
}
)
ENDMACRO
(
WRITE_PIPELINE_REGISTRATION
)
ENDMACRO
(
WRITE_PIPELINE_REGISTRATION
)
...
@@ -55,15 +54,25 @@ MACRO(PARSE_HEADER_FOR_PIPELINE FileName)
...
@@ -55,15 +54,25 @@ MACRO(PARSE_HEADER_FOR_PIPELINE FileName)
SET
(
NameRegex
"[A-Za-z0-9_]+"
)
SET
(
NameRegex
"[A-Za-z0-9_]+"
)
SET
(
FullyQualifiedNameRegex
"(::)?(
${
NameRegex
}
::)*
${
NameRegex
}
"
)
SET
(
FullyQualifiedNameRegex
"(::)?(
${
NameRegex
}
::)*
${
NameRegex
}
"
)
SET
(
BaseClassListRegex
"((public|private|protected)( virtual)?
${
FullyQualifiedNameRegex
}
, )*"
)
SET
(
BaseClassListRegex
"((public|private|protected)( virtual)?
${
FullyQualifiedNameRegex
}
, )*"
)
SET
(
NamespaceRegex
"namespace (
${
NameRegex
}
) {"
)
SET
(
ClassRegex
"class (
${
NameRegex
}
) ?:
${
BaseClassListRegex
}
public
${
FullyQualifiedNameRegex
}
Pipeline"
)
SET
(
ClassRegex
"class (
${
NameRegex
}
) ?:
${
BaseClassListRegex
}
public
${
FullyQualifiedNameRegex
}
Pipeline"
)
# Find the namespace nesting of this class (very simplified parsing)
SET
(
FullNamespace
""
)
STRING
(
REGEX MATCHALL
${
NamespaceRegex
}
namespaces
${
content
}
)
FOREACH
(
n
${
namespaces
}
)
# Extract namespace name and concatenate
STRING
(
REGEX REPLACE
${
NamespaceRegex
}
"
\\
1"
RESULT
${
n
}
)
SET
(
FullNamespace
"
${
FullNamespace
}${
RESULT
}
::"
)
ENDFOREACH
()
# Find all class definitions inheriting from a Pipeline
# Find all class definitions inheriting from a Pipeline
STRING
(
REGEX MATCHALL
${
ClassRegex
}
matches
${
content
}
)
STRING
(
REGEX MATCHALL
${
ClassRegex
}
matches
${
content
}
)
FOREACH
(
m
${
matches
}
)
FOREACH
(
m
${
matches
}
)
# Extract class name and register
# Extract class name and register
STRING
(
REGEX REPLACE
${
ClassRegex
}
"
\\
1"
RESULT
${
m
}
)
STRING
(
REGEX REPLACE
${
ClassRegex
}
"
\\
1"
RESULT
${
m
}
)
ADD_PIPELINE_REGISTRATION
(
${
FileName
}
${
RESULT
}
)
ADD_PIPELINE_REGISTRATION
(
${
FileName
}
"
${
FullNamespace
}
${
RESULT
}
"
)
ENDFOREACH
()
ENDFOREACH
()
ENDMACRO
(
PARSE_HEADER_FOR_PIPELINE
)
ENDMACRO
(
PARSE_HEADER_FOR_PIPELINE
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment