Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[enet] Export config, support BUILD_SHARED_LIBS, and add usage #20282

Merged
merged 4 commits into from
Sep 24, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
32 changes: 27 additions & 5 deletions ports/enet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.0.2)

project(enet)

Expand Down Expand Up @@ -55,9 +55,7 @@ if(HAS_SOCKLEN_T)
add_definitions(-DHAS_SOCKLEN_T=1)
endif()

include_directories(${PROJECT_SOURCE_DIR}/include)

add_library(enet STATIC
add_library(enet
callbacks.c
compress.c
host.c
Expand All @@ -69,13 +67,37 @@ add_library(enet STATIC
win32.c
)

add_library(enet::enet ALIAS enet)

target_include_directories(enet PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

if (BUILD_SHARED_LIBS)
target_compile_definitions(enet
PUBLIC ENET_DLL
PRIVATE ENET_BUILDING_LIB
)
endif()


if (WIN32)
target_link_libraries(enet winmm ws2_32)
endif()

install(TARGETS enet ARCHIVE DESTINATION lib
set(ENET_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/enet)

install(TARGETS enet EXPORT unofficial-enet-config
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)

INSTALL(EXPORT unofficial-enet-config
NAMESPACE unofficial::enet::
FILE unofficial-enet-config.cmake
DESTINATION share/unofficial-enet
)

install(DIRECTORY include/
DESTINATION include)
1 change: 1 addition & 0 deletions ports/enet/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ vcpkg_configure_cmake(
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-enet)

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

Expand Down
1 change: 1 addition & 0 deletions ports/enet/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "enet",
"version": "1.3.17",
"port-version": 1,
"description": "Reliable UDP networking library",
"homepage": "https://github.com/lsalzman/enet"
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@
},
"enet": {
"baseline": "1.3.17",
"port-version": 0
"port-version": 1
},
"ensmallen": {
"baseline": "2.17.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/e-/enet.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5fe2375f7ce85792dae4b9ad06196c89efd386a7",
"version": "1.3.17",
"port-version": 1
},
{
"git-tree": "004a06d1e158f14059f597a1848b8f4a8d0a42f8",
"version": "1.3.17",
Expand Down