diff --git a/CMakeLists.txt b/CMakeLists.txt index 88f9a382c..43fc79a2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,6 +245,19 @@ else() set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) endif() +if(WIN32) + target_compile_definitions( + ${PROJECT_NAME} PUBLIC + WINDOWS_SYS + UNICODE + _UNICODE + NOGDI + NOMINMAX + NOCRYPT + WIN_DLL_EXPORT ) + target_link_libraries(${PROJECT_NAME} PUBLIC ws2_32) +endif() + ## As of today libretroshare doesn't hide implementation details properly so it ## is necessary to flag all implementation headers as public target_include_directories( @@ -299,8 +312,8 @@ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL OpenSSL::Crypto) if(RS_RNPLIB) # Add RNP build directories to linker search path target_link_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/../supportlibs/librnp/Build/src/lib - ${CMAKE_CURRENT_BINARY_DIR}/../supportlibs/librnp/Build/src/libsexpp + ${CMAKE_CURRENT_SOURCE_DIR}/../supportlibs/librnp/Build/src/lib + ${CMAKE_CURRENT_SOURCE_DIR}/../supportlibs/librnp/Build/src/libsexpp ) # Link libraries by name, including RNP libs and dependencies first @@ -311,7 +324,7 @@ if(RS_RNPLIB) target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../supportlibs/librnp/include" - "${CMAKE_CURRENT_BINARY_DIR}/../supportlibs/librnp/Build/src/lib" + "${CMAKE_CURRENT_SOURCE_DIR}/../supportlibs/librnp/Build/src/lib" ) else() @@ -430,19 +443,21 @@ if(RS_JSON_API) JSONAPI_GENERATOR_EXECUTABLE "${JSONAPI_GENERATOR_SOURCE_DIR}/jsonapi-generator.py" ) - file( - COPY "src/jsonapi/jsonapi-generator-doxygen.conf" - DESTINATION "${JSON_API_GENERATOR_WORK_DIR}" ) + if(NOT EXISTS "${JSON_API_GENERATOR_DOXYFILE}") + file( + COPY "src/jsonapi/jsonapi-generator-doxygen.conf" + DESTINATION "${JSON_API_GENERATOR_WORK_DIR}" ) - file( - APPEND - "${JSON_API_GENERATOR_DOXYFILE}" - "OUTPUT_DIRECTORY=${JSONAPI_GENERATOR_OUTPUT_DIR}\n" - "INPUT=${CMAKE_CURRENT_SOURCE_DIR}/src/\n" - "EXCLUDE=" - " ${CMAKE_CURRENT_SOURCE_DIR}/src/tests" - " ${CMAKE_CURRENT_SOURCE_DIR}/src/unused" - " ${CMAKE_CURRENT_SOURCE_DIR}/src/unfinished\n" ) + file( + APPEND + "${JSON_API_GENERATOR_DOXYFILE}" + "OUTPUT_DIRECTORY=${JSONAPI_GENERATOR_OUTPUT_DIR}\n" + "INPUT=${CMAKE_CURRENT_SOURCE_DIR}/src/\n" + "EXCLUDE=" + " ${CMAKE_CURRENT_SOURCE_DIR}/src/tests" + " ${CMAKE_CURRENT_SOURCE_DIR}/src/unused" + " ${CMAKE_CURRENT_SOURCE_DIR}/src/unfinished\n" ) + endif() add_custom_command( OUTPUT @@ -465,6 +480,8 @@ if(RS_JSON_API) set(BUILD_TESTS OFF CACHE BOOL "Do not build restbed tests") set(BUILD_SSL OFF CACHE BOOL "Do not build restbed SSL support") + set(BUILD_SHARED_LIBRARY OFF) + set(BUILD_SHARED_LIBS OFF) set(RESTBED_DEVEL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../supportlibs/restbed/") if(RS_ANDROID) @@ -498,13 +515,20 @@ if(RS_JSON_API) GIT_SHALLOW TRUE GIT_PROGRESS TRUE TIMEOUT 10 -# EXCLUDE_FROM_ALL # Available only in CMake >= 3.28 + PATCH_COMMAND sed -i -e "s|/wd4251||g" -e "s|VERSION 3.1.0|VERSION 3.5.0|g" CMakeLists.txt ) FetchContent_MakeAvailable(restbed) + if(TARGET restbed-shared) + set_target_properties(restbed-shared PROPERTIES EXCLUDE_FROM_ALL TRUE) + endif() + target_include_directories( ${PROJECT_NAME} PUBLIC ${restbed_SOURCE_DIR}/source/ ) target_link_libraries(${PROJECT_NAME} PRIVATE restbed-static) + if(WIN32) + target_link_libraries(restbed-static INTERFACE ws2_32 winmm iphlpapi mswsock) + endif() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4ad8b4300..def1b2e9e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -250,12 +250,14 @@ else() list(APPEND RS_IMPLEMENTATION_HEADERS pgp/openpgpsdkhandler.h) endif() -#./plugins/dlfcn_win32.cc -#./plugins/dlfcn_win32.h -#./plugins/pluginmanager.h #./plugins/rscacheservice.h #./plugins/rspqiservice.h +if(WIN32) + list(APPEND RS_SOURCES plugins/dlfcn_win32.cc) + list(APPEND RS_IMPLEMENTATION_HEADERS plugins/dlfcn_win32.h) +endif() + list( APPEND RS_SOURCES plugins/pluginmanager.cc ) diff --git a/src/jsonapi/jsonapi-generator.py b/src/jsonapi/jsonapi-generator.py index 179546999..e8c09c568 100755 --- a/src/jsonapi/jsonapi-generator.py +++ b/src/jsonapi/jsonapi-generator.py @@ -190,15 +190,17 @@ def processFile(file): orderedParamNames.append(pName) for tmpPN in memberdef.findall('.//parametername'): - tmpParam = paramsMap[tmpPN.text] - tmpD = tmpPN.attrib['direction'] if 'direction' in tmpPN.attrib else '' + pName = getText(tmpPN) + if pName in paramsMap: + tmpParam = paramsMap[pName] + tmpD = tmpPN.attrib['direction'] if 'direction' in tmpPN.attrib else '' - if 'in' in tmpD: - tmpParam._in = True - hasInput = True - if 'out' in tmpD: - tmpParam._out = True - hasOutput = True + if 'in' in tmpD: + tmpParam._in = True + hasInput = True + if 'out' in tmpD: + tmpParam._out = True + hasOutput = True # Params sanity check for pmKey in paramsMap: diff --git a/src/pqi/sslfns.h b/src/pqi/sslfns.h index c22076c51..560d84c45 100644 --- a/src/pqi/sslfns.h +++ b/src/pqi/sslfns.h @@ -1,4 +1,4 @@ -/******************************************************************************* +/******************************************************************************* * libretroshare/src/pqi: sslfns.h * * * * libretroshare: retroshare core library * @@ -28,6 +28,13 @@ /******************** notify of new Cert **************************/ +#ifdef X509_NAME +#undef X509_NAME +#endif +#ifdef X509_EXTENSIONS +#undef X509_EXTENSIONS +#endif + #include #include diff --git a/src/retroshare/rstor.h b/src/retroshare/rstor.h index 486c830fe..9f22dcbbb 100644 --- a/src/retroshare/rstor.h +++ b/src/retroshare/rstor.h @@ -41,6 +41,10 @@ enum class RsTorManagerEventCode: uint8_t TOR_MANAGER_STOPPED = 0x06, }; +#ifdef ERROR +#undef ERROR +#endif + // Status of the Tor hidden service setup/loaded by RS enum class RsTorHiddenServiceStatus: uint8_t { diff --git a/src/util/rsdebug.h b/src/util/rsdebug.h index 384e6eb2a..799325fce 100644 --- a/src/util/rsdebug.h +++ b/src/util/rsdebug.h @@ -38,6 +38,10 @@ #include "util/rsmacrosugar.hpp" +#ifdef ERROR +#undef ERROR +#endif + #ifdef __ANDROID__ enum class RsLoggerCategories {