aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/easyloggingpp
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/easyloggingpp')
-rw-r--r--vcpkg/ports/easyloggingpp/0001_add_cmake_options.patch34
-rw-r--r--vcpkg/ports/easyloggingpp/0002_fix_build_uwp.patch22
-rw-r--r--vcpkg/ports/easyloggingpp/0003_fix_pkgconfig.patch10
-rw-r--r--vcpkg/ports/easyloggingpp/portfile.cmake43
-rw-r--r--vcpkg/ports/easyloggingpp/usage6
-rw-r--r--vcpkg/ports/easyloggingpp/vcpkg.json29
6 files changed, 144 insertions, 0 deletions
diff --git a/vcpkg/ports/easyloggingpp/0001_add_cmake_options.patch b/vcpkg/ports/easyloggingpp/0001_add_cmake_options.patch
new file mode 100644
index 0000000..3e2f3f9
--- /dev/null
+++ b/vcpkg/ports/easyloggingpp/0001_add_cmake_options.patch
@@ -0,0 +1,34 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8604a54..e08df91 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -25,6 +25,10 @@ option(test "Build all tests" OFF)
+ option(build_static_lib "Build easyloggingpp as a static library" OFF)
+ option(lib_utc_datetime "Build library with UTC date/time logging" OFF)
+
++option(no_default_logfile "Do not write to default log file \"myeasylog.log\" (define ELPP_NO_DEFAULT_LOG_FILE)" OFF)
++option(thread_safe "Build easyloggingpp thread safe (define ELPP_THREAD_SAFE)" OFF)
++option(use_std_threads "Use standard library thread synchronization (define ELPP_FORCE_USE_STD_THREAD)" OFF)
++
+ set(ELPP_MAJOR_VERSION "9")
+ set(ELPP_MINOR_VERSION "96")
+ set(ELPP_PATCH_VERSION "7")
+@@ -57,6 +61,18 @@ if (build_static_lib)
+ add_definitions(-DELPP_UTC_DATETIME)
+ endif()
+
++ if (no_default_logfile)
++ add_definitions(-DELPP_NO_DEFAULT_LOG_FILE)
++ endif()
++
++ if (thread_safe)
++ add_definitions(-DELPP_THREAD_SAFE)
++ endif()
++
++ if (use_std_threads)
++ add_definitions(-DELPP_FORCE_USE_STD_THREAD)
++ endif()
++
+ require_cpp14()
+ add_library(easyloggingpp STATIC src/easylogging++.cc)
+ set_property(TARGET easyloggingpp PROPERTY POSITION_INDEPENDENT_CODE ON)
diff --git a/vcpkg/ports/easyloggingpp/0002_fix_build_uwp.patch b/vcpkg/ports/easyloggingpp/0002_fix_build_uwp.patch
new file mode 100644
index 0000000..7120ac1
--- /dev/null
+++ b/vcpkg/ports/easyloggingpp/0002_fix_build_uwp.patch
@@ -0,0 +1,22 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e08df91..7c02adf 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -28,6 +28,7 @@ option(lib_utc_datetime "Build library with UTC date/time logging" OFF)
+ option(no_default_logfile "Do not write to default log file \"myeasylog.log\" (define ELPP_NO_DEFAULT_LOG_FILE)" OFF)
+ option(thread_safe "Build easyloggingpp thread safe (define ELPP_THREAD_SAFE)" OFF)
+ option(use_std_threads "Use standard library thread synchronization (define ELPP_FORCE_USE_STD_THREAD)" OFF)
++option(is_uwp "The compilation platform is uwp." OFF)
+
+ set(ELPP_MAJOR_VERSION "9")
+ set(ELPP_MINOR_VERSION "96")
+@@ -76,6 +77,9 @@ if (build_static_lib)
+ require_cpp14()
+ add_library(easyloggingpp STATIC src/easylogging++.cc)
+ set_property(TARGET easyloggingpp PROPERTY POSITION_INDEPENDENT_CODE ON)
++ if(is_uwp)
++ target_compile_definitions(easyloggingpp PUBLIC WIN32_LEAN_AND_MEAN ELPP_WINSOCK2)
++ endif()
+
+ install(TARGETS
+ easyloggingpp
diff --git a/vcpkg/ports/easyloggingpp/0003_fix_pkgconfig.patch b/vcpkg/ports/easyloggingpp/0003_fix_pkgconfig.patch
new file mode 100644
index 0000000..3eec16e
--- /dev/null
+++ b/vcpkg/ports/easyloggingpp/0003_fix_pkgconfig.patch
@@ -0,0 +1,10 @@
+diff --git a/cmake/easyloggingpp.pc.cmakein b/cmake/easyloggingpp.pc.cmakein
+index 61000ce..f7f8d0c 100644
+--- a/cmake/easyloggingpp.pc.cmakein
++++ b/cmake/easyloggingpp.pc.cmakein
+@@ -4,3 +4,5 @@ Version: @ELPP_VERSION_STRING@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ includedir=@ELPP_INCLUDE_INSTALL_DIR@
+ Cflags: -I${includedir}
++libdir=${prefix}/lib
++Libs: -L${libdir} -leasyloggingpp
diff --git a/vcpkg/ports/easyloggingpp/portfile.cmake b/vcpkg/ports/easyloggingpp/portfile.cmake
new file mode 100644
index 0000000..6c61854
--- /dev/null
+++ b/vcpkg/ports/easyloggingpp/portfile.cmake
@@ -0,0 +1,43 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO abumq/easyloggingpp
+ REF "v${VERSION}"
+ SHA512 3df813f7f9796c81c974ba794624db2602253e14b938370deb4c851fe8725f5c7ebf71d7ae0277fcb770b043ccf8f04bbf8e770d14565f4cb704328973473387
+ HEAD_REF master
+ PATCHES
+ 0001_add_cmake_options.patch
+ 0002_fix_build_uwp.patch
+ 0003_fix_pkgconfig.patch
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ std-locking use_std_threads
+ thread-safe thread_safe
+ no-defaultfile no_default_logfile
+)
+if(VCPKG_TARGET_IS_UWP)
+ set(TARGET_IS_UWP ON)
+endif()
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -Dbuild_static_lib=ON
+ -Dis_uwp=${TARGET_IS_UWP}
+ OPTIONS_DEBUG
+ -DELPP_PKGCONFIG_INSTALL_DIR="${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig"
+ OPTIONS_RELEASE
+ -DELPP_PKGCONFIG_INSTALL_DIR="${CURRENT_PACKAGES_DIR}/lib/pkgconfig"
+)
+vcpkg_cmake_install()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+configure_file("${CURRENT_PORT_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
+
+vcpkg_fixup_pkgconfig()
diff --git a/vcpkg/ports/easyloggingpp/usage b/vcpkg/ports/easyloggingpp/usage
new file mode 100644
index 0000000..bd0080e
--- /dev/null
+++ b/vcpkg/ports/easyloggingpp/usage
@@ -0,0 +1,6 @@
+easyloggingpp can be imported via CMake FindPkgConfig module:
+
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(easyloggingpp easyloggingpp REQUIRED IMPORTED_TARGET)
+
+ target_link_libraries(main PRIVATE PkgConfig::easyloggingpp)
diff --git a/vcpkg/ports/easyloggingpp/vcpkg.json b/vcpkg/ports/easyloggingpp/vcpkg.json
new file mode 100644
index 0000000..49e7146
--- /dev/null
+++ b/vcpkg/ports/easyloggingpp/vcpkg.json
@@ -0,0 +1,29 @@
+{
+ "name": "easyloggingpp",
+ "version": "9.97.1",
+ "port-version": 1,
+ "description": "Easylogging++ is a single header efficient logging library for C++ applications.",
+ "homepage": "https://github.com/abumq/easyloggingpp",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "no-defaultfile": {
+ "description": "Do not write to default log file \"myeasylog.log\" (compile with ELPP_NO_DEFAULT_LOG_FILE)"
+ },
+ "std-locking": {
+ "description": "Use std::mutex for thread synchronization (compile with ELPP_FORCE_USE_STD_THREAD)"
+ },
+ "thread-safe": {
+ "description": "Make easyloggingpp thread safe (compile with ELPP_THREAD_SAFE)"
+ }
+ }
+}