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

Patch upgrade form qmake to cmake #27

Open
wants to merge 4 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
18 changes: 14 additions & 4 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Copyright: None
License: CC0-1.0

# gitignore
Files: .clog.toml .gitignore org.freedesktop.UDisks2.ObjectManager.xml CHANGELOG.md
Files: .clog.toml .gitignore CHANGELOG.md src/org.freedesktop.UDisks2.ObjectManager.xml
Copyright: None
License: CC0-1.0

Expand All @@ -19,7 +19,7 @@ Copyright: None
License: CC0-1.0

# Project file
Files: *.pro *.pri
Files: *CMakeLists.txt config.h.in .tx/*
Copyright: None
License: CC0-1.0

Expand All @@ -28,7 +28,17 @@ Files: README.md README.zh_CN.md CHANGELOG.md
Copyright: UnionTech Software Technology Co., Ltd.
License: CC-BY-4.0

# org.freedesktop.UDisks2.xml
Files: org.freedesktop.UDisks2.xml
# src/org.freedesktop.UDisks2.xml
Files: src/org.freedesktop.UDisks2.xml
Copyright: 2011 David Zeuthen
License: LGPL-2.0-or-later

# src/modules
Files: src/modules/*
Copyright: 2024 usertow
License: LGPL-2.0-or-later

# src
Files: src/*
Copyright: UnionTech Software Technology Co., Ltd.
License: GPL-3.0-or-later
68 changes: 68 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)

project(udisks-qt LANGUAGES CXX VERSION 0.1.0)

find_package(Qt5 COMPONENTS Core DBus REQUIRED)

set(UDISKS_API_LEVEL "0")

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Forbid in-tree building
if(${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
message(STATUS "Please do an out-of-tree build:")
message(STATUS "rm -f CMakeCache.txt && mkdir build && cd build; cmake .. && make")
message(FATAL_ERROR "In-tree-build detected!")
endif(${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})

#
# Options
#

# NONE

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
"/usr" CACHE PATH "udisks default install prefix" FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

#
# Configure files
#
set (PREFIXDIR "${CMAKE_INSTALL_PREFIX}")
set (DATADIR "${CMAKE_INSTALL_PREFIX}/share")
set (PKGDATADIR "${DATA_INSTALL_DIR}")
set (LIBDIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
set (PKGLIBDIR "${LIBDIR}/udisks")
set (GETTEXT_PACKAGE "udisks")
set (LOCALE_DIR "${DATADIR}/locale")
set (VERSION "${UDISKS_VERSION}")
set (BUILDDIR "${CMAKE_BINARY_DIR}")
set (LOCALSTATEDIR "/var")

add_definitions("-DLOCALSTATEDIR=\"${LOCALSTATEDIR}\"")

set(CMAKE_INSTALL_LIBDIR "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Output directory for libraries")

configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h)

#
# Custom C flags
#
set (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self")
option (DISABLE_MAINTAINER_CFLAGS "Disable maintainer CFlags" ON)
if (DISABLE_MAINTAINER_CFLAGS)
set (MAINTAINER_CFLAGS "")
endif (DISABLE_MAINTAINER_CFLAGS)
add_definitions(${MAINTAINER_CFLAGS})

include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)

add_subdirectory(src)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ UDisks2 DBus interfaces binding of Qt5.
$ cd /path/to/your/source/code
$ mkdir build
$ cd build
$ qmake ../
$ cmake ../
$ make
$ sudo make install
```
Expand All @@ -33,4 +33,4 @@ We encourage you to report issues and contribute changes

## License

udisks2-qt5 is licensed under [GPL-3.0-or-later](LICENSE.txt)
udisks2-qt5 is licensed under [GPL-3.0-or-later](LICENSE.txt)
4 changes: 2 additions & 2 deletions README.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$ cd /path/to/your/source/code
$ mkdir build
$ cd build
$ qmake ../
$ cmake ../
$ make
$ sudo make install
```
Expand All @@ -34,4 +34,4 @@ $ sudo make install

## 开源许可证

udisks2-qt5 在 [GPL-3.0-or-later](LICENSE.txt)下发布。
udisks2-qt5 在 [GPL-3.0-or-later](LICENSE.txt)下发布。
19 changes: 19 additions & 0 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef CONFIG_H
#define CONFIG_H

/* Paths */
#define LOCALEDIR "@LOCALE_DIR@"
#define PKGDATADIR "@PKGDATADIR@"
#define PKGLIBDIR "@PKGLIBDIR@"
#define PREFIXDIR "@PREFIXDIR@"
#define DATADIR "@DATADIR@"
#define LIBDIR "@LIBDIR@"
#define BUILDDIR "@BUILDDIR@"

/* Define to the version of this package. */
#define PACKAGE_VERSION "@PROJECT_VERSION@"

/* Version number of package */
#define VERSION "@PROJECT_VERSION@"

