diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake index a480b91e..0b46ce24 100644 --- a/CMakeCPack.cmake +++ b/CMakeCPack.cmake @@ -32,6 +32,20 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux") set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${OS_ID}-${OS_VERSION_ID}") endif () +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") + set(CMAKE_BITNESS "64") + elseif (CMAKE_SIZEOF_VOID_P STREQUAL "4") + set(CMAKE_BITNESS "32") + endif () + + if (MSVC) + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-win${CMAKE_BITNESS}-msvc") + else () + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}-win${CMAKE_BITNESS}-mingw") + endif () +endif () + if (UNIX) if (OS_ID_LIKE MATCHES "debian") list(APPEND CPACK_GENERATOR "DEB") diff --git a/make.cmd b/make.cmd index 65ca5064..27a40e0e 100644 --- a/make.cmd +++ b/make.cmd @@ -24,9 +24,16 @@ If "%~3" == "" ( ) ) -Set "CMAKE_BUILD=%~2" +If "%~4" == "" ( + Goto :Usage +) Else If Not "%~4" == "package" ( + If Not "%~4" == "install" ( + Goto :Usage + ) +) If "%~1" == "MSVC" ( + Set "BUILDTYPE=msvc" Set "CMAKE_GENERATOR=Visual Studio 15 2017 Win64" If "%~3" == "x86" ( @@ -35,22 +42,34 @@ If "%~1" == "MSVC" ( ) If "%~1" == "MINGW" ( + Set "BUILDTYPE=mingw" Set "CMAKE_GENERATOR=MinGW Makefiles" ) +If "%~2" == "Debug" ( + Set "BUILDCONFIG=debug" + Set "CMAKE_BUILD=Debug" +) + +If "%~2" == "Release" ( + Set "BUILDCONFIG=release" + Set "CMAKE_BUILD=RelWithDebInfo" +) + +Set TARGET=%~4 Set SEABOLTDIR=%~dp0 -Set BUILDDIR=%SEABOLTDIR%\build +Set BUILDDIR=%SEABOLTDIR%\build-%BUILDTYPE%-%BUILDCONFIG% Mkdir %BUILDDIR% Pushd %BUILDDIR% -cmake.exe -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=%CMAKE_BUILD% -DCMAKE_INSTALL_PREFIX=dist .. || Goto :Failure -cmake.exe --build . --target install --config %CMAKE_BUILD% || Goto :Failure +cmake.exe -G "%CMAKE_GENERATOR%" -DCMAKE_CONFIGURATION_TYPES=%CMAKE_BUILD% -DCMAKE_BUILD_TYPE=%CMAKE_BUILD% -DCMAKE_INSTALL_PREFIX=dist .. || Goto :Failure +cmake.exe --build . --target %TARGET% --config %CMAKE_BUILD% || Goto :Failure Popd Exit /b 0 :Usage - @Echo "Usage: %~n0 (MSVC|MINGW) (Debug|Release) (x86|x64)" + @Echo "Usage: %~n0 (MSVC|MINGW) (Debug|Release) (x86|x64) (install|package)" Goto :Failure :Failure diff --git a/make_debug.cmd b/make_debug.cmd index bf5dfec3..b1e9d078 100644 --- a/make_debug.cmd +++ b/make_debug.cmd @@ -1,6 +1,6 @@ @Echo Off -Call %~dp0\make.cmd %~1 Debug x64 || Goto :Failure +Call %~dp0\make.cmd %~1 Debug x64 install || Goto :Failure Exit /b 0 :Failure diff --git a/make_release.cmd b/make_release.cmd index 1621d636..f0b3ce3d 100644 --- a/make_release.cmd +++ b/make_release.cmd @@ -1,6 +1,6 @@ @Echo Off -Call %~dp0\make.cmd %~1 Release x64 || Goto :Failure +Call %~dp0\make.cmd %~1 Release x64 install || Goto :Failure Exit /b 0 :Failure diff --git a/run_tests.ps1 b/run_tests.ps1 index d6727dcf..68fd4cec 100644 --- a/run_tests.ps1 +++ b/run_tests.ps1 @@ -1,4 +1,4 @@ -$ErrorActionPreference="Stop" +$ErrorActionPreference="Stop" $BaseDir=$PSScriptRoot $Password="password" $Port=7699 @@ -49,7 +49,7 @@ Function Cleanup($Target) { try { - Get-ChildItem -Path $Target -Recurse | Remove-Item -Force -Recurse -ErrorAction Stop + Get-ChildItem -Path $Target -ErrorAction Ignore | Remove-Item -Force -Recurse -ErrorAction Stop } catch { @@ -138,7 +138,11 @@ Function StopServer($Server) Function RunTests($Version) { - $ServerBase = "$BaseDir\build\server" + $CompilationBase = "$Basedir\build-$( $env:SEABOLT_TOOLCHAIN )-debug" + $SeaboltCli = Get-ChildItem -Path $CompilationBase\bin -Filter seabolt-cli.exe -Recurse + $SeaboltTest = Get-ChildItem -Path $CompilationBase\bin -Filter seabolt-test.exe -Recurse + + $ServerBase = "$CompilationBase\server" Cleanup $ServerBase Write-Host "Testing against Neo4j $Version" @@ -150,7 +154,7 @@ Function RunTests($Version) Write-Host "-- Checking server" $env:BOLT_PASSWORD=$Password $env:BOLT_PORT=$Port - & $BaseDir\build\bin\Debug\seabolt-cli.exe debug "UNWIND range(1, 10000) AS n RETURN n" + & $SeaboltCli.FullName debug "UNWIND range(1, 10000) AS n RETURN n" if ( $LASTEXITCODE -ne 0 ) { throw @{ @@ -160,7 +164,7 @@ Function RunTests($Version) } Write-Host "-- Running tests" - & $BaseDir\build\bin\Debug\seabolt-test.exe $TestArgs + & $SeaboltTest.FullName $TestArgs if ( $LASTEXITCODE -ne 0 ) { throw @{ diff --git a/src/seabolt/src/CMakeLists.txt b/src/seabolt/src/CMakeLists.txt index 8a0cf3d5..d6692f99 100644 --- a/src/seabolt/src/CMakeLists.txt +++ b/src/seabolt/src/CMakeLists.txt @@ -156,6 +156,10 @@ foreach (target ${SEABOLT_SHARED} ${SEABOLT_STATIC}) target_link_libraries(${target} PUBLIC ws2_32) + + target_compile_definitions(${target} + PRIVATE + _WIN32_WINNT=0x0601) endif () if (WITH_TLS_SUPPORT AND WITH_TLS_OPENSSL) @@ -188,7 +192,7 @@ endforeach () if (WITH_TLS_SUPPORT AND WITH_TLS_OPENSSL) target_link_libraries(${SEABOLT_SHARED} - PUBLIC + PRIVATE ${OPENSSL_SHARED_LIBRARIES}) target_link_libraries(${SEABOLT_STATIC} @@ -200,19 +204,13 @@ if (WITH_TLS_SUPPORT AND WITH_TLS_OPENSSL) pkg_check_modules(OPENSSLDEPS openssl) target_link_libraries(${SEABOLT_SHARED} - PUBLIC + PRIVATE ${OPENSSLDEPS_LIBRARIES}) target_link_libraries(${SEABOLT_STATIC} PUBLIC ${OPENSSLDEPS_STATIC_LIBRARIES}) endif () - - if (MSVC) - target_link_libraries(${SEABOLT_STATIC} - PUBLIC - legacy_stdio_definitions) - endif () endif () if (CMAKE_C_COMPILER_ID MATCHES AppleClang) diff --git a/src/seabolt/src/bolt/string-builder.c b/src/seabolt/src/bolt/string-builder.c index 3bcc4c29..c71b189e 100644 --- a/src/seabolt/src/bolt/string-builder.c +++ b/src/seabolt/src/bolt/string-builder.c @@ -79,10 +79,16 @@ void StringBuilder_append_f(struct StringBuilder* builder, const char* format, . va_start(args, format); written = vsnprintf(message_fmt, size, format, args); va_end(args); - if (written