vcpkg/ports/ecal/0007-allow-static-build-of-core.patch
2024-07-13 10:28:10 -04:00

78 lines
2.6 KiB
Diff

diff --git a/ecal/core/CMakeLists.txt b/ecal/core/CMakeLists.txt
index 8655d134a..03d0f7c81 100644
--- a/ecal/core/CMakeLists.txt
+++ b/ecal/core/CMakeLists.txt
@@ -449,7 +449,7 @@ set(ecal_header_public
${ecal_header_msg}
)
-ecal_add_ecal_shared_library(${PROJECT_NAME}
+ecal_add_library(${PROJECT_NAME}
${ecal_config_src}
${ecal_io_mtx_src}
${ecal_io_mtx_linux_src}
@@ -483,7 +483,7 @@ if(UNIX)
set_source_files_properties(src/util/convert_utf.cpp PROPERTIES COMPILE_FLAGS -Wno-implicit-fallthrough)
endif()
-ecal_add_ecal_shared_library(${PROJECT_NAME}_c ${ecal_c_src} ${ecal_c_win_src})
+ecal_add_library(${PROJECT_NAME}_c ${ecal_c_src} ${ecal_c_win_src})
add_library(eCAL::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
add_library(eCAL::${PROJECT_NAME}_c ALIAS ${PROJECT_NAME}_c)
@@ -514,6 +514,11 @@ target_compile_definitions(${PROJECT_NAME}
ECALC_NO_DEPRECATION_WARNINGS
)
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(${PROJECT_NAME}_c PUBLIC eCAL_SHARED_LIB)
+ target_compile_definitions(${PROJECT_NAME} PUBLIC eCAL_SHARED_LIB)
+endif()
+
if(ECAL_NPCAP_SUPPORT)
target_compile_definitions(${PROJECT_NAME}
PRIVATE ECAL_NPCAP_SUPPORT)
@@ -565,8 +570,8 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${SIMPLEINI_INCLUDE_DIRS})
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER ecal/core)
set_property(TARGET ${PROJECT_NAME}_c PROPERTY FOLDER ecal/core)
-ecal_install_ecal_shared_library(${PROJECT_NAME}_c)
-ecal_install_ecal_shared_library(${PROJECT_NAME})
+ecal_install_ecal_library(${PROJECT_NAME}_c)
+ecal_install_ecal_library(${PROJECT_NAME})
install(DIRECTORY
"include/" DESTINATION "${INSTALL_INCLUDE_DIR}" COMPONENT sdk
diff --git a/ecal/core/include/ecal/ecal_os.h b/ecal/core/include/ecal/ecal_os.h
index 2b051d893..f24cdc325 100644
--- a/ecal/core/include/ecal/ecal_os.h
+++ b/ecal/core/include/ecal/ecal_os.h
@@ -47,7 +47,7 @@
#define ECAL_OS_FREEBSD
#endif
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && defined(eCAL_SHARED_LIB)
#ifdef eCAL_EXPORTS
#define ECALC_API __declspec(dllexport)
#else /* eCAL_EXPORTS */
@@ -65,11 +65,15 @@
#if !defined(ECALC_NO_DEPRECATION_WARNINGS)
#ifdef _MSC_VER
+ #ifdef eCAL_SHARED_LIB
#ifdef eCAL_EXPORTS
#define ECALC_API_DEPRECATED __declspec(dllexport deprecated)
#else /* eCAL_EXPORTS */
#define ECALC_API_DEPRECATED __declspec(dllimport deprecated)
#endif /* eCAL_EXPORTS */
+ #else
+ #define ECALC_API_DEPRECATED
+ #endif
#elif defined(__GNUC__) || defined(__clang__)
#define ECALC_API_DEPRECATED __attribute__((deprecated))
#else
--
2.45.0.windows.1