Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

USDSchemaGen semicolons #15

Closed
murphyeoin opened this issue Aug 9, 2016 · 1 comment
Closed

USDSchemaGen semicolons #15

murphyeoin opened this issue Aug 9, 2016 · 1 comment
Assignees

Comments

@murphyeoin
Copy link
Contributor

Hello.. I'm going to submit this as an issue while we get our fork workflow up between the public github repo and our own internal one and can easily branch...

Running the usdGenSchema command creates header file class definitions that do not close the class declaration with a semicolon which causes an error on compilation. The offending code is in the cmake file when reading in the usdGenSchema.py file to replace the pxrpythonsubst with the configured python executable before writing back out for install. Code is here: https://github.com/PixarAnimationStudios/USD/blob/2eb01f5cd4c2dae4e1ef9912ca27a93083bb6ef4/cmake/macros/Public.cmake#L34

Offending code is:

file(READ ${pyFile} contents)
string(REGEX REPLACE "/pxrpythonsubst" ${PXR_PYTHON_SHEBANG} contents "${contents}")
file(WRITE ${CMAKE_BINARY_DIR}/${pyFile} ${contents})

If we do a file read cmake operation and semicolons are found it is treated as a list, so the file write operation will remove all semicolons from the output. The fix is easy, wrap with quotes so it is treated as a string i.e.

file(WRITE ${CMAKE_BINARY_DIR}/${pyFile} "${contents}")

Thanks
Eoin

@amooty
Copy link

amooty commented Aug 11, 2016

Filed as internal issue #135683.

asluk pushed a commit to asluk/USD that referenced this issue Aug 31, 2016
…iting

out the usdGenSchema Python file. CMake was stripping out semicolons.
This caused the resulting python file to have the following string:

   customCode = _ExtractCustomCode(clsHFilePath, default='}\n\n#endif\n')

whereas the original had:

   customCode = _ExtractCustomCode(clsHFilePath, default='};\n\n#endif\n')

This caused usdGenSchema to generate syntactically invalid C++ classes(
no closing semicolon) in the case where a user had no custom code
and the default string above would be used.

Credit to github user murphyeoin for filing the bug and pointing
us to the fix.

Fixes PixarAnimationStudios#15

(Internal change: 1646239)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants