From cfc49eb2860fb171ef4f4efe4a9ac577369035f9 Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Wed, 15 May 2024 19:37:14 +0200 Subject: [PATCH] Revert slirp dynamic/static check, and make it not use dllimport/export when building statically --- src/frontend/libslirp/CMakeLists.txt | 7 ++----- src/frontend/libslirp/src/libslirp.h | 10 +++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/frontend/libslirp/CMakeLists.txt b/src/frontend/libslirp/CMakeLists.txt index 73ba59d6..4220d528 100644 --- a/src/frontend/libslirp/CMakeLists.txt +++ b/src/frontend/libslirp/CMakeLists.txt @@ -46,11 +46,8 @@ set(SOURCES configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/libslirp-version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/libslirp-version.h") -if (BUILD_STATIC) - add_library(slirp STATIC ${SOURCES}) -else() - add_library(slirp ${SOURCES}) -endif() +add_library(slirp STATIC ${SOURCES}) +target_compile_definitions(slirp PRIVATE LIBSLIRP_STATIC_BUILD) target_include_directories(slirp PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/glib") target_include_directories(slirp PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src") diff --git a/src/frontend/libslirp/src/libslirp.h b/src/frontend/libslirp/src/libslirp.h index 3caa6f18..68f7edfa 100644 --- a/src/frontend/libslirp/src/libslirp.h +++ b/src/frontend/libslirp/src/libslirp.h @@ -12,10 +12,14 @@ #include #include typedef SSIZE_T slirp_ssize_t; -#ifdef BUILDING_LIBSLIRP -# define SLIRP_EXPORT __declspec(dllexport) +#ifndef LIBSLIRP_STATIC_BUILD +# ifdef BUILDING_LIBSLIRP +# define SLIRP_EXPORT __declspec(dllexport) +# else +# define SLIRP_EXPORT __declspec(dllimport) +# endif #else -# define SLIRP_EXPORT __declspec(dllimport) +# define SLIRP_EXPORT #endif #else #include