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 cleanup #10163

Merged
merged 4 commits into from Apr 20, 2021
Merged

Cmake cleanup #10163

merged 4 commits into from Apr 20, 2021

Conversation

p01arst0rm
Copy link
Contributor

  • unify missmatching indentation in CMakeLists.txt files
  • simplify msvc flags in rpcs3/Emu
  • remove STREQUAL (use MATCHES instead)
  • cleanup build type check; build will now no longer fail
    if an invalid build type is passed into cmake, the build
    will instead default to Release.
  • removed redundant version check
  • moved cmake_modules to project root

CMakeLists.txt Outdated
# get build type
if(CMAKE_BUILD_TYPE MATCHES "Release")
message(STATUS "Release build seleceted.")
set(CMAKE_BUILD_TYPE "Release")
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't make any sense. The var is already "Release".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if you try and set an invalid build type as a build option, itll break the cmake build. this change means that if the build type is invalid it will default to release

Copy link
Member

Choose a reason for hiding this comment

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

Need RelWithDebInfo type, and MinSizeRel for completeness. Otherwise they will default to Release too.

CMakeLists.txt Outdated
set(CMAKE_BUILD_TYPE "Release")
elseif(CMAKE_BUILD_TYPE MATCHES "Debug")
message(STATUS "Debug build seleceted. Debug builds can be unstable!!")
set(CMAKE_BUILD_TYPE "Debug")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here

@p01arst0rm
Copy link
Contributor Author

cc @hcorion

@Megamouse
Copy link
Contributor

This is really weird.
If I can trust this website, you're changing indentations back and forth between commits.
Also, why change the indentations in the first place?
Cmake files usually are edited in regular text editors.
So people naturally use tabs for indentations.
And some stuff doesn't even work without tabs.
Is there any reason why you changed it to spaces?

@p01arst0rm
Copy link
Contributor Author

p01arst0rm commented Apr 20, 2021

some of the cmake files used tab indents, others used space indents. either is fine, but you shouldn't really swap between them (same with case type). in cmake, it's most common is to use spaces instead of tabs.

@p01arst0rm p01arst0rm closed this Apr 20, 2021
@p01arst0rm p01arst0rm reopened this Apr 20, 2021
Copy link
Member

@hcorion hcorion left a comment

Choose a reason for hiding this comment

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

Other than the mentioned issue I think it looks good.

In the future when combining formatting and code changes, if you could do all formatting (in this case tabs->spaces) in one, and then code changes in commits after that, it would be much easier to review. For example in your simplified msvc compile flags in rpcs3/Emu commit it's really hard to tell what is formatting changes and what is actually changing functionality. In addition it looks like you switch from spaces->tabs->spaces in the different commits which makes it even trickier to review.

CMakeLists.txt Outdated
if(NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE "Release")
# get build type
Copy link
Member

Choose a reason for hiding this comment

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

Yeah this chunk of code is unnecessary clutter.
You don't need to warn the user that debug builds are unstable, if they've decided to compile RPCS3 with debug options we can assume they know what they're doing. In addition, you don't handle RelWithDebInfo.
Best to just leave it as it was.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed it from the commit, but i do still think its messy and can lead to undefined behavior. ill revisit it again some other time :)

CMakeLists.txt Outdated
# get build type
if(CMAKE_BUILD_TYPE MATCHES "Release")
message(STATUS "Release build seleceted.")
set(CMAKE_BUILD_TYPE "Release")
Copy link
Member

Choose a reason for hiding this comment

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

Need RelWithDebInfo type, and MinSizeRel for completeness. Otherwise they will default to Release too.

@p01arst0rm
Copy link
Contributor Author

Other than the mentioned issue I think it looks good.

In the future when combining formatting and code changes, if you could do all formatting (in this case tabs->spaces) in one, and then code changes in commits after that, it would be much easier to review. For example in your simplified msvc compile flags in rpcs3/Emu commit it's really hard to tell what is formatting changes and what is actually changing functionality. In addition it looks like you switch from spaces->tabs->spaces in the different commits which makes it even trickier to review.

this is generally why i keep to one commit per 'theme of changes' so to speak, instead of bundling them up. its far easier to make weird history errors

@p01arst0rm
Copy link
Contributor Author

@Nekotekina "Need RelWithDebInfo type, and MinSizeRel for completeness. Otherwise they will default to Release too." i've removed that commit from this push. It's refactoring, not cleanup and should really have its own commit. This PR is just for housekeeping type stuff :)

@Nekotekina
Copy link
Member

Oookay, I see

@Nekotekina Nekotekina merged commit 01703b1 into RPCS3:master Apr 20, 2021
@p01arst0rm p01arst0rm deleted the cmake-cleanup branch April 20, 2021 19:03
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.

None yet

4 participants