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

Fixed some issues, preventing building project on a mac machine #37

Merged
merged 5 commits into from
Jan 9, 2024

Conversation

ManeFunction
Copy link
Contributor

@ManeFunction ManeFunction commented Jan 9, 2024

  • Set up project languages manually to prevent compiler's wrong guesses.
  • Set up current platform explicitly for mac (both Intel and Apple Silicone) is automated now (old argument method doesn't worked for me).
  • Fixed a lot of warnings, mostly with PSA crypto documentation.

*Was forced to fix warnings because there is a -Werror flag enabled.

I'm not certain that the fixes is complete. Although with this fixes I can now build the app, the Info.plist within it is merely a placeholder (I assume it should be changed in the build process). The application only functions correctly after manual adjustments. Can anyone assist with this issue? Though, I'm not sure if this is entirely relevant to my PR.

- Set up project languages manually to prevent compiler's wrong guess
- Set up current platform explicitly for mac (both Intel and Apple Silicone)
- Fixed a lot of warnings, mostly with PSA crypto documentation
CMakeLists.txt Outdated
@@ -26,6 +26,17 @@ message("module path = ${CMAKE_MODULE_PATH}")
file(GLOB source "source/*.cpp" "source/*.hpp" "source/*.h")
if (APPLE)
set(OBJCPP "source/AppleUtilities.h" "source/AppleUtilities.mm")
# Detect whether we are on an Intel or ARM Mac
execute_process(COMMAND uname -m RESULT_VARIABLE result OUTPUT_VARIABLE OSX_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
Copy link
Owner

@Ravbug Ravbug Jan 9, 2024

Choose a reason for hiding this comment

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

We should not be setting CMAKE_OSX_ARCHITECTURES. What was the error that you were getting?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why it's bad? I'm getting this strange issue and the fix solved it.
Screenshot 2024-01-09 at 19 19 35

Copy link
Owner

Choose a reason for hiding this comment

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

The issue is we want to make fat binaries (ARM + x86) in a single executable so that both intel and apple silicon macOS users can run it. Setting CMAKE_OSX_ARCHITECTURES to a single architecture prevents creating fat binaries.

Instead of $(ARCHS_STANDARD), you can try setting it to "x86_64;arm64" and see if that also resolves the issue.

Copy link
Contributor Author

@ManeFunction ManeFunction Jan 9, 2024

Choose a reason for hiding this comment

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

Ah, I hadn't considered the possibility of fat binaries here. I gave it a try, and it worked. At least, the build was successful and it functioned properly on x64. I haven't been able to test it on ARM, as I haven't upgraded yet.

Copy link
Owner

@Ravbug Ravbug left a comment

Choose a reason for hiding this comment

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

Thanks for the work! Please see the above comments.

CMakeLists.txt Outdated Show resolved Hide resolved
@ManeFunction
Copy link
Contributor Author

BTW, I'm not sure is something wrong with my environment or else, but after a successful build my Info.plist looks like this. After I fix it manually, application worked as intended.
Screenshot 2024-01-09 at 21 25 41

@ManeFunction
Copy link
Contributor Author

Also, have a question: Shouldn't this line be under the if(APPLE) as well?
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE INTERNAL "")

@Ravbug
Copy link
Owner

Ravbug commented Jan 9, 2024

Also, have a question: Shouldn't this line be under the if(APPLE) as well? set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE INTERNAL "")

CMake ignores it on non-Apple platforms so there's no need.

@Ravbug Ravbug merged commit bc636ec into Ravbug:master Jan 9, 2024
3 checks passed
@ManeFunction ManeFunction deleted the mac-build-fixes branch January 10, 2024 08:58
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

2 participants