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

Consider moving to CMake #242

Open
szhorvat opened this issue Oct 6, 2023 · 10 comments
Open

Consider moving to CMake #242

szhorvat opened this issue Oct 6, 2023 · 10 comments

Comments

@szhorvat
Copy link
Contributor

szhorvat commented Oct 6, 2023

Is your feature request related to a problem? Please describe.

XaoS has moved to Qt 6. The standard build system from Qt 6 is CMake, not qmake. Some package systems, such as MacPorts, do not have good support for qmake with Qt 6. Packaging XaoS 4.3+ would be much easier if it used CMake.

Describe the solution you'd like

Transition to a CMake-based build system.

Describe alternatives you've considered

To continue using qmake is troublesome and time consuming to set up with some package managers, such as MacPorts.

Additional context

@kovzol
Copy link
Contributor

kovzol commented Oct 8, 2023

That's a good idea, please contribute code if you have some details in mind. Thanks!

@kovzol
Copy link
Contributor

kovzol commented Jan 20, 2024

Please have a look at https://github.com/xaos-project/XaoS/blob/master/CMakeLists.txt -- it may work on Mac automatically. Thanks to Werner Volken for the first version of this configuration file.

@szhorvat
Copy link
Contributor Author

I'm getting:

/Users/szhorvat/Repos/XaoS/src/include/config.h:36:9: error: __float128 is not supported on this target

But I did not look into it in detail.

@kovzol
Copy link
Contributor

kovzol commented Jan 20, 2024

Yes, I'm fighting with the same issue. Thanks for the feedback.
It is because, seemingly, clang is used for compilation, and not gcc.

@szhorvat
Copy link
Contributor Author

I didn't look in the CMake file, but it seems that gcc / g++ are being forced. This shouldn't be done. Leave it to CMake to choose the compiler (which will then allow the user to use alternative compilers). On macOS, the gcc command is an alias for Clang. I do have GCC installed under a different name, but I cannot use it because the build system does not respec tthe compiler choice.

@szhorvat
Copy link
Contributor Author

So this is wrong:

# use gcc also Mac because Apple clang lacks quadmath support
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)

Apple does not distribute GCC. There is no way to force GCC on macOS. GCC can only be installed from other sources (MacPorts, Homebrew and the like).

@szhorvat
Copy link
Contributor Author

I can get around this by removing the above-mentioned two lines, but then I run into other issues which may not be related to XaoS. I'm getting this when using GCC 13 installed with MacPorts:

In file included from /opt/local/libexec/qt6/lib/QtCore.framework/Headers/qglobal.h:98,
                 from /opt/local/libexec/qt6/lib/QtCore.framework/Headers/QtCore:4,
                 from /opt/local/libexec/qt6/lib/QtWidgets.framework/Headers/QtWidgetsDepends:3,
                 from /opt/local/libexec/qt6/lib/QtWidgets.framework/Headers/QtWidgets:3,
                 from /Users/szhorvat/Repos/XaoS/src/ui/customdialog.cpp:1:
/opt/local/libexec/qt6/lib/QtGui.framework/Headers/qopenglcontext_platform.h:49:39: error: '#pragma' is not allowed here
   49 |     static QOpenGLContext *fromNative(QT_IGNORE_DEPRECATIONS(NSOpenGLContext) *context, QOpenGLContext *shareContext = nullptr);
      |                                       ^~~~~~~~~~~~~~~~~~~~~~

As you can see the complaint is about Qt code, not XaoS code.

@kovzol
Copy link
Contributor

kovzol commented Jan 20, 2024

I try to force it like this (on GitHub Actions):
mkdir cbuild; cd cbuild; cmake -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 ..
And it seems to be recognized correctly:

-- The C compiler identification is GNU 13.2.0
-- The CXX compiler identification is GNU 13.2.0

But still I get the error with the __float128 issue. Is it possible that clang is forced somewhere?

@kovzol
Copy link
Contributor

kovzol commented Jan 20, 2024

The current version compiles on both Linux and Mac. On Linux it is possible to start cmake with the -DDEEPZOOM=ON option. I think, something like adding -DCMAKE_C_COMPILER=gcc-13.2 -DCMAKE_CXX_COMPILER=g++-13.2 -DDEEPZOOM=ON could do the trick also on Mac, but I am afraid that this will not work on GitHub Actions for some reason.

@szhorvat
Copy link
Contributor Author

When I try to build with CMake on macOS, I get the following warning:

CMake Warning at /opt/local/libexec/qt6/lib/cmake/Qt6/FindWrapOpenGL.cmake:41 (target_link_libraries):
  Target "XaoS" requests linking to directory
  "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.5.sdk/System/Library/Frameworks".
  Targets may link only to libraries.  CMake is dropping the item.
Call Stack (most recent call first):
  /opt/local/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /opt/local/libexec/qt6/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:33 (find_dependency)
  /opt/local/libexec/qt6/lib/cmake/Qt6Gui/Qt6GuiDependencies.cmake:30 (_qt_internal_find_third_party_dependencies)
  /opt/local/libexec/qt6/lib/cmake/Qt6Gui/Qt6GuiConfig.cmake:40 (include)
  /opt/local/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /opt/local/libexec/qt6/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake:108 (find_dependency)
  /opt/local/libexec/qt6/lib/cmake/Qt6Widgets/Qt6WidgetsDependencies.cmake:39 (_qt_internal_find_qt_dependencies)
  /opt/local/libexec/qt6/lib/cmake/Qt6Widgets/Qt6WidgetsConfig.cmake:40 (include)
  /opt/local/libexec/qt6/lib/cmake/Qt6/Qt6Config.cmake:157 (find_package)
  CMakeLists.txt:114 (find_package)

The build does succeed though, and the app runs.

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

No branches or pull requests

2 participants