Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
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
Hide whitespace changes
Inline
Side-by-side
cmake/macros.cmake
View file @
451917ca
...
...
@@ -37,13 +37,12 @@ MACRO(WRITE_PIPELINE_REGISTRATION FileName)
LIST
(
APPEND PipelineRegistrationSource
"#include
\"
${
IncludeFile
}
\"\n
"
)
ENDFOREACH
()
LIST
(
APPEND PipelineRegistrationSource
"
\n
namespace campvis {
\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"
\t
// Instantiate templated PipelineRegistrars to register the pipelines.
\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"
\n
// Instantiate templated PipelineRegistrars to register the pipelines.
\n
"
)
FOREACH
(
ClassName
${
PipelineRegistrationClassNames
}
)
LIST
(
APPEND PipelineRegistrationSource
"
\t
template class PipelineRegistrar<
${
ClassName
}
>
\;\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"template class
campvis::
PipelineRegistrar<
${
ClassName
}
>
\;\n
"
)
ENDFOREACH
()
LIST
(
APPEND PipelineRegistrationSource
"
}
\n
\n
"
)
LIST
(
APPEND PipelineRegistrationSource
"
\n
"
)
FILE
(
WRITE
${
FileName
}
${
PipelineRegistrationSource
}
)
ENDMACRO
(
WRITE_PIPELINE_REGISTRATION
)
...
...
@@ -55,15 +54,25 @@ MACRO(PARSE_HEADER_FOR_PIPELINE FileName)
SET
(
NameRegex
"[A-Za-z0-9_]+"
)
SET
(
FullyQualifiedNameRegex
"(::)?(
${
NameRegex
}
::)*
${
NameRegex
}
"
)
SET
(
BaseClassListRegex
"((public|private|protected)( virtual)?
${
FullyQualifiedNameRegex
}
, )*"
)
SET
(
NamespaceRegex
"namespace (
${
NameRegex
}
) {"
)
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
STRING
(
REGEX MATCHALL
${
ClassRegex
}
matches
${
content
}
)
FOREACH
(
m
${
matches
}
)
# Extract class name and register
STRING
(
REGEX REPLACE
${
ClassRegex
}
"
\\
1"
RESULT
${
m
}
)
ADD_PIPELINE_REGISTRATION
(
${
FileName
}
${
RESULT
}
)
ADD_PIPELINE_REGISTRATION
(
${
FileName
}
"
${
FullNamespace
}
${
RESULT
}
"
)
ENDFOREACH
()
ENDMACRO
(
PARSE_HEADER_FOR_PIPELINE
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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