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: Support building as shared library / QML module. #35

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

sunweaver
Copy link

No description provided.

@sunweaver
Copy link
Author

@benlau Hi! I am currently packaging this project for Debian as it is needed to bring to Ubuntu Touch apps to Debian: telePORTS (a Telegram chat client) and Dekko2 (an email client).

For this, I need to be able to build quickflux as a shared library / QML module (rather then linking it into the application statically at build-time).

In this PR find a patch, that should achieve this (note: I haven't tested it yet, will do so soon).

CMakeLists.txt Outdated
@@ -6,8 +6,15 @@
cmake_minimum_required(VERSION 3.0.0)
project(quickflux VERSION 1.1.3)

option(quickflux_INSTALL "Enable the installation of targets." ON)
option(quickflux_BUILD_SHARED "Build as shared library" OFF)
Copy link

Choose a reason for hiding this comment

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

Maybe this should define BUILD_SHARED_LIBS, the CMake-integrated way of controlling this? https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html

CMakeLists.txt Outdated

if(quickflux_BUILD_SHARED)
SET(SOVERSION_MAJOR 1)
SET(SOVERSION_MINOR 0)
Copy link

Choose a reason for hiding this comment

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

Project version above is 1.1.3, where does the 0 here come from?

Copy link
Author

Choose a reason for hiding this comment

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

ouch! Typo.

CMakeLists.txt Outdated
)
add_library(QuickFlux::quickflux ALIAS quickflux)
if(quickflux_BUILD_SHARED)
add_library(quickflux SHARED
Copy link

Choose a reason for hiding this comment

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

See question about BUILD_SHARED_LIBS above, that would alleviate the need for duplicating all of this.

Copy link
Author

Choose a reason for hiding this comment

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

@OPNA2608 You are a much better CMake dev than I am. Could you come up with a follow-up PR bringing this more into harmony?

Copy link

Choose a reason for hiding this comment

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

Submitted as a PR to this branch: sunweaver#1

  • Use BUILD_SHARED_LIBS for determining static/dynamic library
  • Directly use PROJECT_VERSION for library versioning
  • Configure qmldir with @ONLY

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.

2 participants