diff options
author | Dan Vrátil <dvratil@redhat.com> | 2015-05-15 16:01:11 +0200 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2015-05-15 16:22:30 +0200 |
commit | 4a55ae0536e46020ca17070155a3223536e36703 (patch) | |
tree | 180b06f1f5daf1e28164303395a9f203ebf40644 | |
parent | 5b78e0da1d64b6096829f54b29f14ec5643b5ece (diff) | |
download | sink-4a55ae0536e46020ca17070155a3223536e36703.tar.gz sink-4a55ae0536e46020ca17070155a3223536e36703.zip |
Async: make it a stand-alone CMake project
-rw-r--r-- | async/CMakeLists.txt | 71 | ||||
-rw-r--r-- | async/KF5AsyncConfig.cmake.in | 3 | ||||
-rw-r--r-- | async/autotests/CMakeLists.txt | 18 | ||||
-rw-r--r-- | async/src/CMakeLists.txt | 64 |
4 files changed, 134 insertions, 22 deletions
diff --git a/async/CMakeLists.txt b/async/CMakeLists.txt index a6b53f8..6a93a2c 100644 --- a/async/CMakeLists.txt +++ b/async/CMakeLists.txt | |||
@@ -1,12 +1,73 @@ | |||
1 | project(libasync) | 1 | project(KAsync) |
2 | 2 | ||
3 | option(WITH_KJOB "Enable native support for KJob in libasync API (enabled by default)" ON) | 3 | cmake_minimum_required(VERSION 2.8.12) |
4 | |||
5 | # ECM setup | ||
6 | find_package(ECM 5.10.0 CONFIG REQUIRED) | ||
7 | set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) | ||
8 | |||
9 | include(GenerateExportHeader) | ||
10 | include(ECMGenerateHeaders) | ||
11 | include(ECMGeneratePriFile) | ||
12 | include(ECMPackageConfigHelpers) | ||
13 | include(ECMSetupVersion) | ||
14 | include(FeatureSummary) | ||
15 | include(KDEInstallDirs) | ||
16 | include(KDECMakeSettings) | ||
17 | include(KDEFrameworkCompilerSettings) | ||
18 | |||
19 | set(KASYNC_VERSION "4.99.0") | ||
20 | |||
21 | set(KF5_VERSION "5.10.0") | ||
22 | set(QT_REQUIRED_VERSION "5.2.0") | ||
23 | |||
24 | ecm_setup_version(${KASYNC_VERSION} | ||
25 | VARIABLE_PREFIX KASYNC | ||
26 | VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kasync_version.h" | ||
27 | PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5AsyncConfigVersion.cmake" | ||
28 | SOVERSION 5 | ||
29 | ) | ||
30 | |||
31 | |||
32 | ########### Find packages ########### | ||
33 | find_package(Qt5 ${QT_REQUIRED_VERSION} REQUIRED COMPONENTS Core Test) | ||
4 | 34 | ||
35 | option(WITH_KJOB "Enable native support for KJob in libasync API (enabled by default)" ON) | ||
5 | if (WITH_KJOB) | 36 | if (WITH_KJOB) |
6 | set(MINUMUM_FRAMEWORKS_VERSION "5.8.0") | 37 | find_package(KF5CoreAddons REQUIRED ${KF5_VERSION}) |
7 | find_package(KF5CoreAddons REQUIRED ${MINUMUM_FRAMEWORKS_VERSION}) | ||
8 | add_definitions(-DWITH_KJOB) | 38 | add_definitions(-DWITH_KJOB) |
9 | endif() | 39 | endif() |
10 | 40 | ||
41 | ########### Targets ########### | ||
11 | add_subdirectory(src) | 42 | add_subdirectory(src) |
12 | add_subdirectory(autotests) \ No newline at end of file | 43 | add_subdirectory(autotests) |
44 | |||
45 | |||
46 | ########### CMake Config Files ########### | ||
47 | set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5Async") | ||
48 | |||
49 | ecm_configure_package_config_file( | ||
50 | "${CMAKE_CURRENT_SOURCE_DIR}/KF5AsyncConfig.cmake.in" | ||
51 | "${CMAKE_CURRENT_BINARY_DIR}/KF5AsyncConfig.cmake" | ||
52 | INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} | ||
53 | ) | ||
54 | |||
55 | install(FILES | ||
56 | "${CMAKE_CURRENT_BINARY_DIR}/KF5AsyncConfig.cmake" | ||
57 | "${CMAKE_CURRENT_BINARY_DIR}/KF5AsyncConfigVersion.cmake" | ||
58 | DESTINATION "${CMAKECONFIG_INSTALL_DIR}" | ||
59 | COMPONENT Devel | ||
60 | ) | ||
61 | |||
62 | install(EXPORT | ||
63 | KF5AsyncTargets | ||
64 | DESTINATION "${CMAKECONFIG_INSTALL_DIR}" | ||
65 | FILE KF5AsyncTargets.cmake | ||
66 | NAMESPACE KF5::) | ||
67 | |||
68 | install(FILES | ||
69 | ${CMAKE_CURRENT_BINARY_DIR}/kasync_version.h | ||
70 | DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel | ||
71 | ) | ||
72 | |||
73 | feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) | ||
diff --git a/async/KF5AsyncConfig.cmake.in b/async/KF5AsyncConfig.cmake.in new file mode 100644 index 0000000..d11b836 --- /dev/null +++ b/async/KF5AsyncConfig.cmake.in | |||
@@ -0,0 +1,3 @@ | |||
1 | @PACKAGE_INIT@ | ||
2 | |||
3 | include("${CMAKE_CURRENT_LIST_DIR}/KF5AsyncTargets.cmake") | ||
diff --git a/async/autotests/CMakeLists.txt b/async/autotests/CMakeLists.txt index 8116f13..b2209ab 100644 --- a/async/autotests/CMakeLists.txt +++ b/async/autotests/CMakeLists.txt | |||
@@ -1,11 +1,13 @@ | |||
1 | include_directories(../src ${CMAKE_CURRENT_BINARY_DIR}) | 1 | include(ECMAddTests) |
2 | 2 | ||
3 | add_executable(asynctest asynctest.cpp) | 3 | ecm_add_test(asynctest.cpp |
4 | qt5_use_modules(asynctest Test) | 4 | TEST_NAME asynctest |
5 | target_link_libraries(asynctest akonadi2async Qt5::Core Qt5::Test) | 5 | LINK_LIBRARIES KF5Async Qt5::Test |
6 | ) | ||
6 | 7 | ||
7 | if (WITH_KJOB) | 8 | if (WITH_KJOB) |
8 | add_executable(kjobtest kjobtest.cpp testkjob.cpp) | 9 | ecm_add_test(kjobtest.cpp testkjob.cpp |
9 | qt5_use_modules(kjobtest Test) | 10 | TEST_NAME kjobtest |
10 | target_link_libraries(kjobtest akonadi2async Qt5::Core Qt5::Test KF5::CoreAddons) | 11 | LINK_LIBRARIES KF5Async Qt5::Test KF5::CoreAddons |
11 | endif () \ No newline at end of file | 12 | ) |
13 | endif() | ||
diff --git a/async/src/CMakeLists.txt b/async/src/CMakeLists.txt index becc8ee..05d08b6 100644 --- a/async/src/CMakeLists.txt +++ b/async/src/CMakeLists.txt | |||
@@ -1,17 +1,63 @@ | |||
1 | project(akonadi2async) | 1 | set(kasync_SRCS |
2 | |||
3 | include_directories(${CMAKE_CURRENT_BINARY_DIR}) | ||
4 | |||
5 | set(async_SRCS | ||
6 | async.cpp | 2 | async.cpp |
7 | future.cpp | 3 | future.cpp |
8 | debug.cpp | 4 | debug.cpp |
9 | ) | 5 | ) |
10 | 6 | ||
11 | add_library(${PROJECT_NAME} SHARED ${async_SRCS}) | 7 | set(kasync_priv_HEADERS |
12 | target_link_libraries(${PROJECT_NAME} PUBLIC Qt5::Core) | 8 | async_impl.h |
9 | debug.h | ||
10 | ) | ||
11 | |||
12 | ecm_generate_headers(kasync_HEADERS | ||
13 | HEADER_NAMES | ||
14 | Async | ||
15 | Future | ||
16 | ) | ||
17 | |||
18 | |||
19 | add_library(KF5Async ${kasync_SRCS}) | ||
20 | add_library(KF5::Async ALIAS KF5Async) | ||
21 | |||
22 | generate_export_header(KF5Async BASE_NAME kasync) | ||
23 | |||
24 | target_include_directories(KF5Async INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/Async>") | ||
25 | target_include_directories(KF5Async PUBLIC "$<BUILD_INTERFACE:${KAsync_SOURCE_DIR}/src>") | ||
26 | |||
27 | target_link_libraries(KF5Async | ||
28 | PUBLIC | ||
29 | Qt5::Core | ||
30 | ) | ||
13 | if (WITH_KJOB) | 31 | if (WITH_KJOB) |
14 | target_link_libraries(${PROJECT_NAME} PUBLIC KF5::CoreAddons) | 32 | target_link_libraries(KF5Async PUBLIC KF5::CoreAddons) |
15 | endif () | 33 | endif () |
16 | 34 | ||
17 | install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) | 35 | |
36 | set_target_properties(KF5Async PROPERTIES | ||
37 | VERSION ${KASYNC_VERSION_STRING} | ||
38 | SOVERSION ${KASYNC_SOVERSION} | ||
39 | EXPORT_NAME KAsync | ||
40 | ) | ||
41 | |||
42 | ecm_generate_pri_file(BASE_NAME KAsync | ||
43 | LIB_NAME KF5Async | ||
44 | FILENAME_VAR PRI_FILENAME | ||
45 | ) | ||
46 | |||
47 | install(TARGETS | ||
48 | KF5Async | ||
49 | EXPORT KF5AsyncTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} | ||
50 | ) | ||
51 | |||
52 | install(FILES | ||
53 | ${CMAKE_CURRENT_BINARY_DIR}/kasync_export.h | ||
54 | ${kasync_HEADERS} | ||
55 | ${kasync_priv_HEADERS} | ||
56 | DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/Async | ||
57 | COMPONENT Devel | ||
58 | ) | ||
59 | |||
60 | install(FILES | ||
61 | ${PRI_FILENAME} | ||
62 | DESTINATION ${ECM_MKSPECS_INSTALL_DIR} | ||
63 | ) | ||