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

Port to CMake #4

Merged
merged 2 commits into from Apr 23, 2020
Merged

Port to CMake #4

merged 2 commits into from Apr 23, 2020

Conversation

PureTryOut
Copy link
Contributor

@PureTryOut PureTryOut commented Apr 2, 2020

qmake won't be developed anymore from Qt6 and they're switching to CMake, so let's do the same.

Should be functionally the same as with qmake (compiles for me both with and without mlite5 anyway), but you can now build with:

cmake
make
make install

@PureTryOut
Copy link
Contributor Author

I've tested this as a dependency of a qmake project (the quickcontrols-nemo examples) and as a dependency of a CMake project (glacier-calc with this PR), and both compile and run fine.

@PureTryOut
Copy link
Contributor Author

@neochapay I've re-added qdeclarative-boostable. However, I can not test it myself, so someone else needs to do it. I can only test the "not found" path 😉

@Kaffeine
Copy link

Kaffeine commented Apr 3, 2020

Please consider the modern approach with target names containing double colons, properly set up target_link_libraries() with proper PRIVATE/PUBLIC/INTERFACE linkage, add an alias target with double colons, etc.
I would suggest to use Glacier::App for this library and reserve the place for other components to be added later.

Consider an application linking as follow:

target_link_libraries(${PROJECT_NAME}
   glacierapp
)

glacierapp can be anything and in case of missing CMake target, the build system will link against libglacierapp happily ignoring the absence of linking information. You're going to have the same issue as we had with TelepathyQt. :-(

@PureTryOut
Copy link
Contributor Author

PureTryOut commented Apr 4, 2020

Thanks @Kaffeine! I'm still new to CMake so I'm learning while doing 😉

Please consider the modern approach with target names containing double colons, properly set up target_link_libraries() with proper PRIVATE/PUBLIC/INTERFACE linkage, add an alias target with double colons, etc.
I would suggest to use Glacier::App for this library and reserve the place for other components to be added later.

I guess I applied those changes now? I'm not sure, I have never seen target names with double colons before. I can't find any documentation on how to use namespacing and components properly, but I can build glacier-music with CMake and linking to Glacier::App now.

I'm not entirely sure when to set the target_link_libraries() with PRIVATE, PUBLIC, or INTERFACE. I've set it to PUBLIC for now, but how exactly do I know when it needs to be PRIVATE or INTERFACE?

src/CMakeLists.txt Outdated Show resolved Hide resolved
src/CMakeLists.txt Outdated Show resolved Hide resolved
Copy link

@Kaffeine Kaffeine left a comment

Choose a reason for hiding this comment

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

I didn't test it but it looks good to me.
+1

@neochapay
Copy link
Member

OBS Build fail

[   38s] + cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_VERBOSE_MAKEFILE=ON .
[   38s] -- The C compiler identification is GNU 8.3.0
[   38s] -- The CXX compiler identification is GNU 8.3.0
[   38s] -- Check for working C compiler: /usr/bin/cc
[   38s] -- Check for working C compiler: /usr/bin/cc -- works
[   38s] -- Detecting C compiler ABI info
[   38s] -- Detecting C compiler ABI info - done
[   38s] -- Detecting C compile features
[   39s] -- Detecting C compile features - done
[   39s] -- Check for working CXX compiler: /usr/bin/c++
[   39s] -- Check for working CXX compiler: /usr/bin/c++ -- works
[   39s] -- Detecting CXX compiler ABI info
[   39s] -- Detecting CXX compiler ABI info - done
[   39s] -- Detecting CXX compile features
[   40s] -- Detecting CXX compile features - done
[   40s] -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
[   40s] CMake Error at /usr/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake:27 (message):
[   40s]   The imported target "Qt5::Qml" references the file
[   40s] 
[   40s]      "/usr/lib/qt5/plugins/qmltooling/libqmldbg_messages.so"
[   40s] 
[   40s]   but this file does not exist.  Possible reasons include:
[   40s] 
[   40s]   * The file was deleted, renamed, or moved to another location.
[   40s] 
[   40s]   * An install or uninstall procedure did not complete successfully.
[   40s] 
[   40s]   * The installation package was faulty and contained
[   40s] 
[   40s]      "/usr/lib/cmake/Qt5Qml/Qt5Qml_QDebugMessageServiceFactory.cmake"
[   40s] 
[   40s]   but not all the files it references.
[   40s] 
[   40s] Call Stack (most recent call first):
[   40s]   /usr/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake:173 (_qt5_Qml_check_file_exists)
[   40s]   /usr/lib/cmake/Qt5Qml/Qt5Qml_QDebugMessageServiceFactory.cmake:4 (_populate_Qml_plugin_properties)
[   40s]   /usr/lib/cmake/Qt5Qml/Qt5QmlConfigExtras.cmake:4 (include)
[   40s]   /usr/lib/cmake/Qt5Qml/Qt5QmlConfig.cmake:186 (include)
[   40s]   /usr/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package)
[   40s]   CMakeLists.txt:18 (find_package)
[   40s] 
[   40s] 
[   40s] -- Configuring incomplete, errors occurred!
[   40s] See also "/home/abuild/rpmbuild/BUILD/libglacierapp-0.4.0+cmake.20200408150413.2.g82dbc4a/CMakeFiles/CMakeOutput.log".
[   40s] error: Bad exit status from /var/tmp/rpm-tmp.vLgH6B (%build)
[   40s] 
[   40s] 
[   40s] RPM build errors:
[   40s]     Bad exit status from /var/tmp/rpm-tmp.vLgH6B (%build)
[   43s] [   35.706627] SysRq : Power Off
[   43s] [   35.710170] reboot: Power down

@PureTryOut
Copy link
Contributor Author

Interesting. That file is provided by Qt5Declarative, which I would assume pkgconfig(Qt5Qml) would install. Do we have to explicitely depend on Qt5Declarative?

@Kaffeine
Copy link

Kaffeine commented Apr 9, 2020

CMake Find Module (namely Qt5QmlConfig.cmake) creates targets which reference to all available plugins. Later on CMake validates the targets and fails because the referenced files not found.
Qt5QmlConfig.cmake marked QDebugMessageServiceFactory as available because it found its CMake devel file /usr/lib/cmake/Qt5Qml/Qt5Qml_QDebugMessageServiceFactory.cmake. The package that containing this Qt5Qml_QDebugMessageServiceFactory.cmake devel file must requires the package that provides /usr/lib/qt5/plugins/qmltooling/libqmldbg_messages.so (and maybe some more files).

It is an issue in Mer packaging that devel rpm doesn't require its non-devel counterpart.

qmake won't be available anymore in Qt6 and they're switching to CMake,
so let's do the same
@neochapay neochapay merged commit 2468933 into nemomobile-ux:master Apr 23, 2020
@PureTryOut PureTryOut deleted the cmake branch April 23, 2020 11:31
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

3 participants