Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
NuGet package generation from CMake.
Browse files Browse the repository at this point in the history
  • Loading branch information
emgre committed Apr 24, 2020
1 parent f7d9eee commit e016193
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 44 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
- name: Install system dependencies
run: >
if("${{ matrix.architecture }}" -eq "x86") { $flag = "--x86" } else { $flag = "" };
choco install --no-progress "$flag" openssl; mkdir build
choco install --no-progress "$flag" cmake.portable nuget.commandline openssl; mkdir build
- name: Install Java
uses: emgre/setup-java@master
with:
Expand Down Expand Up @@ -127,6 +127,16 @@ jobs:
with:
name: opendnp3-win-${{ matrix.architecture }}-msvc-${{ matrix.build-type }}-${{ github.sha }}
path: build/opendnp3-package
- name: NuGet package
if: ${{ matrix.build-type == 'Release' }}
working-directory: build
run: cpack -G NuGet . -C ${{ matrix.build-type }}
- name: Upload NuGet package
if: ${{ matrix.build-type == 'Release' }}
uses: actions/upload-artifact@v1
with:
name: opendnp3-win-${{ matrix.architecture }}-${{ github.sha }}-nuget
path: build/*.nupkg
- name: Build and test Java bindings
working-directory: java
run: >
Expand Down
16 changes: 4 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,7 @@ endif()
if(WIN32 AND DNP3_DOTNET)

message("The .NET framework version is: ${DNP3_DOTNET_FRAMEWORK_VERSION}")

add_subdirectory(./dotnet/CLRInterface)
add_subdirectory(./dotnet/CLRAdapter)

if(DNP3_EXAMPLES)
add_subdirectory(./dotnet/examples/master)
add_subdirectory(./dotnet/examples/master-gprs)
add_subdirectory(./dotnet/examples/master-gprs-tls)
add_subdirectory(./dotnet/examples/outstation)
endif()
add_subdirectory(./dotnet)

endif()

Expand All @@ -163,8 +154,9 @@ endif()
# Packaging
set(CPACK_PACKAGE_NAME opendnp3)
set(CPACK_PACKAGE_VENDOR "Automatak LLC")
set(CPACK_PACKAGE_DESCRIPTION "DNP3 (IEEE-1815) protocol stack")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/dnp3/opendnp3")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DNP3 (IEEE-1815) protocol stack")
set(CPACK_PACKAGE_DESCRIPTION "OpenDNP3 is the de facto reference implementation of IEEE-1815 (DNP3), a standards-based SCADA protocol.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://dnp3.github.io/")
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_LIST_DIR}/LICENSE)
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_LIST_DIR}/README.md)
set(CPACK_PACKAGE_VERSION_MAJOR ${OPENDNP3_MAJOR_VERSION})
Expand Down
6 changes: 5 additions & 1 deletion dotnet/CLRAdapter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,8 @@ src/UpdateAdapter.h

set_target_properties(DNP3CLRAdapter PROPERTIES FOLDER "dotnet/libs" COMMON_LANGUAGE_RUNTIME "")
set_property(TARGET DNP3CLRAdapter PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION ${DNP3_DOTNET_FRAMEWORK_VERSION})
target_link_libraries(DNP3CLRAdapter DNP3CLRInterface opendnp3)
target_link_libraries(DNP3CLRAdapter DNP3CLRInterface opendnp3)
install(TARGETS DNP3CLRAdapter
RUNTIME DESTINATION lib/${framework_folder_name}
LIBRARY DESTINATION lib/${framework_folder_name}
)
5 changes: 4 additions & 1 deletion dotnet/CLRInterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,7 @@ set_target_properties(DNP3CLRInterface PROPERTIES FOLDER "dotnet/libs")
set_property(TARGET DNP3CLRInterface PROPERTY VS_DOTNET_REFERENCES "System.Xml")
set_property(TARGET DNP3CLRInterface PROPERTY VS_DOTNET_TARGET_FRAMEWORK_VERSION ${DNP3_DOTNET_FRAMEWORK_VERSION})
target_compile_options(DNP3CLRInterface PRIVATE "/langversion:6")
file(COPY ../nuget/opendnp3.nuspec DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release)
install(TARGETS DNP3CLRInterface
RUNTIME DESTINATION lib/${framework_folder_name}
LIBRARY DESTINATION lib/${framework_folder_name}
)
16 changes: 16 additions & 0 deletions dotnet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
string(REGEX REPLACE "[^0-9]" "" framework_folder_name ${DNP3_DOTNET_FRAMEWORK_VERSION})
string(PREPEND "net" framework_folder_name)

add_subdirectory(./CLRInterface)
add_subdirectory(./CLRAdapter)

if(DNP3_EXAMPLES)
add_subdirectory(./examples/master)
add_subdirectory(./examples/master-gprs)
add_subdirectory(./examples/master-gprs-tls)
add_subdirectory(./examples/outstation)
endif()

set(CPACK_NUGET_PACKAGE_DESCRIPTION_SUMMARY "OpenDNP3 is the de facto reference implementation of IEEE-1815 (DNP3), a standards-based SCADA protocol.")
set(CPACK_NUGET_PACKAGE_COPYRIGHT "Green Energy Corp, Automatak LLC, and contributors")
set(CPACK_NUGET_PACKAGE_LICENSEURL "https://github.com/dnp3/opendnp3/blob/develop/LICENSE")
29 changes: 0 additions & 29 deletions dotnet/nuget/opendnp3.nuspec

This file was deleted.

0 comments on commit e016193

Please sign in to comment.