-
Notifications
You must be signed in to change notification settings - Fork 51
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
MacOS version #86
Comments
I wonder what is the problem with C++ 20 on MacOS? Is it the compiler of your choice yet to support that standard? Or is it something else? |
When using c++20, I have the below error : Checking the compiler version, I can see this version : |
15.0.0 looks pretty outdated for LLVM clang, the latest version is 18.1.8. Though, to be fair, I know nothing about the difference between "Apple clang" and "vanilla (LLVM) clang". I just think that "fixing" clang is a better option here than going back to C++ 17. |
Ok I've updated clang with homebrew and it's now with version 18.1.8 I've added these lines in the pro file : However qmake is applying automatically some defaulting on the "std" options as per below : Not sure what this mapping of the CONFIG means and if it's correct, but for the moment II need to use c++17 |
Oh and I’m using qt 5.12.x so maybe that’s why this mapping is not good ? (I need to check how the update to 5.15 can be done ) |
Oh, I think I know what's going on! My guess is: if qmake (the Qt tool you used to create a clang makefile from NifSkope.pro) is that outdated, it doesn't know about C++20, considers it a bad option value and defaults the makefile to C++11. So yes, updating Qt looks like the way to go. |
It makes sense, I will try to update to 5.15 to have the good qmake version :) Thanks ! |
What version of Qt 5.15 you upgraded to? In your compiled NifSkope, what version is reported in "About Qt" from Help menu? That "c++2a" makes me think that your Qt is still 2 or more years old. If you submit your changes as PR, will it break NifSkope.pro for all other systems and compilers other than LLVM clang on MacOS? I'm asking because:
Regarding NifSkope_targets.pri and the "dot" thing - just skip building the whole doxygen part if you can. NifSkope is functional without it. |
For what it is worth, I merged your changes to my fork here, although I cannot test them, because I only have Linux and Windows PCs. I did make a few modifications:
|
I adjusted the default value of TEMPLATE in my fork too. That |
Ok for the TEMPLATE adjustment Regarding the I've upgraded cmake to version 3.30.2 but it still failing ( In file included from lib/zlib/gzguts.h:21: I will check for all the other comments above and test them :) |
Ok please find below my findings :
These options relative to Mac are handled with the command "macx" like below so that it doesn't disturb other platforms : I've put the PR here #87 but it might need some adjustments |
Ok I've tried to compile this fork and I have this result : Everything is compiling fine except the file mesh.cpp for the below line
I guess an adjustment is needed on the way v[] is used |
I believe you still call the old qmake. It could be even your original 5.12.x (I guess, it's new enough to know about "c++2a"). What version of Qt is reported in your compiled NifSkope, Help menu, "About Qt"? Also, just in case, if you have |
But if the changes from your PR are merged here, wouldn't they break NifSkope.pro for anyone on MacOS who tries to build it with XCode, g++ or any compiler other than LLVM clang? |
I changed those lines, does this fix the error? |
I've checked the below : qmake --version About QT is giving : 5.15.13 There might be something relative to QT 5.12 but I don't see any remaining files (I have uninstalled it) :/ "wouldn't they break NifSkope.pro for anyone on MacOS who tries to build it with XCode, g++ or any compiler other than LLVM clang?" Yes you're correct, my assumption was that clang/clang++ is used to make things work on Mac |
Compilation is OK now :) |
Thanks, I can add the DMG to the next release in a few days. It would be ideal though if you could write an Actions workflow for macOS, as I use those on both Linux and Windows for testing and for automatically generating release packages. For reference, main.yml runs on every 'git push', and release.yml on 'git push --tags', the latter creates the .7z packages I upload to releases. |
I've never created such workflow, however it doesn't seem to be complex : I think for MacOS we could mimick the linux action workflow. |
There's something strange, the QT docs are referring to c++20 for QT6 CONFIG and c++2a / c++2b for QT5 CONFIG : am I missing something here ? QT5 : https://doc.qt.io/qt-5/qmake-variable-reference.html#config |
Yes, I'm starting to suspect that it's a Qt 5 thing and on some compilers/OSes qmake 5.x.x is fine with |
You can test workflows in a fork of the repository, any .yml files that are placed under .github/workflows/ will be automatically run by GitHub whenever the conditions listed under "on:" are met. If the run fails, check the logs, those can be viewed for example here by clicking on "Build MSYS2" or "Build Linux", then expanding the details. The artifacts are .zip files that contain whatever was uploaded with actions/upload-artifact. The workflow logs also show what packages were installed, for example the most recent Windows build used GCC 14.2.0 and Qt 5.15.14 (the last free release), while the Linux workflow was run on Ubuntu with Qt 5.15.3. For local builds on Linux, I use GCC 13.3.0 myself with Qt 5.15.14, and on Windows the same (latest) MSYS2 environment that is used by the workflows. |
This is correct, the 'CONFIG += c++20' does not actually seem to have any effect. The reason why GCC and MSVC still work is that for those compilers, NifSkope.pro adds the C++20 standard directly as a command line option around line 480 where compiler specific flags are handled. |
I made some changes to NifSkope.pro so that Clang now uses similar command line options to GCC, and I also made the addition of x86 specific options conditional. |
This is the actual error:
It looks like an issue with the Clang paths. |
Ok I"ve got a first version working : Need to change the below clang for Nifskope.pro : macx: { And the main.yml for macOS :
Remaining is to use macdeployqt tool and before the copy of the xml file into the Nifskope.app//Contents/MacOS to have a full working DMG image |
Latest action which is working fine for MacOS : addition : copy of xml files + macdeployqt There might be some adjustments to have a zip file containing the DMG image : release/NifSkope.dmg (not sure how it's created)
|
Thanks, I added this to main.yml, and it does seem to successfully compile now. I made these changes:
I cannot test the .dmg in build-macos.zip, but assuming it does work, how should the files be packaged for a release version? |
I changed the workflow file so it now only uploads the DMG as an artifact. I also added some previously missing files to the DMG, although some of these (like qt.conf and the .txt files) may not be needed. |
After searching for information on this issue, it looks like the GLSL version is limited to 120 on macOS, unless a core profile OpenGL 3.2+ context is used. NifSkope currently requests GL version 4.0, which would be enough for '#version 400' in the shaders, but it is compatibility profile (since a lot of code uses functions that were deprecated in OpenGL 3.x), and those are apparently not supported on macOS. So, the highest available versions are only OpenGL 2.1 and GLSL 120. At least for the older games, it should be possible to modify the shaders to work with '#version 120'. The Starfield and possibly Fallout 76 shaders may need to be removed from the DMG for the time being. |
I changed the workflow file to remove the Starfield shaders from the DMG, and all other shaders now only use GLSL 1.20. The noavx=1 workaround should also no longer be needed. The updated build can be found here, although I cannot test if the DMG works. |
Thank you, it's working perfectly fine now without any warning messages :) Maybe I can close this issue and corresponding PR #87 ? |
The issue and pull request are still relevant to this repository (hexabits/nifskope), so they might not need to be closed yet. By the way, I have now ported the Starfield shader as well to GLSL 1.20. Does this version work on macOS (or at least it compiles without errors if you do not have Starfield to test)? |
A preliminary Qt 6 build is now also available for testing here. Edit: I fixed the missing DLL in the Windows packages, and the Ubuntu workflow now finally also runs without errors. |
MacOS version is compiling fine with 2 adjustments : are PR accepted to fix such issue ?
-TEMPLATE = vcapp
+TEMPLATE = app
-CONFIG += c++20
+CONFIG += c++17
The text was updated successfully, but these errors were encountered: