[evpp] Overhaul (#46714)

This commit is contained in:
Kai Pastor 2025-08-06 05:55:06 +02:00 committed by GitHub
parent 9840ab8e7a
commit f950945f3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 305 additions and 423 deletions

View File

@ -1,98 +1,114 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 17b0a1c..7a054b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,30 @@ set(CMAKE_CXX_STANDARD 14)
project (safe-evpp C CXX)
+macro(install_shared_or_static_targets)
+ get_directory_property(shared_targets BUILDSYSTEM_TARGETS)
+ list(FILTER shared_targets EXCLUDE REGEX "_static")
+ get_directory_property(static_targets BUILDSYSTEM_TARGETS)
+ list(FILTER static_targets INCLUDE REGEX "_static")
+ if(SHARED)
+ set_target_properties(${static_targets} PROPERTIES EXCLUDE_FROM_ALL 1)
+ install (
+ TARGETS ${shared_targets}
+ EXPORT evpp-targets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+ else()
+ set_target_properties(${shared_targets} PROPERTIES EXCLUDE_FROM_ALL 1)
+ install (
+ TARGETS ${static_targets}
+ EXPORT evpp-targets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+ endif()
+endmacro()
+
if (UNIX)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
diff --git a/apps/evmc/CMakeLists.txt b/apps/evmc/CMakeLists.txt
index 9918919..f8cffa7 100644
index 888c672..e1ee45e 100644
--- a/apps/evmc/CMakeLists.txt
+++ b/apps/evmc/CMakeLists.txt
@@ -9,6 +9,7 @@ add_library(evmc_static STATIC ${evmc_SRCS})
target_link_libraries(evmc_static ${LIBRARIES})
if (UNIX)
+ if(BUILD_SHARED_LIBS)
add_library(evmc SHARED ${evmc_SRCS})
target_link_libraries(evmc ${LIBRARIES})
@@ -25,6 +26,7 @@ if (UNIX)
TARGETS evmc
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
+ endif()
@@ -20,18 +20,9 @@ if (UNIX)
VERSION "${PACKAGE_VERSION}"
SOVERSION "${PACKAGE_SOVERSION}"
)
-
- install (
- TARGETS evmc
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
endif (UNIX)
install (
-install (
- TARGETS evmc_static
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-install (FILES ${evmc_PUBLIC_HEADERS} DESTINATION "include/evmc")
+install_shared_or_static_targets()
if (NOT EVPP_VCPKG_BUILD)
diff --git a/apps/evnsq/CMakeLists.txt b/apps/evnsq/CMakeLists.txt
index c510814..65f15cd 100644
index a4d4113..aa3b800 100644
--- a/apps/evnsq/CMakeLists.txt
+++ b/apps/evnsq/CMakeLists.txt
@@ -5,6 +5,7 @@ add_library(evnsq_static STATIC ${evnsq_SRCS})
target_link_libraries(evnsq_static ${LIBRARIES})
if (UNIX)
+ if(BUILD_SHARED_LIBS)
add_library(evnsq SHARED ${evnsq_SRCS})
target_link_libraries(evnsq ${LIBRARIES})
@@ -21,6 +22,7 @@ if (UNIX)
TARGETS evnsq
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
+ endif()
@@ -16,18 +16,9 @@ if (UNIX)
VERSION "${PACKAGE_VERSION}"
SOVERSION "${PACKAGE_SOVERSION}"
)
-
- install (
- TARGETS evnsq
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
endif (UNIX)
install (
-install (
- TARGETS evnsq_static
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-install (FILES ${evnsq_PUBLIC_HEADERS} DESTINATION "include/evnsq")
+install_shared_or_static_targets()
if (NOT EVPP_VCPKG_BUILD)
add_subdirectory(evnsqtail)
diff --git a/evpp/CMakeLists.txt b/evpp/CMakeLists.txt
index 031659f..c16d708 100644
index 73ee071..bb97c38 100644
--- a/evpp/CMakeLists.txt
+++ b/evpp/CMakeLists.txt
@@ -22,24 +22,19 @@ target_link_libraries(evpp_lite_static ${DEPENDENT_LIBRARIES})
target_compile_features(evpp_lite_static PRIVATE cxx_std_11)
if (UNIX)
+ if(BUILD_SHARED_LIBS)
add_library(evpp SHARED ${evpp_SRCS})
target_link_libraries(evpp ${DEPENDENT_LIBRARIES})
# boost lockfree queue
add_library(evpp_boost SHARED ${evpp_SRCS})
- add_library(evpp_boost_static STATIC ${evpp_SRCS})
target_compile_definitions(evpp_boost PRIVATE -DH_HAVE_BOOST=1)
- target_compile_definitions(evpp_boost_static PRIVATE -DH_HAVE_BOOST=1)
target_link_libraries(evpp_boost ${DEPENDENT_LIBRARIES})
- target_link_libraries(evpp_boost_static ${DEPENDENT_LIBRARIES})
# https://github.com/cameron314/concurrentqueue
add_library(evpp_concurrentqueue SHARED ${evpp_SRCS})
- add_library(evpp_concurrentqueue_static STATIC ${evpp_SRCS})
target_compile_definitions(evpp_concurrentqueue PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
- target_compile_definitions(evpp_concurrentqueue_static PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
target_link_libraries(evpp_concurrentqueue ${DEPENDENT_LIBRARIES})
- target_link_libraries(evpp_concurrentqueue_static ${DEPENDENT_LIBRARIES})
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
@@ -51,11 +46,26 @@ if (UNIX)
@@ -50,24 +50,10 @@ if (UNIX)
VERSION "${PACKAGE_VERSION}"
SOVERSION "${PACKAGE_SOVERSION}"
)
install (
-
- install (
- TARGETS evpp evpp_static evpp_lite_static evpp_boost evpp_boost_static evpp_concurrentqueue evpp_concurrentqueue_static
+ TARGETS evpp evpp_boost evpp_concurrentqueue
EXPORT ${PACKAGE_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
+ else()
+ add_library(evpp_boost_static STATIC ${evpp_SRCS})
+ target_compile_definitions(evpp_boost_static PRIVATE -DH_HAVE_BOOST=1)
+ target_link_libraries(evpp_boost_static ${DEPENDENT_LIBRARIES})
+
+ add_library(evpp_concurrentqueue_static STATIC ${evpp_SRCS})
+ target_compile_definitions(evpp_concurrentqueue_static PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
+ target_link_libraries(evpp_concurrentqueue_static ${DEPENDENT_LIBRARIES})
+
+ install (
+ TARGETS evpp_static evpp_lite_static evpp_boost_static evpp_concurrentqueue_static
+ EXPORT ${PACKAGE_NAME}
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib)
+ endif()
- EXPORT ${PACKAGE_NAME}
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-
-else (UNIX)
- install (
- TARGETS evpp_static evpp_lite_static
- EXPORT ${PACKAGE_NAME}
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib)
-
endif (UNIX)
else (UNIX)
install (
+install_shared_or_static_targets()
+
install (FILES ${evpp_PUBLIC_HEADERS} DESTINATION "include/evpp")
install (FILES ${evpp_HTTP_PUBLIC_HEADERS} DESTINATION "include/evpp/http")
install (FILES ${evpp_HTTPC_PUBLIC_HEADERS} DESTINATION "include/evpp/httpc")

View File

@ -1,168 +1,27 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d325df7..772da36 100644
index 7a054b3..fa6da0e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -88,3 +88,17 @@ include (packages)
@@ -107,3 +107,22 @@ include (packages)
include (CPack)
include (CTest)
+
+install(EXPORT unofficial-evpp-target
+ FILE unofficial-evpp-target.cmake
+install(EXPORT evpp-targets
+ FILE unofficial-evpp-targets.cmake
+ NAMESPACE unofficial::evpp::
+ DESTINATION share/unofficial-evpp
+)
+
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-evpp-config.cmake"
+[[include(CMakeFindDependencyMacro)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/unofficial-evpp-config.cmake" [[
+include(CMakeFindDependencyMacro)
+find_dependency(glog CONFIG)
+find_dependency(Libevent CONFIG)
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-evpp-target.cmake")
+if(UNIX)
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_dependency(Threads)
+ find_dependency(unofficial-concurrentqueue)
+endif()
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-evpp-targets.cmake")
+]])
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/unofficial-evpp-config.cmake DESTINATION "share/unofficial-evpp")
\ No newline at end of file
diff --git a/apps/evmc/CMakeLists.txt b/apps/evmc/CMakeLists.txt
index f8cffa7..91663d6 100644
--- a/apps/evmc/CMakeLists.txt
+++ b/apps/evmc/CMakeLists.txt
@@ -7,12 +7,13 @@ file(GLOB evmc_PUBLIC_HEADERS *.h)
add_library(evmc_static STATIC ${evmc_SRCS})
target_link_libraries(evmc_static ${LIBRARIES})
+target_include_directories(evmc_static INTERFACE $<INSTALL_INTERFACE:include>)
if (UNIX)
if(BUILD_SHARED_LIBS)
add_library(evmc SHARED ${evmc_SRCS})
target_link_libraries(evmc ${LIBRARIES})
-
+ target_include_directories(evmc INTERFACE $<INSTALL_INTERFACE:include>)
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
include (packages)
@@ -24,6 +25,8 @@ if (UNIX)
install (
TARGETS evmc
+ EXPORT unofficial-evpp-target
+ RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
@@ -31,6 +34,7 @@ endif (UNIX)
install (
TARGETS evmc_static
+ EXPORT unofficial-evpp-target
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install (FILES ${evmc_PUBLIC_HEADERS} DESTINATION "include/evmc")
diff --git a/apps/evnsq/CMakeLists.txt b/apps/evnsq/CMakeLists.txt
index 65f15cd..7c9fbf5 100644
--- a/apps/evnsq/CMakeLists.txt
+++ b/apps/evnsq/CMakeLists.txt
@@ -3,12 +3,13 @@ file(GLOB evnsq_PUBLIC_HEADERS *.h)
add_library(evnsq_static STATIC ${evnsq_SRCS})
target_link_libraries(evnsq_static ${LIBRARIES})
+target_include_directories(evnsq_static INTERFACE $<INSTALL_INTERFACE:include>)
if (UNIX)
if(BUILD_SHARED_LIBS)
add_library(evnsq SHARED ${evnsq_SRCS})
target_link_libraries(evnsq ${LIBRARIES})
-
+ target_include_directories(evnsq INTERFACE $<INSTALL_INTERFACE:include>)
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
include (packages)
@@ -20,6 +21,8 @@ if (UNIX)
install (
TARGETS evnsq
+ EXPORT unofficial-evpp-target
+ RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
@@ -27,6 +30,7 @@ endif (UNIX)
install (
TARGETS evnsq_static
+ EXPORT unofficial-evpp-target
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install (FILES ${evnsq_PUBLIC_HEADERS} DESTINATION "include/evnsq")
diff --git a/evpp/CMakeLists.txt b/evpp/CMakeLists.txt
index c16d708..1c17f04 100644
--- a/evpp/CMakeLists.txt
+++ b/evpp/CMakeLists.txt
@@ -16,26 +16,28 @@ include_directories(${PROJECT_SOURCE_DIR})
add_library(evpp_static STATIC ${evpp_SRCS})
target_link_libraries(evpp_static ${DEPENDENT_LIBRARIES})
target_compile_features(evpp_static PRIVATE cxx_std_11)
+target_include_directories(evpp_static INTERFACE $<INSTALL_INTERFACE:include>)
add_library(evpp_lite_static STATIC ${evpp_lite_SRCS})
target_link_libraries(evpp_lite_static ${DEPENDENT_LIBRARIES})
target_compile_features(evpp_lite_static PRIVATE cxx_std_11)
+target_include_directories(evpp_lite_static INTERFACE $<INSTALL_INTERFACE:include>)
if (UNIX)
if(BUILD_SHARED_LIBS)
add_library(evpp SHARED ${evpp_SRCS})
target_link_libraries(evpp ${DEPENDENT_LIBRARIES})
-
+ target_include_directories(evpp INTERFACE $<INSTALL_INTERFACE:include>)
# boost lockfree queue
add_library(evpp_boost SHARED ${evpp_SRCS})
target_compile_definitions(evpp_boost PRIVATE -DH_HAVE_BOOST=1)
target_link_libraries(evpp_boost ${DEPENDENT_LIBRARIES})
-
+ target_include_directories(evpp_boost INTERFACE $<INSTALL_INTERFACE:include>)
# https://github.com/cameron314/concurrentqueue
add_library(evpp_concurrentqueue SHARED ${evpp_SRCS})
target_compile_definitions(evpp_concurrentqueue PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
target_link_libraries(evpp_concurrentqueue ${DEPENDENT_LIBRARIES})
-
+ target_include_directories(evpp_concurrentqueue INTERFACE $<INSTALL_INTERFACE:include>)
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
include (packages)
@@ -47,7 +49,7 @@ if (UNIX)
install (
TARGETS evpp evpp_boost evpp_concurrentqueue
- EXPORT ${PACKAGE_NAME}
+ EXPORT unofficial-evpp-target
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
@@ -55,14 +57,14 @@ if (UNIX)
add_library(evpp_boost_static STATIC ${evpp_SRCS})
target_compile_definitions(evpp_boost_static PRIVATE -DH_HAVE_BOOST=1)
target_link_libraries(evpp_boost_static ${DEPENDENT_LIBRARIES})
-
+ target_include_directories(evpp_boost_static INTERFACE $<INSTALL_INTERFACE:include>)
add_library(evpp_concurrentqueue_static STATIC ${evpp_SRCS})
target_compile_definitions(evpp_concurrentqueue_static PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
target_link_libraries(evpp_concurrentqueue_static ${DEPENDENT_LIBRARIES})
-
+ target_include_directories(evpp_concurrentqueue_static INTERFACE $<INSTALL_INTERFACE:include>)
install (
TARGETS evpp_static evpp_lite_static evpp_boost_static evpp_concurrentqueue_static
- EXPORT ${PACKAGE_NAME}
+ EXPORT unofficial-evpp-target
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()
@@ -70,8 +72,7 @@ if (UNIX)
else (UNIX)
install (
TARGETS evpp_static evpp_lite_static
- EXPORT ${PACKAGE_NAME}
- RUNTIME DESTINATION bin
+ EXPORT unofficial-evpp-target
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

113
ports/evpp/basic-fixes.diff Normal file
View File

@ -0,0 +1,113 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7872fc8..e1e7c02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,5 @@
-cmake_minimum_required (VERSION 2.8)
+cmake_minimum_required (VERSION 3.10)
+set(CMAKE_CXX_STANDARD 14)
project (safe-evpp C CXX)
@@ -24,22 +25,18 @@ if (UNIX)
-fms-extensions
-Wfloat-equal
-Wextra
- -std=c++11
)
include_directories (${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/3rdparty)
else (UNIX)
set (CXX_FLAGS -DWIN32 -D_WIN32 -EHsc)
- set(VcpkgRoot ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET})
- include_directories(${VcpkgRoot}/include
+ include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/3rdparty/wininclude)
# On windows, Debug mode
- link_directories(${VcpkgRoot}/debug/lib ${VcpkgRoot}/debug/lib/manual-link)
# On Windows, Release mode
- # link_directories(${VcpkgRoot}/lib ${VcpkgRoot}/lib/manual-link)
endif (UNIX)
string (REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
diff --git a/apps/evmc/CMakeLists.txt b/apps/evmc/CMakeLists.txt
index 9918919..888c672 100644
--- a/apps/evmc/CMakeLists.txt
+++ b/apps/evmc/CMakeLists.txt
@@ -6,11 +6,11 @@ file(GLOB evmc_SRCS *.cc
file(GLOB evmc_PUBLIC_HEADERS *.h)
add_library(evmc_static STATIC ${evmc_SRCS})
-target_link_libraries(evmc_static ${LIBRARIES})
+target_link_libraries(evmc_static PRIVATE ${LIBRARIES})
if (UNIX)
add_library(evmc SHARED ${evmc_SRCS})
- target_link_libraries(evmc ${LIBRARIES})
+ target_link_libraries(evmc PRIVATE ${LIBRARIES})
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
diff --git a/apps/evnsq/CMakeLists.txt b/apps/evnsq/CMakeLists.txt
index c510814..a4d4113 100644
--- a/apps/evnsq/CMakeLists.txt
+++ b/apps/evnsq/CMakeLists.txt
@@ -2,11 +2,11 @@ file(GLOB evnsq_SRCS *.cc *.h)
file(GLOB evnsq_PUBLIC_HEADERS *.h)
add_library(evnsq_static STATIC ${evnsq_SRCS})
-target_link_libraries(evnsq_static ${LIBRARIES})
+target_link_libraries(evnsq_static PRIVATE ${LIBRARIES})
if (UNIX)
add_library(evnsq SHARED ${evnsq_SRCS})
- target_link_libraries(evnsq ${LIBRARIES})
+ target_link_libraries(evnsq PRIVATE ${LIBRARIES})
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)
diff --git a/evpp/CMakeLists.txt b/evpp/CMakeLists.txt
index b2e470d..1dfd91b 100644
--- a/evpp/CMakeLists.txt
+++ b/evpp/CMakeLists.txt
@@ -14,30 +14,30 @@ set (MACOSX_RPATH ${LIBRARY_OUTPUT_PATH})
include_directories(${PROJECT_SOURCE_DIR})
add_library(evpp_static STATIC ${evpp_SRCS})
-target_link_libraries(evpp_static ${DEPENDENT_LIBRARIES})
+target_link_libraries(evpp_static PRIVATE ${DEPENDENT_LIBRARIES})
add_library(evpp_lite_static STATIC ${evpp_lite_SRCS})
-target_link_libraries(evpp_lite_static ${DEPENDENT_LIBRARIES})
+target_link_libraries(evpp_lite_static PRIVATE ${DEPENDENT_LIBRARIES})
if (UNIX)
add_library(evpp SHARED ${evpp_SRCS})
- target_link_libraries(evpp ${DEPENDENT_LIBRARIES})
+ target_link_libraries(evpp PRIVATE ${DEPENDENT_LIBRARIES})
# boost lockfree queue
add_library(evpp_boost SHARED ${evpp_SRCS})
add_library(evpp_boost_static STATIC ${evpp_SRCS})
target_compile_definitions(evpp_boost PRIVATE -DH_HAVE_BOOST=1)
target_compile_definitions(evpp_boost_static PRIVATE -DH_HAVE_BOOST=1)
- target_link_libraries(evpp_boost ${DEPENDENT_LIBRARIES})
- target_link_libraries(evpp_boost_static ${DEPENDENT_LIBRARIES})
+ target_link_libraries(evpp_boost PRIVATE ${DEPENDENT_LIBRARIES})
+ target_link_libraries(evpp_boost_static PRIVATE ${DEPENDENT_LIBRARIES})
# https://github.com/cameron314/concurrentqueue
add_library(evpp_concurrentqueue SHARED ${evpp_SRCS})
add_library(evpp_concurrentqueue_static STATIC ${evpp_SRCS})
target_compile_definitions(evpp_concurrentqueue PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
target_compile_definitions(evpp_concurrentqueue_static PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
- target_link_libraries(evpp_concurrentqueue ${DEPENDENT_LIBRARIES})
- target_link_libraries(evpp_concurrentqueue_static ${DEPENDENT_LIBRARIES})
+ target_link_libraries(evpp_concurrentqueue PRIVATE ${DEPENDENT_LIBRARIES})
+ target_link_libraries(evpp_concurrentqueue_static PRIVATE ${DEPENDENT_LIBRARIES})
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)

View File

@ -1,31 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 47eb0a6..d325df7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,9 @@ if (UNIX)
list(APPEND DEPENDENT_INCLUDE_DIRS "${GLOG_INCLUDE_DIRS}/../")
SET(DEPENDENT_LIBRARIES libevent::core libevent::extra libevent::openssl glog::glog pthread)
else (UNIX)
- SET(DEPENDENT_LIBRARIES event glog)
+ find_package(glog CONFIG REQUIRED)
+ find_package(Libevent CONFIG REQUIRED)
+ SET(DEPENDENT_LIBRARIES libevent::core libevent::extra libevent::openssl glog::glog)
endif (UNIX)
if (CMAKE_BENCHMARK_TESTING)
diff --git a/evpp/CMakeLists.txt b/evpp/CMakeLists.txt
index b2e470d..031659f 100644
--- a/evpp/CMakeLists.txt
+++ b/evpp/CMakeLists.txt
@@ -15,9 +15,11 @@ include_directories(${PROJECT_SOURCE_DIR})
add_library(evpp_static STATIC ${evpp_SRCS})
target_link_libraries(evpp_static ${DEPENDENT_LIBRARIES})
+target_compile_features(evpp_static PRIVATE cxx_std_11)
add_library(evpp_lite_static STATIC ${evpp_lite_SRCS})
target_link_libraries(evpp_lite_static ${DEPENDENT_LIBRARIES})
+target_compile_features(evpp_lite_static PRIVATE cxx_std_11)
if (UNIX)
add_library(evpp SHARED ${evpp_SRCS})

View File

@ -0,0 +1,56 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1e7c02..17b0a1c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,12 +41,16 @@ endif (UNIX)
string (REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
+find_package(Libevent CONFIG REQUIRED)
+find_package(glog CONFIG REQUIRED)
+set(DEPENDENT_LIBRARIES libevent::core libevent::extra libevent::openssl glog::glog)
if (UNIX)
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb -D_DEBUG -DGOOGLE_STRIP_LOG=0")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -ggdb -DNDEBUG -DGOOGLE_STRIP_LOG=1")
- SET(DEPENDENT_LIBRARIES event glog pthread)
+ set(THREADS_PREFER_PTHREAD_FLAG ON)
+ find_package(Threads REQUIRED)
+ list(APPEND DEPENDENT_LIBRARIES Threads::Threads)
else (UNIX)
- SET(DEPENDENT_LIBRARIES event glog)
endif (UNIX)
if (CMAKE_BENCHMARK_TESTING)
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 469ed1c..fc6762a 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -2,12 +2,9 @@
include_directories(${PROJECT_SOURCE_DIR}/apps ${PROJECT_SOURCE_DIR}/3rdparty)
if (UNIX)
-set(LIBRARIES evpp_concurrentqueue event glog pthread)
-link_directories("/home/s/safe/lib" ${PROJECT_BUILD_DIR}/lib)
+ set(LIBRARIES $<IF:$<TARGET_EXISTS:evpp_concurrentqueue>,evpp_concurrentqueue,evpp_concurrentqueue_static> glog::glog Threads::Threads)
else(UNIX)
-set(LIBRARIES evpp_static event glog)
-link_directories(${PROJECT_SOURCE_DIR}/vsprojects/bin/${CMAKE_BUILD_TYPE}/
- ${LIBRARY_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/)
+ set(LIBRARIES evpp_static glog::glog)
endif(UNIX)
add_subdirectory(evnsq)
diff --git a/evpp/CMakeLists.txt b/evpp/CMakeLists.txt
index 1dfd91b..73ee071 100644
--- a/evpp/CMakeLists.txt
+++ b/evpp/CMakeLists.txt
@@ -38,6 +38,9 @@ if (UNIX)
target_compile_definitions(evpp_concurrentqueue_static PRIVATE -DH_HAVE_CAMERON314_CONCURRENTQUEUE=1)
target_link_libraries(evpp_concurrentqueue PRIVATE ${DEPENDENT_LIBRARIES})
target_link_libraries(evpp_concurrentqueue_static PRIVATE ${DEPENDENT_LIBRARIES})
+ find_package(unofficial-concurrentqueue REQUIRED)
+ target_link_libraries(evpp_concurrentqueue PRIVATE unofficial::concurrentqueue::concurrentqueue)
+ target_link_libraries(evpp_concurrentqueue_static PRIVATE unofficial::concurrentqueue::concurrentqueue)
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include (utils)

View File

@ -1,112 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7872fc8..2a06614 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,7 +47,11 @@ string (REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
if (UNIX)
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb -D_DEBUG -DGOOGLE_STRIP_LOG=0")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -ggdb -DNDEBUG -DGOOGLE_STRIP_LOG=1")
- SET(DEPENDENT_LIBRARIES event glog pthread)
+ find_package(glog CONFIG REQUIRED)
+ find_path(GLOG_INCLUDE_DIRS logging.h PATH_SUFFIXES glog)
+ find_package(Libevent CONFIG REQUIRED)
+ list(APPEND DEPENDENT_INCLUDE_DIRS "${GLOG_INCLUDE_DIRS}/../")
+ SET(DEPENDENT_LIBRARIES libevent::core libevent::extra libevent::openssl glog::glog pthread)
else (UNIX)
SET(DEPENDENT_LIBRARIES event glog)
endif (UNIX)
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 469ed1c..8219424 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -2,7 +2,7 @@
include_directories(${PROJECT_SOURCE_DIR}/apps ${PROJECT_SOURCE_DIR}/3rdparty)
if (UNIX)
-set(LIBRARIES evpp_concurrentqueue event glog pthread)
+set(LIBRARIES evpp_concurrentqueue libevent::core libevent::extra libevent::openssl glog::glog pthread)
link_directories("/home/s/safe/lib" ${PROJECT_BUILD_DIR}/lib)
else(UNIX)
set(LIBRARIES evpp_static event glog)
diff --git a/benchmark/http/libevent/CMakeLists.txt b/benchmark/http/libevent/CMakeLists.txt
index 1148616..0356b71 100644
--- a/benchmark/http/libevent/CMakeLists.txt
+++ b/benchmark/http/libevent/CMakeLists.txt
@@ -1,3 +1,3 @@
add_executable(benchmark_http_libevent libevent_http_bench.c)
-target_link_libraries(benchmark_http_libevent event)
+target_link_libraries(benchmark_http_libevent libevent::core libevent::extra libevent::openssl)
diff --git a/benchmark/ioevent/libevent/CMakeLists.txt b/benchmark/ioevent/libevent/CMakeLists.txt
index dfa51a3..de4849d 100644
--- a/benchmark/ioevent/libevent/CMakeLists.txt
+++ b/benchmark/ioevent/libevent/CMakeLists.txt
@@ -1,3 +1,3 @@
add_executable(benchmark_ioevent_libevent libevent_ioevent_bench.c)
-target_link_libraries(benchmark_ioevent_libevent event)
+target_link_libraries(benchmark_ioevent_libevent libevent::core libevent::extra libevent::openssl)
diff --git a/benchmark/throughput/libevent/CMakeLists.txt b/benchmark/throughput/libevent/CMakeLists.txt
index 21dab84..aefe698 100644
--- a/benchmark/throughput/libevent/CMakeLists.txt
+++ b/benchmark/throughput/libevent/CMakeLists.txt
@@ -1,5 +1,5 @@
add_executable(benchmark_tcp_libevent_client client.c)
-target_link_libraries(benchmark_tcp_libevent_client event)
+target_link_libraries(benchmark_tcp_libevent_client libevent::core libevent::extra libevent::openssl)
add_executable(benchmark_tcp_libevent_server server.c)
-target_link_libraries(benchmark_tcp_libevent_server event)
+target_link_libraries(benchmark_tcp_libevent_server libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/basic_01/CMakeLists.txt b/examples/recipes/self_control_timer/basic_01/CMakeLists.txt
index 7834db4..82294c5 100644
--- a/examples/recipes/self_control_timer/basic_01/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/basic_01/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_basic_01 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_basic_01 event)
+target_link_libraries(example_recipes_self_control_timer_basic_01 libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/basic_02/CMakeLists.txt b/examples/recipes/self_control_timer/basic_02/CMakeLists.txt
index a8be419..0329ccc 100644
--- a/examples/recipes/self_control_timer/basic_02/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/basic_02/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_basic_02 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_basic_02 event)
+target_link_libraries(example_recipes_self_control_timer_basic_02 libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt b/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt
index 1cae9bb..218b771 100644
--- a/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_cancel_03 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_cancel_03 event)
+target_link_libraries(example_recipes_self_control_timer_cancel_03 libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt b/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt
index 749c584..e7c658e 100644
--- a/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_periodic_04 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_periodic_04 event)
+target_link_libraries(example_recipes_self_control_timer_periodic_04 libevent::core libevent::extra libevent::openssl)

View File

@ -1,35 +1,41 @@
set(EVPP_VERSION 0.7.0)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Qihoo360/evpp
REF v${EVPP_VERSION}
REF v${VERSION}
SHA512 ddcef8d2af6b3c46473d755c0f0994d63d56240ea85d6b44ceb6b77724c3c56bbf1156f7188e270fb5f9f36f25bfc2f96669d7249a34c921922671e3fe267e88
HEAD_REF master
PATCHES
basic-fixes.diff
dependencies.diff
fix-rapidjson-1-1.patch
fix-linux-build.patch
fix-osx-build.patch
compile-features.patch
Add-static-shared-handling.patch
Export-unofficial-target.patch
use-cxx14-standard.patch
)
file(REMOVE_RECURSE "${SOURCE_PATH}/3rdparty/rapidjson" "${SOURCE_PATH}/3rdparty/concurrentqueue")
file(REMOVE_RECURSE
"${SOURCE_PATH}/3rdparty/concurrentqueue"
"${SOURCE_PATH}/3rdparty/gtest"
"${SOURCE_PATH}/3rdparty/rapidjson"
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DEVPP_VCPKG_BUILD=ON
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-evpp)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(
FILE_LIST "${SOURCE_PATH}/LICENSE"
COMMENT [[
The evpp source code is offered under the BSD-3-Clause license.
However, evpp includes 3rd-party source code with other licenses
and additional attribution requirements.
]])

View File

@ -1,30 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 772da36..7ff62b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,7 +24,7 @@ if (UNIX)
-fms-extensions
-Wfloat-equal
-Wextra
- -std=c++11
+ -std=c++14
)
include_directories (${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/3rdparty)
diff --git a/evpp/CMakeLists.txt b/evpp/CMakeLists.txt
index 1c17f04..9f07f97 100644
--- a/evpp/CMakeLists.txt
+++ b/evpp/CMakeLists.txt
@@ -15,12 +15,10 @@ include_directories(${PROJECT_SOURCE_DIR})
add_library(evpp_static STATIC ${evpp_SRCS})
target_link_libraries(evpp_static ${DEPENDENT_LIBRARIES})
-target_compile_features(evpp_static PRIVATE cxx_std_11)
target_include_directories(evpp_static INTERFACE $<INSTALL_INTERFACE:include>)
add_library(evpp_lite_static STATIC ${evpp_lite_SRCS})
target_link_libraries(evpp_lite_static ${DEPENDENT_LIBRARIES})
-target_compile_features(evpp_lite_static PRIVATE cxx_std_11)
target_include_directories(evpp_lite_static INTERFACE $<INSTALL_INTERFACE:include>)
if (UNIX)

View File

@ -1,10 +1,10 @@
{
"name": "evpp",
"version": "0.7.0",
"port-version": 8,
"port-version": 9,
"description": "A modern C++ network library based on libevent for developing high performance network services in TCP/UDP/HTTP protocols.",
"homepage": "https://github.com/Qihoo360/evpp",
"license": "BSD-3-Clause",
"license": null,
"dependencies": [
{
"name": "boost-lockfree",

View File

@ -2730,7 +2730,7 @@
},
"evpp": {
"baseline": "0.7.0",
"port-version": 8
"port-version": 9
},
"exiv2": {
"baseline": "0.28.5",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0b4f2ea67051b69e29b9e972b75a25b0c5473a49",
"version": "0.7.0",
"port-version": 9
},
{
"git-tree": "1eda7115a751bcbf31efdbbbf0bdefb16e4b67e2",
"version": "0.7.0",