Skip to content

CMake: Grab bag of tiny refactors and improvements#1683

Closed
enetheru wants to merge 9 commits into
godotengine:masterfrom
enetheru:tidy
Closed

CMake: Grab bag of tiny refactors and improvements#1683
enetheru wants to merge 9 commits into
godotengine:masterfrom
enetheru:tidy

Conversation

@enetheru

Copy link
Copy Markdown
Collaborator

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

Comment thread cmake/godotcpp.cmake
"$<$<STREQUAL:${GODOT_PRECISION},double>:.double>"
"$<1:.${SYSTEM_ARCH}>"
# missing IOS_SIMULATOR
# missing THREADS

Copy link
Copy Markdown
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
Copy Markdown
Collaborator 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
@enetheru

enetheru commented Feb 4, 2025

Copy link
Copy Markdown
Collaborator Author

I'm going to split this apart and resubmit

@enetheru enetheru closed this Feb 4, 2025
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