#endif /*CONFIG_H*/
2 changes: 0 additions & 2 deletions private/private.pri

This file was deleted.

60 changes: 60 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
set(udisksqt_SRC
dblockdevice.cpp
dblockpartition.cpp
ddiskdevice.cpp
ddiskmanager.cpp
dudisksjob.cpp
udisks2_dbus_common.cpp
)

set(udisksqt_HEADERS
dblockdevice.h
dblockpartition.h
ddiskdevice.h
ddiskmanager.h
dudisksjob.h
udisks2_dbus_common.h
)

set(udisksqt_HEADERS_PRIVATE
private/dblockdevice_p.h
)

set_property(SOURCE org.freedesktop.UDisks2.xml PROPERTY INCLUDE udisks2_dbus_common.h)
set_property(SOURCE org.freedesktop.UDisks2.xml PROPERTY NO_NAMESPACE true)
qt5_add_dbus_interface(udisksqt_SRC org.freedesktop.UDisks2.xml udisks2_interface)

set_property(SOURCE org.freedesktop.DBus.ObjectManager.xml PROPERTY INCLUDE udisks2_dbus_common.h)
set_property(SOURCE org.freedesktop.DBus.ObjectManager.xml PROPERTY NO_NAMESPACE true)
qt5_add_dbus_interface(udisksqt_SRC org.freedesktop.UDisks2.ObjectManager.xml objectmanager_interface)

add_library(udisks2-qt5 SHARED ${udisksqt_SRC} ${udisksqt_HEADERS} ${udisksqt_HEADERS_PRIVATE})
set_target_properties(udisks2-qt5 PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${UDISKS_API_LEVEL})

list(APPEND udisksqt_HEADERS
${CMAKE_CURRENT_BINARY_DIR}/udisks2_interface.h
${CMAKE_CURRENT_BINARY_DIR}/objectmanager_interface.h
)
target_link_libraries(udisks2-qt5
Qt5::Core
Qt5::DBus
)

set_property(TARGET udisks2-qt5 PROPERTY COMPILE_DEFINITIONS UDISKS_STATIC)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/udisks2-qt5.pc.in
${CMAKE_CURRENT_BINARY_DIR}/udisks2-qt5.pc
@ONLY
)

install(TARGETS udisks2-qt5 DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/udisks2-qt5.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
install(FILES ${udisksqt_HEADERS}
DESTINATION include/udisks2-qt5
)
install(FILES ${udisksqt_HEADERS_PRIVATE}
DESTINATION include/udisks2-qt5/private
)
add_subdirectory(modules)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions src/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# CMakeLists for UDisks2-QT5 lib extra modules

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/udisks2qt5-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/udisks2qt5-config.cmake
@ONLY
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/udisks2qt5-config-version.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/udisks2qt5-config-version.cmake
@ONLY
)

install(FILES ${CMAKE_CURRENT_BINARY_DIR}/udisks2qt5-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/udisks2qt5-config-version.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/udisks2-qt5/
)
12 changes: 12 additions & 0 deletions src/modules/udisks2qt5-config-version.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SET(PACKAGE_VERSION @VERSION@)
IF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
SET(PACKAGE_VERSION_EXACT "true")
ENDIF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
IF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
SET(PACKAGE_VERSION_COMPATIBLE "true")
ELSE (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
SET(PACKAGE_VERSION_UNSUITABLE "true")
ENDIF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
IF (PACKAGE_VERSION_UNSUITABLE)
MESSAGE("VERSION CHECK FAILED FOR ${PACKAGE_FIND_NAME}. WANTED ${PACKAGE_FIND_VERSION}, HAVE ${PACKAGE_VERSION}")
ENDIF(PACKAGE_VERSION_UNSUITABLE)
11 changes: 11 additions & 0 deletions src/modules/udisks2qt5-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# - Config information for UDisks2-Qt5
# This file defines:
#
# UDisks2Qt5_INCLUDE_DIR - the UDisks2Qt5 include directory
# UDisks2Qt5_LIBRARIES - Link these to use UDisks2-Qt5

SET(prefix "@CMAKE_INSTALL_PREFIX@")
SET(exec_prefix "@CMAKE_INSTALL_PREFIX@")
SET(UDisks2Qt5_LIBRARIES "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libudisks2-qt5.so" CACHE FILEPATH "Libraries for UDisks2-Qt5")
SET(UDisks2Qt5_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/udisks2-qt5/" CACHE PATH "Include path for UDisks2-Qt5")
SET(UDisks2Qt5_FOUND "TRUE")
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions src/udisks2-qt5.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include/udisks2-qt5


Name: udisks2-qt5
Description: UDisks2 Library with Qt5
Version: 0.0.1
Libs: -ludisks2-qt5
Cflags: -I${includedir}
File renamed without changes.
File renamed without changes.
62 changes: 0 additions & 62 deletions udisks2.pro

This file was deleted.

Loading