Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 49 additions & 34 deletions ports/nethost/0001-nethost-cmakelists.patch
Original file line number Diff line number Diff line change
@@ -1,58 +1,73 @@
diff --git a/src/installer/corehost/cli/common.cmake b/src/installer/corehost/cli/common.cmake
index 63e7306..639c90e 100644
--- a/src/installer/corehost/cli/common.cmake
+++ b/src/installer/corehost/cli/common.cmake
@@ -5,9 +5,6 @@
project(${DOTNET_PROJECT_NAME})

if(WIN32)
- add_compile_options($<$<CONFIG:RelWithDebInfo>:/MT>)
- add_compile_options($<$<CONFIG:Release>:/MT>)
- add_compile_options($<$<CONFIG:Debug>:/MTd>)
else()
add_compile_options(-fvisibility=hidden)
endif()
diff --git a/src/installer/corehost/cli/nethost/CMakeLists.txt b/src/installer/corehost/cli/nethost/CMakeLists.txt
index 7473958..49c664f 100644
--- a/src/installer/corehost/cli/nethost/CMakeLists.txt
+++ b/src/installer/corehost/cli/nethost/CMakeLists.txt
@@ -2,12 +2,14 @@
diff --git a/src/native/corehost/nethost/CMakeLists.txt b/src/native/corehost/nethost/CMakeLists.txt
index a9f44e720..0f24d4458 100644
--- a/src/native/corehost/nethost/CMakeLists.txt
+++ b/src/native/corehost/nethost/CMakeLists.txt
@@ -1,11 +1,14 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.

-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 3.14)
+cmake_minimum_required (VERSION 3.14.5)
project(nethost)

set(DOTNET_PROJECT_NAME "nethost")

# Include directories
+include(../../../settings.cmake)
+include(../../../functions.cmake)
+include(../../../../eng/native/configurepaths.cmake)
+include("${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake")
include_directories(../fxr)

# CMake does not recommend using globbing since it messes with the freshness checks
@@ -22,13 +24,18 @@ if(WIN32)
@@ -19,12 +22,23 @@ if(CLR_CMAKE_TARGET_WIN32)
Exports.def)
endif()

+if(BUILD_SHARED_LIBS)
include(../lib.cmake)
+set(targets nethost)
+else()
+include(../hostmisc/hostmisc.cmake)
include(../lib_static.cmake)
+add_library(nethost INTERFACE)
+target_link_libraries(nethost INTERFACE libnethost)
+set(targets libnethost nethost)
+target_include_directories(libnethost INTERFACE $<INSTALL_INTERFACE:include>)
+endif()
+target_include_directories(nethost INTERFACE $<INSTALL_INTERFACE:include>)

add_definitions(-DFEATURE_LIBHOST=1)
add_definitions(-DNETHOST_EXPORT)

+if(NOT BUILD_SHARED_LIBS)
# Copy static lib PDB to the project output directory
if (WIN32)
set_target_properties(libnethost PROPERTIES
@@ -32,15 +46,18 @@ if (WIN32)
COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
endif(WIN32)
+endif()

-install(FILES ../coreclr_delegates.h DESTINATION corehost)
-install(FILES ../hostfxr.h DESTINATION corehost)
-install(FILES nethost.h DESTINATION corehost)
-install(TARGETS nethost DESTINATION corehost)
-install(TARGETS libnethost DESTINATION corehost)
-install_symbols(nethost corehost)
-install_with_stripped_symbols(nethost TARGETS corehost)
+set(NETHOST_HEADERS nethost.h ../coreclr_delegates.h ../hostfxr.h)
+install(FILES ${NETHOST_HEADERS} DESTINATION include)
+install(TARGETS ${targets} EXPORT unofficial-nethost-config
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)

-# Only Windows creates a symbols file for static libs.
-if (WIN32)
- install_with_stripped_symbols(libnethost TARGETS corehost)
-else()
- install(TARGETS libnethost DESTINATION corehost)
-endif(WIN32)
\ No newline at end of file
+install(FILES nethost.h ../coreclr_delegates.h ../hostfxr.h DESTINATION include)
+if(BUILD_SHARED_LIBS)
+install(TARGETS nethost)
+else()
+install(TARGETS libnethost)
+endif()
+install(EXPORT unofficial-nethost-config
+ DESTINATION share/unofficial-nethost
+ FILE unofficial-nethost-config.cmake
+ NAMESPACE unofficial::nethost::
+)
13 changes: 0 additions & 13 deletions ports/nethost/0002-settings-cmake.patch

This file was deleted.

37 changes: 24 additions & 13 deletions ports/nethost/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
set(COMMIT_HASH 188427d7e18102c45fc6d0e20c135e226f215992)
set(COMMIT_HASH v6.0.5)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO dotnet/runtime
REF ${COMMIT_HASH}
SHA512 5a93c66c87e2113f733702d938efd39456c99fb74b383097b8d877df21536fcbcba901606aa70db6c8f1a16421ea8f06822c5b0ab1d882631b6daecbed8d03cc
SHA512 ccf4865bd9ea63c525fc11b0008774052d51f9247427fc28a91e3836e8e8d157569565bdac17326fe44a446d98a3e4b74a55779d01bede596f2458f4ec86f3aa
HEAD_REF master
PATCHES
0001-nethost-cmakelists.patch
0002-settings-cmake.patch
)

