From 7aaab5e80726b48e15c88c2788babe95f37d0278 Mon Sep 17 00:00:00 2001 From: blue Date: Tue, 3 Dec 2024 19:36:07 +0200 Subject: [PATCH] builds with different names to coexist --- .gitea/workflows/release.yml | 4 +-- CMakeLists.txt | 67 ++++++++++++++++++----------------- packaging/Archlinux/PKGBUILD | 8 ++--- src/CMakeLists.txt | 4 +-- src/serializer/CMakeLists.txt | 2 +- test/CMakeLists.txt | 2 +- 6 files changed, 45 insertions(+), 42 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index d20a949..ad68d3f 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -12,7 +12,7 @@ jobs: package-name: lmdbal-qt5 description: LMDB Abstraction Layer, qt5 version depends: 'qt5-base' - flags: -D QT_VERSION_MAJOR=5 + flags: -D QT_VERSION_MAJOR=5 -D LMDBAL_NAME=LMDBAL-QT5 secrets: DEPLOY_TO_AUR_PRIVATE_KEY: ${{ secrets.DEPLOY_TO_AUR_PRIVATE_KEY }} DEPLOY_TO_AUR_USER_NAME: ${{ secrets.DEPLOY_TO_AUR_USER_NAME }} @@ -25,7 +25,7 @@ jobs: package-name: lmdbal-qt6 description: LMDB Abstraction Layer, qt6 version depends: 'qt6-base' - flags: -D QT_VERSION_MAJOR=6 + flags: -D QT_VERSION_MAJOR=6 -D LMDBAL_NAME=LMDBAL-QT5 secrets: DEPLOY_TO_AUR_PRIVATE_KEY: ${{ secrets.DEPLOY_TO_AUR_PRIVATE_KEY }} DEPLOY_TO_AUR_USER_NAME: ${{ secrets.DEPLOY_TO_AUR_USER_NAME }} diff --git a/CMakeLists.txt b/CMakeLists.txt index dcafaa1..a518d7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,12 @@ project(LMDBAL DESCRIPTION "LMDB (Lightning Memory-Mapped Database Manager) Abstraction Layer" LANGUAGES CXX ) -string(TOLOWER ${PROJECT_NAME} PROJECT_LOW) cmake_policy(SET CMP0076 NEW) cmake_policy(SET CMP0079 NEW) +set(LMDBAL_NAME ${PROJECT_NAME} CACHE STRING "Override for library name and install path") + option(BUILD_STATIC "Builds library as static library" OFF) option(BUILD_TESTS "Builds tests" OFF) option(BUILD_DOC_MAN "Builds man page documentation" OFF) @@ -25,6 +26,8 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +string(TOLOWER ${LMDBAL_NAME} LMDBAL_NAME_LOW) + if (NOT DEFINED QT_VERSION_MAJOR) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) endif() @@ -38,9 +41,9 @@ if (NOT CMAKE_BUILD_TYPE) endif () if (BUILD_STATIC) - add_library(${PROJECT_NAME} STATIC) + add_library(${LMDBAL_NAME} STATIC) else () - add_library(${PROJECT_NAME} SHARED) + add_library(${LMDBAL_NAME} SHARED) endif() if (CMAKE_BUILD_TYPE STREQUAL "Release") @@ -52,21 +55,21 @@ elseif (CMAKE_BUILD_TYPE STREQUAL "Debug") endif() message("Compilation options: " ${COMPILE_OPTIONS}) -target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS}) +target_compile_options(${LMDBAL_NAME} PRIVATE ${COMPILE_OPTIONS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY VERSION ${version}) -set_property(TARGET ${PROJECT_NAME} PROPERTY SOVERSION 1) -set_property(TARGET ${PROJECT_NAME} PROPERTY EXPORT_NAME ${PROJECT_NAME}) -set_property(TARGET ${PROJECT_NAME} PROPERTY INTERFACE_${PROJECT_NAME}_MAJOR_VERSION 1) -set_property(TARGET ${PROJECT_NAME} APPEND PROPERTY - COMPATIBLE_INTERFACE_STRING ${PROJECT_NAME}_MAJOR_VERSION +set_property(TARGET ${LMDBAL_NAME} PROPERTY VERSION ${version}) +set_property(TARGET ${LMDBAL_NAME} PROPERTY SOVERSION 1) +set_property(TARGET ${LMDBAL_NAME} PROPERTY EXPORT_NAME ${LMDBAL_NAME}) +set_property(TARGET ${LMDBAL_NAME} PROPERTY INTERFACE_${LMDBAL_NAME}_MAJOR_VERSION 1) +set_property(TARGET ${LMDBAL_NAME} APPEND PROPERTY + COMPATIBLE_INTERFACE_STRING ${LMDBAL_NAME}_MAJOR_VERSION ) if (UNIX) - set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${PROJECT_LOW}") - set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) - set_property(TARGET ${PROJECT_NAME} PROPERTY SKIP_BUILD_RPATH FALSE) - set_property(TARGET ${PROJECT_NAME} PROPERTY BUILD_WITH_INSTALL_RPATH FALSE) + set_property(TARGET ${LMDBAL_NAME} PROPERTY INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/${LMDBAL_NAME_LOW}") + set_property(TARGET ${LMDBAL_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) + set_property(TARGET ${LMDBAL_NAME} PROPERTY SKIP_BUILD_RPATH FALSE) + set_property(TARGET ${LMDBAL_NAME} PROPERTY BUILD_WITH_INSTALL_RPATH FALSE) endif() add_subdirectory(src) @@ -84,47 +87,47 @@ if (BUILD_TESTS) endif () target_include_directories( - ${PROJECT_NAME} + ${LMDBAL_NAME} PUBLIC - $ + $ $ $ ) -target_include_directories(${PROJECT_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS}) -target_include_directories(${PROJECT_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}Core_INCLUDE_DIRS}) +target_include_directories(${LMDBAL_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}_INCLUDE_DIRS}) +target_include_directories(${LMDBAL_NAME} PRIVATE ${Qt${QT_VERSION_MAJOR}Core_INCLUDE_DIRS}) target_link_libraries( - ${PROJECT_NAME} + ${LMDBAL_NAME} Qt${QT_VERSION_MAJOR}::Core lmdb ) configure_package_config_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOW}Config.cmake" - INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_LOW} + "${CMAKE_CURRENT_BINARY_DIR}/${LMDBAL_NAME_LOW}Config.cmake" + INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LMDBAL_NAME_LOW} ) write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOW}ConfigVersion.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${LMDBAL_NAME_LOW}ConfigVersion.cmake" VERSION "${version}" COMPATIBILITY AnyNewerVersion ) -install(TARGETS ${PROJECT_NAME} - EXPORT ${PROJECT_LOW}Targets +install(TARGETS ${LMDBAL_NAME} + EXPORT ${LMDBAL_NAME_LOW}Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LMDBAL_NAME_LOW} ) -install(EXPORT ${PROJECT_LOW}Targets - FILE ${PROJECT_LOW}Targets.cmake - NAMESPACE ${PROJECT_NAME}:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_LOW} +install(EXPORT ${LMDBAL_NAME_LOW}Targets + FILE ${LMDBAL_NAME_LOW}Targets.cmake + NAMESPACE ${LMDBAL_NAME}:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LMDBAL_NAME_LOW} ) install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOW}Config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_LOW}ConfigVersion.cmake" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_LOW} + "${CMAKE_CURRENT_BINARY_DIR}/${LMDBAL_NAME_LOW}Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/${LMDBAL_NAME_LOW}ConfigVersion.cmake" + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LMDBAL_NAME_LOW} ) diff --git a/packaging/Archlinux/PKGBUILD b/packaging/Archlinux/PKGBUILD index f1dba99..28ef6d6 100644 --- a/packaging/Archlinux/PKGBUILD +++ b/packaging/Archlinux/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Yury Gubich pkgname=lmdbal pkgver=1.0.0 -pkgrel=1 +pkgrel=2 pkgdesc="LMDB Abstraction Layer" arch=('i686' 'x86_64') url="https://git.macaw.me/blue/lmdbal" @@ -10,14 +10,14 @@ depends=( 'lmdb' ) makedepends=('cmake>=3.16' 'gcc') optdepends=() -source=("$pkgname-$pkgver.tar.gz::https://git.macaw.me/blue/$pkgname/archive/$pkgver.tar.gz") +source=("lmdbal-$pkgver.tar.gz::https://git.macaw.me/blue/lmdbal/archive/$pkgver.tar.gz") sha256sums=('SKIP') build() { - cd "$srcdir/$pkgname" + cd "$srcdir/lmdbal" cmake . -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=Release cmake --build . } package() { - cd "$srcdir/$pkgname" + cd "$srcdir/lmdbal" DESTDIR="$pkgdir/" cmake --install . } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 956e6b0..9332fd8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,8 +18,8 @@ set(HEADERS transaction.h ) -target_sources(${PROJECT_NAME} PRIVATE ${SOURCES}) +target_sources(${LMDBAL_NAME} PRIVATE ${SOURCES}) add_subdirectory(serializer) -install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW}) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LMDBAL_NAME_LOW}) diff --git a/src/serializer/CMakeLists.txt b/src/serializer/CMakeLists.txt index 0c0a633..2df8e47 100644 --- a/src/serializer/CMakeLists.txt +++ b/src/serializer/CMakeLists.txt @@ -16,4 +16,4 @@ set(HEADERS serializer_qbytearray.hpp ) -install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_LOW}) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LMDBAL_NAME_LOW}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 93d54e3..63e0701 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -20,7 +20,7 @@ target_include_directories(runUnitTests PRIVATE ${Qt${QT_VERSION_MAJOR}Core_INCL target_link_libraries( runUnitTests GTest::gtest_main - ${PROJECT_NAME} + ${LMDBAL_NAME} Qt${QT_VERSION_MAJOR}::Core ) include(GoogleTest)