Compare commits

...
4 Commits
4 changed files with 11 additions and 18 deletions

No files matched your search

+8 -8
View File
@@ -53,6 +53,9 @@ option (OPENDHT_DOCUMENTATION "Create and install the HTML based API documentati
# Build flags
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED on)
if(MSVC AND NOT BUILD_SHARED_LIBS AND NOT CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
if (OPENDHT_C)
set (CMAKE_C_STANDARD 11)
@@ -63,7 +66,6 @@ if (OPENDHT_C)
endif()
endif()
# Dependencies
if (NOT HAVE_CXX_ATOMICS_WITHOUT_LIB
# For ARM EABI (armel), little-endian MIPS (mipsel), etc.
OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
@@ -79,6 +81,7 @@ if (WIN32)
add_definitions(-DWINVER=${WINVER} -D_WIN32_WINNT=${WINVER})
endif()
# Dependencies
list (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if (NOT MSVC)
set (THREADS_PREFER_PTHREAD_FLAG TRUE)
@@ -522,10 +525,6 @@ if (MSVC)
endif()
if (OPENDHT_STATIC)
target_link_libraries(opendht PUBLIC ${Win32_STATIC_LIBRARIES} ${Win32_IMPORT_LIBRARIES})
set_target_properties(opendht PROPERTIES
OUTPUT_NAME "libopendht"
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>"
)
endif()
else()
target_link_libraries(opendht
@@ -606,9 +605,10 @@ if (OPENDHT_C)
)
target_compile_definitions(opendht-c PRIVATE OPENDHT_C_BUILD)
target_link_libraries(opendht-c PRIVATE opendht)
set_target_properties (opendht-c PROPERTIES SOVERSION ${opendht_VERSION_MAJOR} VERSION ${opendht_VERSION})
if(NOT BUILD_SHARED_LIBS)
set_target_properties(opendht-c PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if (BUILD_SHARED_LIBS)
target_compile_definitions(opendht-c PRIVATE OPENDHT_C_BUILD)
target_compile_definitions(opendht-c PUBLIC opendht_EXPORTS)
set_target_properties (opendht-c PROPERTIES SOVERSION ${opendht_VERSION_MAJOR} VERSION ${opendht_VERSION})
endif()
install (TARGETS opendht-c DESTINATION ${CMAKE_INSTALL_LIBDIR} EXPORT opendht-c)
-1
View File
@@ -27,7 +27,6 @@
"name": "msvc",
"generator": "Visual Studio 17 2022",
"inherits": "default",
"binaryDir": "${sourceDir}/build-vs",
"cacheVariables": {
"BUILD_TESTING": true,
"VCPKG_MANIFEST_FEATURES": "test",
+3 -3
View File
@@ -135,7 +135,7 @@ typedef struct dht_op_token dht_op_token;
OPENDHT_C_PUBLIC void dht_op_token_delete(dht_op_token* token);
// config
struct OPENDHT_PUBLIC dht_node_config {
struct OPENDHT_C_PUBLIC dht_node_config {
dht_infohash node_id;
uint32_t network;
bool is_bootstrap;
@@ -144,13 +144,13 @@ struct OPENDHT_PUBLIC dht_node_config {
};
typedef struct dht_node_config dht_node_config;
struct OPENDHT_PUBLIC dht_secure_config {
struct OPENDHT_C_PUBLIC dht_secure_config {
dht_node_config node_config;
dht_identity id;
};
typedef struct dht_secure_config dht_secure_config;
struct OPENDHT_PUBLIC dht_runner_config {
struct OPENDHT_C_PUBLIC dht_runner_config {
dht_secure_config dht_config;
bool threaded;
const char* proxy_server;
-6
View File
@@ -10,9 +10,6 @@ function (configure_tool name extra_files)
if (MSVC)
target_sources(${name} PRIVATE ${MSC_COMPAT_SOURCES})
target_link_libraries (${name} PUBLIC opendht wsock32 ws2_32)
if(NOT BUILD_SHARED_LIBS)
set_target_properties(${name} PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
target_link_libraries (${name} PUBLIC opendht)
target_include_directories (${name} PRIVATE SYSTEM ${MSC_COMPAT_DIR} ${MSVC_COMPAT_DIR})
else()
@@ -42,9 +39,6 @@ if (OPENDHT_C)
if (MSVC)
target_sources(dhtcnode PRIVATE ${MSC_COMPAT_SOURCES})
target_include_directories (dhtcnode SYSTEM PRIVATE ${MSC_COMPAT_DIR} ${MSVC_COMPAT_DIR})
if(NOT BUILD_SHARED_LIBS)
set_target_properties(dhtcnode PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
endif ()