Improve pistache-git
* Rename the library to avoid conflict with libnet * Export targets for easier usage in other CMake projects
This commit is contained in:
parent
c24a0672c1
commit
02818df548
|
@ -0,0 +1,82 @@
|
||||||
|
From b9aac8b2d284179f2c4339e72311d61b20cc3614 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Martchus <martchus@gmx.net>
|
||||||
|
Date: Thu, 23 Mar 2017 20:42:27 +0100
|
||||||
|
Subject: [PATCH 1/2] Call library target pistache to avoid conflict with
|
||||||
|
libnet
|
||||||
|
|
||||||
|
---
|
||||||
|
examples/CMakeLists.txt | 12 ++++++------
|
||||||
|
src/CMakeLists.txt | 12 ++++++------
|
||||||
|
tests/CMakeLists.txt | 2 +-
|
||||||
|
3 files changed, 13 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
|
||||||
|
index 253772d..079841b 100644
|
||||||
|
--- a/examples/CMakeLists.txt
|
||||||
|
+++ b/examples/CMakeLists.txt
|
||||||
|
@@ -1,21 +1,21 @@
|
||||||
|
add_executable(http_server http_server.cc)
|
||||||
|
-target_link_libraries(http_server net_static)
|
||||||
|
+target_link_libraries(http_server pistache)
|
||||||
|
|
||||||
|
add_executable(hello_server hello_server.cc)
|
||||||
|
-target_link_libraries(hello_server net_static)
|
||||||
|
+target_link_libraries(hello_server pistache)
|
||||||
|
|
||||||
|
add_executable(http_client http_client.cc)
|
||||||
|
-target_link_libraries(http_client net_static)
|
||||||
|
+target_link_libraries(http_client pistache)
|
||||||
|
|
||||||
|
add_executable(custom_header custom_header.cc)
|
||||||
|
-target_link_libraries(custom_header net_static)
|
||||||
|
+target_link_libraries(custom_header pistache)
|
||||||
|
|
||||||
|
add_executable(rest_server rest_server.cc)
|
||||||
|
-target_link_libraries(rest_server net_static)
|
||||||
|
+target_link_libraries(rest_server pistache)
|
||||||
|
|
||||||
|
find_package(RapidJSON)
|
||||||
|
if (RapidJSON_FOUND)
|
||||||
|
include_directories(${RapidJSON_INCLUDE_DIRS})
|
||||||
|
add_executable(rest_description rest_description.cc)
|
||||||
|
-target_link_libraries(rest_description net_static)
|
||||||
|
+target_link_libraries(rest_description pistache)
|
||||||
|
endif()
|
||||||
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||||
|
index 8fcecf1..60902dd 100644
|
||||||
|
--- a/src/CMakeLists.txt
|
||||||
|
+++ b/src/CMakeLists.txt
|
||||||
|
@@ -8,11 +8,11 @@ set(SOURCE_FILES
|
||||||
|
${CLIENT_SOURCE_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
-add_library(net_static ${SOURCE_FILES})
|
||||||
|
-target_link_libraries(net_static pthread)
|
||||||
|
-install(TARGETS net_static DESTINATION lib)
|
||||||
|
+add_library(pistache_static ${SOURCE_FILES})
|
||||||
|
+target_link_libraries(pistache_static pthread)
|
||||||
|
+install(TARGETS pistache_static DESTINATION lib)
|
||||||
|
|
||||||
|
-add_library(net SHARED ${SOURCE_FILES})
|
||||||
|
-target_link_libraries(net pthread)
|
||||||
|
-install(TARGETS net DESTINATION lib)
|
||||||
|
+add_library(pistache SHARED ${SOURCE_FILES})
|
||||||
|
+target_link_libraries(pistache pthread)
|
||||||
|
+install(TARGETS pistache DESTINATION lib)
|
||||||
|
|
||||||
|
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||||
|
index 155a411..bcf48ab 100644
|
||||||
|
--- a/tests/CMakeLists.txt
|
||||||
|
+++ b/tests/CMakeLists.txt
|
||||||
|
@@ -3,7 +3,7 @@ function(pistache_test test_name)
|
||||||
|
set(TEST_SOURCE ${test_name}.cc)
|
||||||
|
|
||||||
|
add_executable(${TEST_EXECUTABLE} ${TEST_SOURCE})
|
||||||
|
- target_link_libraries(${TEST_EXECUTABLE} gtest gtest_main net_static)
|
||||||
|
+ target_link_libraries(${TEST_EXECUTABLE} gtest gtest_main pistache)
|
||||||
|
add_test(${test_name} ${TEST_EXECUTABLE})
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
--
|
||||||
|
2.12.1
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
From 431986f951f5f5b3028e9262eed0e56d0f861dee Mon Sep 17 00:00:00 2001
|
||||||
|
From: Martchus <martchus@gmx.net>
|
||||||
|
Date: Thu, 23 Mar 2017 20:50:21 +0100
|
||||||
|
Subject: [PATCH 2/2] Export targets
|
||||||
|
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 2 +-
|
||||||
|
src/CMakeLists.txt | 29 +++++++++++++++++++++++++++--
|
||||||
|
src/PistacheConfig.cmake.in | 4 ++++
|
||||||
|
3 files changed, 32 insertions(+), 3 deletions(-)
|
||||||
|
create mode 100644 src/PistacheConfig.cmake.in
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index e2c9916..0197e24 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-cmake_minimum_required (VERSION 2.8.7)
|
||||||
|
+cmake_minimum_required (VERSION 3.0.2)
|
||||||
|
project (pistache)
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
|
||||||
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||||
|
index 60902dd..c1d88e4 100644
|
||||||
|
--- a/src/CMakeLists.txt
|
||||||
|
+++ b/src/CMakeLists.txt
|
||||||
|
@@ -10,9 +10,34 @@ set(SOURCE_FILES
|
||||||
|
|
||||||
|
add_library(pistache_static ${SOURCE_FILES})
|
||||||
|
target_link_libraries(pistache_static pthread)
|
||||||
|
-install(TARGETS pistache_static DESTINATION lib)
|
||||||
|
+install(TARGETS pistache_static
|
||||||
|
+ EXPORT PistacheStaticTargets
|
||||||
|
+ DESTINATION lib)
|
||||||
|
+install(EXPORT PistacheStaticTargets
|
||||||
|
+ DESTINATION "lib/cmake/pistache"
|
||||||
|
+ EXPORT_LINK_INTERFACE_LIBRARIES
|
||||||
|
+ COMPONENT cmake-config
|
||||||
|
+)
|
||||||
|
|
||||||
|
add_library(pistache SHARED ${SOURCE_FILES})
|
||||||
|
target_link_libraries(pistache pthread)
|
||||||
|
-install(TARGETS pistache DESTINATION lib)
|
||||||
|
+install(TARGETS pistache
|
||||||
|
+ EXPORT PistacheSharedTargets
|
||||||
|
+ DESTINATION lib)
|
||||||
|
+install(EXPORT PistacheSharedTargets
|
||||||
|
+ DESTINATION "lib/cmake/pistache"
|
||||||
|
+ EXPORT_LINK_INTERFACE_LIBRARIES
|
||||||
|
+ COMPONENT cmake-config
|
||||||
|
+)
|
||||||
|
|
||||||
|
+include(CMakePackageConfigHelpers)
|
||||||
|
+configure_package_config_file(
|
||||||
|
+ "PistacheConfig.cmake.in"
|
||||||
|
+ "${CMAKE_CURRENT_BINARY_DIR}/PistacheConfig.cmake"
|
||||||
|
+ INSTALL_DESTINATION "lib/cmake/pistache"
|
||||||
|
+)
|
||||||
|
+install(
|
||||||
|
+ FILES "${CMAKE_CURRENT_BINARY_DIR}/PistacheConfig.cmake"
|
||||||
|
+ DESTINATION "lib/cmake/pistache"
|
||||||
|
+ COMPONENT cmake-config
|
||||||
|
+)
|
||||||
|
diff --git a/src/PistacheConfig.cmake.in b/src/PistacheConfig.cmake.in
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..a5dca28
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/PistacheConfig.cmake.in
|
||||||
|
@@ -0,0 +1,4 @@
|
||||||
|
+@PACKAGE_INIT@
|
||||||
|
+
|
||||||
|
+include("${CMAKE_CURRENT_LIST_DIR}/PistacheSharedTargets.cmake")
|
||||||
|
+include("${CMAKE_CURRENT_LIST_DIR}/PistacheStaticTargets.cmake")
|
||||||
|
--
|
||||||
|
2.12.1
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
pkgname=pistache-git
|
pkgname=pistache-git
|
||||||
_name=${pkgname%-git}
|
_name=${pkgname%-git}
|
||||||
pkgver=176.8604968-1
|
pkgver=176.8604968
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
pkgdesc='Modern and elegant HTTP and REST framework for C++'
|
pkgdesc='Modern and elegant HTTP and REST framework for C++'
|
||||||
|
@ -15,14 +15,25 @@ makedepends=('cmake' 'git')
|
||||||
provides=("${_name}")
|
provides=("${_name}")
|
||||||
conflicts=("${_name}")
|
conflicts=("${_name}")
|
||||||
url="https://github.com/oktal/${_name}"
|
url="https://github.com/oktal/${_name}"
|
||||||
source=("${_name}::git://github.com/oktal/${_name}.git")
|
source=("${_name}::git://github.com/oktal/${_name}.git"
|
||||||
sha256sums=('SKIP')
|
'0001-Call-library-target-pistache-to-avoid-conflict-with-.patch'
|
||||||
|
'0002-Export-targets.patch')
|
||||||
|
sha256sums=('SKIP'
|
||||||
|
'28383926baaa5f8b57f3513d21cafe8997dc779cff8170676904c39e20e7a71e'
|
||||||
|
'4e2a5cc2bd0c1c85d9bbff03325af03fb1742aefed7dbada231e76b4ad2d20e7')
|
||||||
|
|
||||||
pkgver() {
|
pkgver() {
|
||||||
cd "${srcdir}/${_name}"
|
cd "${srcdir}/${_name}"
|
||||||
echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
|
echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
cd "${srcdir}/${_name}"
|
||||||
|
|
||||||
|
patch -p1 -i "${srcdir}/0001-Call-library-target-pistache-to-avoid-conflict-with-.patch"
|
||||||
|
patch -p1 -i "${srcdir}/0002-Export-targets.patch"
|
||||||
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "${srcdir}/${_name}"
|
cd "${srcdir}/${_name}"
|
||||||
cmake \
|
cmake \
|
||||||
|
@ -31,6 +42,11 @@ build() {
|
||||||
make
|
make
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
cd "${srcdir}/${_name}"
|
||||||
|
make test
|
||||||
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
cd "${srcdir}/${_name}"
|
cd "${srcdir}/${_name}"
|
||||||
make DESTDIR="${pkgdir}" install
|
make DESTDIR="${pkgdir}" install
|
||||||
|
|
Loading…
Reference in New Issue