Skip to content

Commit

Permalink
[EIPScanner] add new port (microsoft#43569)
Browse files Browse the repository at this point in the history
Co-authored-by: Kai Pastor <[email protected]>
  • Loading branch information
EfesX and dg0yt authored Feb 11, 2025
1 parent 3dc84bb commit 7839a20
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 0 deletions.
82 changes: 82 additions & 0 deletions ports/eipscanner/package.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
diff --git a/cmake/EIPScannerConfig.cmake.in b/cmake/EIPScannerConfig.cmake.in
new file mode 100644
index 0000000..3e16bd1
--- /dev/null
+++ b/cmake/EIPScannerConfig.cmake.in
@@ -0,0 +1,6 @@
+@PACKAGE_INIT@
+
+include("${CMAKE_CURRENT_LIST_DIR}/EIPScannerTargets.cmake")
+
+check_required_components(EIPScanner)
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 68a291e..d2562a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,6 +13,7 @@ option(TEST_ENABLED "Enable unit test" OFF)
option(EXAMPLE_ENABLED "Build examples" OFF)

add_subdirectory(src)
+
if (EXAMPLE_ENABLED)
add_subdirectory(examples)
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dc2bbb9..d8d3cfa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -64,7 +64,18 @@ set_target_properties(
VERSION ${EIPSCANNER_FULL_VERSION}
SOVERSION ${EIPSCANNER_MAJOR_VERSION})

-install(TARGETS EIPScanner EIPScannerS
+if(BUILD_SHARED_LIBS)
+ set(install_target EIPScanner)
+ set_target_properties(EIPScanner PROPERTIES EXPORT_NAME eipscanner)
+ set_target_properties(EIPScannerS PROPERTIES EXCLUDE_FROM_ALL 1)
+else()
+ set(install_target EIPScannerS)
+ set_target_properties(EIPScannerS PROPERTIES EXPORT_NAME eipscanner)
+ set_target_properties(EIPScanner PROPERTIES EXCLUDE_FROM_ALL 1)
+endif()
+
+install(TARGETS ${install_target}
+ EXPORT ${install_target}
LIBRARY
DESTINATION lib
ARCHIVE
@@ -73,3 +84,33 @@ install(TARGETS EIPScanner EIPScannerS
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/
DESTINATION include/EIPScanner
FILES_MATCHING PATTERN "*.h*")
+
+target_include_directories(${install_target}
+ INTERFACE
+ $<INSTALL_INTERFACE:include/EIPScanner>
+)
+
+include(CMakePackageConfigHelpers)
+configure_package_config_file(
+ ../cmake/EIPScannerConfig.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/EIPScannerConfig.cmake
+ INSTALL_DESTINATION lib/cmake/eipscanner
+)
+
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/EIPScannerConfigVersion.cmake
+ VERSION ${PROJECT_VERSION}
+ COMPATIBILITY SameMajorVersion
+)
+
+install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/EIPScannerConfig.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/EIPScannerConfigVersion.cmake
+ DESTINATION lib/cmake/eipscanner
+)
+
+install(EXPORT ${install_target}
+ FILE EIPScannerTargets.cmake
+ NAMESPACE unofficial::eipscanner::
+ DESTINATION lib/cmake/eipscanner
+)
23 changes: 23 additions & 0 deletions ports/eipscanner/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nimbuscontrols/EIPScanner
REF ${VERSION}
SHA512 24612e6eec97aa67dfd83ec90d3f1a961c69a63a17cb09679b9eb453750049628def8d488b9debbf1f322a800f9f54933dedca9b37fb1c5703e95460b89f2f43
HEAD_REF master
PATCHES
package.patch
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/eipscanner)
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
4 changes: 4 additions & 0 deletions ports/eipscanner/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package EIPScanner provides CMake targets:

find_package(EIPScanner CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial::eipscanner::eipscanner)
18 changes: 18 additions & 0 deletions ports/eipscanner/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "eipscanner",
"version": "1.3.0",
"description": "Free implementation of EtherNet/IP in C++ ",
"homepage": "https://eipscanner.readthedocs.io",
"license": "MIT",
"supports": "!windows",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,10 @@
"baseline": "3.4.0",
"port-version": 5
},
"eipscanner": {
"baseline": "1.3.0",
"port-version": 0
},
"elements": {
"baseline": "2024-09-12",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/e-/eipscanner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "4d614cf97b912cc20cca14a566542f106db03246",
"version": "1.3.0",
"port-version": 0
}
]
}

0 comments on commit 7839a20

Please sign in to comment.