set(PRODUCT_VERSION "5.0.0")
set(PRODUCT_VERSION "6.0.5")

if(VCPKG_TARGET_IS_WINDOWS)
set(RID_PLAT "win")
Expand Down Expand Up @@ -41,9 +40,10 @@ endif()

set(BASE_RID "${RID_PLAT}-${RID_ARCH}")

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}/src/installer/corehost/cli/nethost
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/src/native/corehost/nethost/"
# vcpkg's /utf-8 is incompatible with dotnet's own /source-charset:utf-8
NO_CHARSET_FLAG
OPTIONS
"-DSKIP_VERSIONING=1"
"-DCLI_CMAKE_HOST_POLICY_VER:STRING=${PRODUCT_VERSION}"
Expand All @@ -52,15 +52,26 @@ vcpkg_configure_cmake(
"-DCLI_CMAKE_COMMON_HOST_VER:STRING=${PRODUCT_VERSION}"
"-DCLI_CMAKE_PKG_RID:STRING=${BASE_RID}"
"-DCLI_CMAKE_COMMIT_HASH:STRING=${COMMIT_HASH}"
"-DCLI_CMAKE_PLATFORM_ARCH_${ARCH_NAME}=1"
"-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=10.0"
"-DCLR_CMAKE_TARGET_ARCH_${ARCH_NAME}=1"
"-DCLR_CMAKE_TARGET_ARCH=${RID_ARCH}"
"-DCLR_CMAKE_HOST_ARCH=${RID_ARCH}"
MAYBE_UNUSED_VARIABLES
SKIP_VERSIONING # only used on WIN32
)

vcpkg_install_cmake()
vcpkg_cmake_install()

vcpkg_copy_pdbs()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-nethost)

file(INSTALL ${SOURCE_PATH}/LICENSE.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/nethost.h" "#ifdef NETHOST_USE_AS_STATIC" "#if 1")
else()
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/nethost.h" "#ifdef NETHOST_USE_AS_STATIC" "#if 0")
endif()

file(INSTALL "${SOURCE_PATH}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
6 changes: 2 additions & 4 deletions ports/nethost/usage
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
The package nethost can be used via CMake:

find_path(NETHOST_INCLUDE_DIRS nethost.h)
find_library(NETHOST_LIBRARY NAMES libnethost nethost)
target_include_directories(main PRIVATE ${NETHOST_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${NETHOST_LIBRARY})
find_package(unofficial-nethost CONFIG REQUIRED)
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
target_link_libraries(main PRIVATE unofficial::nethost::nethost)
15 changes: 12 additions & 3 deletions ports/nethost/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{
"name": "nethost",
"version-date": "2019-12-21",
"port-version": 2,
"version": "6.0.5",
"description": "Provides a set of APIs that can be used to host .NET Core (dotnet)",
"homepage": "https://github.com/dotnet/runtime/tree/master/src/installer/corehost/cli/nethost",
"supports": "!uwp"
"supports": "!uwp",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4833,8 +4833,8 @@
"port-version": 3
},
"nethost": {
"baseline": "2019-12-21",
"port-version": 2
"baseline": "6.0.5",
"port-version": 0
},
"nettle": {
"baseline": "3.7.3",
Expand Down
5 changes: 5 additions & 0 deletions versions/n-/nethost.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "267a7f140709e65c5d692a7f3add885021764c25",
"version": "6.0.5",
"port-version": 0
},
{
"git-tree": "5b1a7d98ce2c1520bbb370dfc2fcb8c3d704c300",
"version-date": "2019-12-21",
Expand Down