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

CMake: Grab bag of tiny refactors and improvements #1683

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

enetheru
Copy link
Contributor

While working on actual features I ran into a fair few small refactors I could make to improve the quality of the solution that didnt necessarily square with the subject of said features.

This PR has each of these under a different commit and will require squashing before merging.
I don't know if this is an acceptable style of change though, so I'm making a draft PR to get feedback.

I can pull out any of these into their own PR or re-arrange as desired.

List of changes:

SYSTEM_NAME

Was set using a list and then using regex replace on the ';' to transform it into a long string.
This was completely unnecessary as string( APPEND does the equivalent thing in one command

Update Target Properties

  • Using rpath for a static library is irrelevant, needs to be set in consumers.
  • Add INTERFACE_POSITION_INDEPENDENT_CODE to propogate flag to consumers.

Update macos.cmake and test target

  • Add TODO for missing options
  • Fix formatting
  • Set GODOT_ARCH in case of arch being 'universal'
  • Simplify the test project when SYSTEM_NAME is Darwin

Refactor common_compiler_flags.cmake

  • remove incorrectly propagated target_compile_features
  • remove GNU_ prefix on generic compiler version genex's
  • remove line breaks for simple genex's
  • make most flags private
  • comments

Update Comments

  • Add TODO items for missing options
  • Add missing toolchain managed options commented out
  • Homogenise Headings and block comments

replace ad-hock name construction with new GODOT_SUFFIX

  • This replicates how SCons does it.
  • Modify test project to use GODOT_SUFFIX
  • Add GODOT_SUFFIX to libgodot-cpp properties

web suffix

  • set web shared lib suffix to bring web builds into line with SCons

"$<$<STREQUAL:${GODOT_PRECISION},double>:.double>"
"$<1:.${SYSTEM_ARCH}>"
# missing IOS_SIMULATOR
# missing THREADS
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The threads vs no threads distinction a pretty important one. A reusable GDExtension (ie not one for a specific project) that supports web will very likely want to have builds for both

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that its important, I have submitted #1698 to make that happen.

previous version created a list, which is semicolon delimited and then string REPLACED the semicolon to create a single string.
New version uses string APPEND to create the string the first time.
- Using rpath for a static library is irrelevant, needs to be seet in consumers.
- Add INTERFACE_POSITION_INDEPENDENT_CODE to propogate flag to consumers.
- Add TODO for missing options
- Fix formatting
- Set GODOT_ARCH in case of arch being 'universal'
- Simplify the test project when SYSTEM_NAME is Darwin
- remove incorrectly propagated target_compile_features
- remove GNU_ prefix on generic compiler version genex's
- remove line breaks for simple genex's
- make most flags private
- comments
- Add TODO items for missing options
- Add missing toolchain managed options commented out
- Homogenise Headings and block comments
- This replicates how SCons does it.
- Modify test project to use GODOT_SUFFIX
- Add GODOT_SUFFIX to libgodot-cpp properties
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

Successfully merging this pull request may close these issues.

2 participants