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 #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.1.0)

project(dbusextended
VERSION 0.0.3
DESCRIPTION "Provides additional features to the QDBusAbstractInterface class")

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

include(FeatureSummary)
include(GNUInstallDirs)

set(QT_MIN_VERSION "5.6.0")
find_package(Qt5 COMPONENTS Core DBus REQUIRED)

add_subdirectory(src)

feature_summary(WHAT PACKAGES_FOUND PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
2 changes: 0 additions & 2 deletions dbusextended-qt.pro

This file was deleted.

27 changes: 17 additions & 10 deletions rpm/dbusextended.spec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ URL: https://github.com/nemomobile/qtdbusextended
Source0: %{name}-%{version}.tar.bz2
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
BuildRequires: cmake
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5DBus)

Expand All @@ -26,15 +27,20 @@ Development files for %{name}.
%setup -q -n %{name}-%{version}

%build

%qmake5

make %{?_smp_mflags}
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_INSTALL_LIBDIR=%{_lib} \
-DCMAKE_VERBOSE_MAKEFILE=ON \
..
cmake --build .

%install
cd build
rm -rf %{buildroot}

%qmake5_install
DESTDIR=%{buildroot} cmake --build . --target install

%post -p /sbin/ldconfig

Expand All @@ -47,9 +53,10 @@ rm -rf %{buildroot}
%files devel
%defattr(-,root,root,-)
%{_datarootdir}/qt5/mkspecs/features/%{name}.prf
%{_includedir}/qt5/DBusExtended/DBusExtended
%{_includedir}/qt5/DBusExtended/DBusExtendedAbstractInterface
%{_includedir}/qt5/DBusExtended/dbusextended.h
%{_includedir}/qt5/DBusExtended/dbusextendedabstractinterface.h
%{_includedir}/dbusextended/DBusExtended
%{_includedir}/dbusextended/DBusExtendedAbstractInterface
%{_includedir}/dbusextended/dbusextended.h
%{_includedir}/dbusextended/dbusextendedabstractinterface.h
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/cmake/dbusextended/*.cmake
65 changes: 65 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
set(SRC
dbusextendedabstractinterface.cpp
dbusextendedpendingcallwatcher.cpp
dbusextended.h
dbusextendedabstractinterface.h)
set(HEADERS
dbusextended.h
dbusextendedabstractinterface.h
DBusExtended
DBusExtendedAbstractInterface)

add_library(dbusextended SHARED ${SRC})

target_link_libraries(dbusextended
Qt5::Core
Qt5::DBus)
target_include_directories(dbusextended PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/libdbusextended>)

set_target_properties(dbusextended PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION})

# Create pkgconfig file
configure_file(dbusextended.pc.in
${CMAKE_CURRENT_BINARY_DIR}/dbusextended-qt5.pc
@ONLY)

configure_file(dbusextended-qt5.prf.in
${CMAKE_CURRENT_BINARY_DIR}/dbusextended-qt5.prf
@ONLY)

install(TARGETS dbusextended
EXPORT dbusextendedTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${HEADERS} DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/dbusextended)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dbusextended-qt5.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dbusextended-qt5.prf
DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt5/mkspecs/features/)

# Configure and install the CMake Config File
include(CMakePackageConfigHelpers)

configure_package_config_file(
"dbusextendedConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/dbusextendedConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/dbusextended/)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/dbusextendedConfigVersion.cmake
VERSION ${dbusextended_VERSION}
COMPATIBILITY AnyNewerVersion)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/dbusextendedConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/dbusextendedConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/dbusextended/
COMPONENT Devel)
export(TARGETS dbusextended FILE dbusextendedTargets.cmake)
install(EXPORT dbusextendedTargets
FILE dbusextendedTargets.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/dbusextended/
COMPONENT Devel)

2 changes: 1 addition & 1 deletion src/dbusextended-qt5.prf.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CONFIG += link_pkgconfig
PKGCONFIG += $$TARGET
PKGCONFIG += @PROJECT_NAME@
11 changes: 11 additions & 0 deletions src/dbusextended.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@

Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Libs: -l@PROJECT_NAME@
Cflags: -I${includedir}
Requires: Qt5Core Qt5DBus
7 changes: 7 additions & 0 deletions src/dbusextendedConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
find_dependency(Qt5Core @REQUIRED_QT_VERSION@)

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
@PACKAGE_INCLUDE_QCHTARGETS@
45 changes: 0 additions & 45 deletions src/src.pro

This file was deleted.