diff --git a/ports/opendnp3/CONTROL b/ports/opendnp3/CONTROL new file mode 100644 index 0000000000..a30de2622d --- /dev/null +++ b/ports/opendnp3/CONTROL @@ -0,0 +1,5 @@ +Source: opendnp3 +Version: 2.3.2 +Description: DNP3 (IEEE-1815) protocol stack. Modern C++ with bindings for .NET and Java. +Homepage: https://github.com/dnp3/opendnp3/ +Build-Depends: asio, openssl diff --git a/ports/opendnp3/export-cmake.patch b/ports/opendnp3/export-cmake.patch new file mode 100644 index 0000000000..ee0ab50c33 --- /dev/null +++ b/ports/opendnp3/export-cmake.patch @@ -0,0 +1,140 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1381bab..e184423 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -104,20 +104,54 @@ include_directories(./cpp/tests/libs/src) + # ---- openpal library ---- + file(GLOB_RECURSE openpal_SRC ./cpp/libs/src/openpal/*.cpp ./cpp/libs/src/openpal/*.h ./cpp/libs/include/openpal/*.h) + add_library(openpal ${LIB_TYPE} ${openpal_SRC}) +-install(TARGETS openpal DESTINATION lib) + set_target_properties(openpal PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) + clang_format(openpal) + clang_tidy(openpal) + ++include(CMakePackageConfigHelpers) ++write_basic_package_version_file(openpal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) ++ ++install( ++ TARGETS openpal ++ EXPORT openpal-config ++ DESTINATION lib ++) ++ ++install( ++ EXPORT openpal-config ++ DESTINATION share/openpal ++) ++ + # ---- opendnp3 library ---- + file(GLOB_RECURSE opendnp3_SRC ./cpp/libs/src/opendnp3/*.cpp ./cpp/libs/src/opendnp3/*.h ./cpp/libs/include/opendnp3/*.h) + add_library(opendnp3 ${LIB_TYPE} ${opendnp3_SRC}) + target_link_libraries(opendnp3 openpal) +-install(TARGETS opendnp3 DESTINATION lib) ++ + set_target_properties(opendnp3 PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) + clang_format(opendnp3 EXCLUDES ".*/gen/.*" ".*/objects/.*") + clang_tidy(opendnp3) + ++write_basic_package_version_file(opendnp3-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) ++ ++set(PROJECT_NAME opendnp3) ++set(FIND_DEPENDS "find_dependency(openpal)") ++configure_package_config_file(opendnp3-config.cmake.in opendnp3-config.cmake ++ INSTALL_DESTINATION share/opendnp3 ++ PATH_VARS PROJECT_NAME FIND_DEPENDS ++) ++ ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/opendnp3-config.cmake DESTINATION share/opendnp3) ++ ++install( ++ TARGETS opendnp3 ++ EXPORT opendnp3-targets ++ DESTINATION lib ++) ++install( ++ EXPORT opendnp3-targets ++ DESTINATION share/opendnp3 ++) ++ + if(DNP3_DECODER) + file(GLOB_RECURSE dnp3decode_SRC ./cpp/libs/src/dnp3decode/*.cpp ./cpp/libs/src/dnp3decode/*.h ./cpp/libs/include/dnp3decode/*.h) + add_library(dnp3decode ${LIB_TYPE} ${dnp3decode_SRC}) +@@ -144,8 +178,7 @@ if(DNP3_TLS) + set(asiopal_link_libraries "${asiopal_link_libraries};${OPENSSL_LIBRARIES}") + endif() + +-target_link_libraries(asiopal ${asiopal_link_libraries}) +-install(TARGETS asiopal DESTINATION lib) ++target_link_libraries(asiopal PUBLIC ${asiopal_link_libraries}) + set_target_properties(asiopal PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) + if(FLOCK) + add_definitions(-DUSE_FLOCK) +@@ -153,6 +186,32 @@ endif() + clang_format(asiopal) + clang_tidy(asiopal) + ++install( ++ TARGETS asiopal ++ EXPORT asiopal-targets ++ DESTINATION lib ++) ++ ++write_basic_package_version_file(asiopal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) ++ ++set(PROJECT_NAME asiopal) ++if (DNP3_TLS) ++ set(FIND_DEPENDS "find_dependency(openpal)\nfind_dependency(OpenSSL)") ++else() ++ set(FIND_DEPENDS "find_dependency(openpal)") ++endif() ++configure_package_config_file(opendnp3-config.cmake.in asiopal-config.cmake ++ INSTALL_DESTINATION share/asiopal ++ PATH_VARS PROJECT_NAME FIND_DEPENDS ++) ++ ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asiopal-config.cmake DESTINATION share/asiopal) ++ ++install( ++ EXPORT asiopal-targets ++ DESTINATION share/asiopal ++) ++ + # ---- asiodnp3 library ---- + file(GLOB_RECURSE asiodnp3_HPP ./cpp/libs/src/asiodnp3/*.h ./cpp/libs/include/asiodnp3/*.h) + if(DNP3_TLS) +@@ -161,12 +220,33 @@ else() + file(GLOB asiodnp3_CPP ./cpp/libs/src/asiodnp3/*.cpp) + endif() + add_library(asiodnp3 ${LIB_TYPE} ${asiodnp3_HPP} ${asiodnp3_CPP}) +-target_link_libraries(asiodnp3 asiopal opendnp3) +-install(TARGETS asiodnp3 DESTINATION lib) ++target_link_libraries(asiodnp3 PUBLIC asiopal opendnp3) + set_target_properties(asiodnp3 PROPERTIES FOLDER cpp/libs VERSION ${OPENDNP3_VERSION} SOVERSION ${OPENDNP3_MAJOR_VERSION}) + clang_format(asiodnp3) + clang_tidy(asiodnp3) + ++install( ++ TARGETS asiodnp3 ++ EXPORT asiodnp3-targets ++ DESTINATION lib ++) ++ ++write_basic_package_version_file(asiopal-version.cmake VERSION ${OPENDNP3_VERSION} COMPATIBILITY ExactVersion) ++ ++set(PROJECT_NAME asiodnp3) ++set(FIND_DEPENDS "find_dependency(asiopal)\nfind_dependency(opendnp3)") ++configure_package_config_file(opendnp3-config.cmake.in asiodnp3-config.cmake ++ INSTALL_DESTINATION share/asiopal ++ PATH_VARS PROJECT_NAME FIND_DEPENDS ++) ++ ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asiodnp3-config.cmake DESTINATION share/asiodnp3) ++ ++install( ++ EXPORT asiodnp3-targets ++ DESTINATION share/asiodnp3 ++) ++ + if(DNP3_JAVA) + file(GLOB_RECURSE opendnp3java_SRC ./java/cpp/*.h ./java/cpp/*.cpp) + add_library(opendnp3java SHARED ${opendnp3java_SRC}) diff --git a/ports/opendnp3/opendnp3-config.cmake.in b/ports/opendnp3/opendnp3-config.cmake.in new file mode 100644 index 0000000000..79b2ef89e5 --- /dev/null +++ b/ports/opendnp3/opendnp3-config.cmake.in @@ -0,0 +1,22 @@ +# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@) + +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) +@FIND_DEPENDS@ + +include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) \ No newline at end of file diff --git a/ports/opendnp3/portfile.cmake b/ports/opendnp3/portfile.cmake new file mode 100644 index 0000000000..538f726392 --- /dev/null +++ b/ports/opendnp3/portfile.cmake @@ -0,0 +1,37 @@ +vcpkg_fail_port_install(ON_TARGET "uwp") + +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" STATICLIBS) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO dnp3/opendnp3 + REF 2.3.2 + SHA512 41686b5c32234088a5af3c71769b0193deb10a95d623579508cc740f126f35c18796f761093cec12ead469f0088839a680cc7d137b2f762a80c1736d71c3d90a + HEAD_REF master + PATCHES export-cmake.patch +) + +file(COPY ${CURRENT_PORT_DIR}/opendnp3-config.cmake.in DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS -DSTATICLIBS=${STATICLIBS} -DDNP3_TLS=ON +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +vcpkg_fixup_cmake_targets(CONFIG_PATH share/asiodnp3 TARGET_PATH share/asiodnp3) +vcpkg_fixup_cmake_targets(CONFIG_PATH share/asiopal TARGET_PATH share/asiopal) +vcpkg_fixup_cmake_targets(CONFIG_PATH share/opendnp3 TARGET_PATH share/opendnp3) +vcpkg_fixup_cmake_targets(CONFIG_PATH share/openpal TARGET_PATH share/openpal) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 466130d7ed..21b0e2de2d 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1187,6 +1187,8 @@ opencv3:x64-uwp = skip opencv3:x64-windows = skip opencv3:x64-windows-static = skip opencv3:x86-windows = skip +opendnp3:x64-uwp=fail +opendnp3:arm-uwp=fail openexr:arm64-windows=fail openexr:arm-uwp=fail openexr:x64-uwp=fail