diff --git a/.evergreen/config_generator/etc/distros.py b/.evergreen/config_generator/etc/distros.py index aa721eba67..d4305bd7a9 100644 --- a/.evergreen/config_generator/etc/distros.py +++ b/.evergreen/config_generator/etc/distros.py @@ -221,6 +221,12 @@ def compiler_to_vars(compiler): 'CMAKE_GENERATOR_PLATFORM': to_platform(vs), } + case _, ['mingw', *rest]: + return { + 'CC': '-'.join(['gcc'] + rest), + 'CXX': '-'.join(['g++'] + rest), + } + case compiler, _: return { 'CC': compiler, diff --git a/.evergreen/generated_configs/legacy-config.yml b/.evergreen/generated_configs/legacy-config.yml index 81be961752..d9eb5ee5aa 100644 --- a/.evergreen/generated_configs/legacy-config.yml +++ b/.evergreen/generated_configs/legacy-config.yml @@ -804,6 +804,7 @@ tasks: type: test params: working_dir: mongoc + redirect_standard_error_to_output: true include_expansions_in_env: - distro_id shell: bash @@ -811,9 +812,9 @@ tasks: set -o errexit . .evergreen/scripts/find-cmake-latest.sh export CMAKE="$(find_cmake_latest)" - export CC="C:/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin/gcc.exe" - BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd - cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd + CMAKE="$(cygpath -aw "$CMAKE")" + BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-mingw.cmd + cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-mingw.cmd - name: install-uninstall-check-msvc commands: - func: find-cmake-latest @@ -821,6 +822,7 @@ tasks: type: test params: working_dir: mongoc + redirect_standard_error_to_output: true include_expansions_in_env: - distro_id shell: bash @@ -828,9 +830,9 @@ tasks: set -o errexit . .evergreen/scripts/find-cmake-latest.sh export CMAKE="$(find_cmake_latest)" - export CC="Visual Studio 14 2015 Win64" - BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd - cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd + CMAKE="$(cygpath -aw "$CMAKE")" + BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-msvc.cmd + cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-msvc.cmd - name: install-uninstall-check commands: - func: find-cmake-latest diff --git a/.evergreen/generated_configs/tasks.yml b/.evergreen/generated_configs/tasks.yml index 473d05b367..481bec9a0c 100644 --- a/.evergreen/generated_configs/tasks.yml +++ b/.evergreen/generated_configs/tasks.yml @@ -5181,8 +5181,8 @@ tasks: - func: find-cmake-latest - func: sasl-sspi-winssl-compile vars: - CC: mingw - CXX: mingw + CC: gcc + CXX: g++ - func: upload-build - name: sasl-sspi-winssl-windows-2019-mingw-test-8.0-server-auth run_on: windows-vsCurrent-small @@ -5195,8 +5195,8 @@ tasks: - command: expansions.update params: updates: - - { key: CC, value: mingw } - - { key: CXX, value: mingw } + - { key: CC, value: gcc } + - { key: CXX, value: g++ } - { key: AUTH, value: auth } - { key: MONGODB_VERSION, value: "8.0" } - { key: TOPOLOGY, value: server } @@ -5216,8 +5216,8 @@ tasks: - command: expansions.update params: updates: - - { key: CC, value: mingw } - - { key: CXX, value: mingw } + - { key: CC, value: gcc } + - { key: CXX, value: g++ } - { key: AUTH, value: auth } - { key: MONGODB_VERSION, value: latest } - { key: TOPOLOGY, value: server } diff --git a/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py b/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py index fc6420fff7..a34a5ed197 100644 --- a/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py +++ b/.evergreen/legacy_config_generator/evergreen_config_lib/tasks.py @@ -287,10 +287,11 @@ def __init__( r""" . .evergreen/scripts/find-cmake-latest.sh export CMAKE="$(find_cmake_latest)" - export CC="C:/mingw-w64/x86_64-4.9.1-posix-seh-rt_v3-rev1/mingw64/bin/gcc.exe" - BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd - cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd""", + CMAKE="$(cygpath -aw "$CMAKE")" + BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-mingw.cmd + cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-mingw.cmd""", include_expansions_in_env=["distro_id"], + redirect_standard_error_to_output=True, ) ], ), @@ -302,10 +303,11 @@ def __init__( r""" . .evergreen/scripts/find-cmake-latest.sh export CMAKE="$(find_cmake_latest)" - export CC="Visual Studio 14 2015 Win64" - BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd - cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-windows.cmd""", + CMAKE="$(cygpath -aw "$CMAKE")" + BSON_ONLY=1 cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-msvc.cmd + cmd.exe /c .\\.evergreen\\scripts\\install-uninstall-check-msvc.cmd""", include_expansions_in_env=["distro_id"], + redirect_standard_error_to_output=True, ) ], ), diff --git a/.evergreen/scripts/compile-windows.sh b/.evergreen/scripts/compile-windows.sh index d30a7e56d2..179ba3d328 100755 --- a/.evergreen/scripts/compile-windows.sh +++ b/.evergreen/scripts/compile-windows.sh @@ -56,7 +56,6 @@ IFS=' ' read -ra extra_configure_flags <<<"${EXTRA_CONFIGURE_FLAGS:-}" configure_flags_append "-DCMAKE_INSTALL_PREFIX=$(native-path "${install_dir}")" configure_flags_append "-DCMAKE_PREFIX_PATH=$(native-path "${install_dir}")" -configure_flags_append "-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF" configure_flags_append "-DENABLE_MAINTAINER_FLAGS=ON" configure_flags_append_if_not_null C_STD_VERSION "-DCMAKE_C_STANDARD=${C_STD_VERSION:-}" @@ -98,17 +97,15 @@ CMAKE_BUILD_PARALLEL_LEVEL="$(nproc)" declare build_dir build_dir="cmake-build" -if [[ "${CC}" =~ mingw ]]; then +if [[ "${CC}" =~ 'gcc' ]]; then # MinGW has trouble compiling src/cpp-check.cpp without some assistance. configure_flags_append "-DCMAKE_CXX_STANDARD=11" env \ - "CC=gcc" \ - "CXX=g++" \ "${cmake_binary:?}" \ -S . \ -B "${build_dir:?}" \ - -G "MinGW Makefiles" \ + -G "Ninja" \ "${configure_flags[@]}" \ "${extra_configure_flags[@]}" diff --git a/.evergreen/scripts/install-uninstall-check-mingw.cmd b/.evergreen/scripts/install-uninstall-check-mingw.cmd new file mode 100755 index 0000000000..cd85804b75 --- /dev/null +++ b/.evergreen/scripts/install-uninstall-check-mingw.cmd @@ -0,0 +1,180 @@ +REM Supported/used environment variables: +REM BSON_ONLY Whether to build only the BSON library. + +rem Ensure Cygwin executables like sh.exe are not in PATH +rem set PATH=C:\Windows\system32;C:\Windows + +echo on +echo + +set SRCROOT=%CD% +set TAR=C:\cygwin\bin\tar + +set version=1.31.0 +set major=1 + +if "%BSON_ONLY%"=="1" ( + set BUILD_DIR=%CD%\build-dir-bson + set INSTALL_DIR=%CD%\install-dir-bson +) else ( + set BUILD_DIR=%CD%\build-dir-mongoc + set INSTALL_DIR=%CD%\install-dir-mongoc +) +rmdir /S /Q %BUILD_DIR% 2>nul || true +mkdir %BUILD_DIR% || goto :error + +rmdir /S /Q %INSTALL_DIR% 2>nul || true +mkdir %INSTALL_DIR% || goto :error + +set PATH=%PATH%;%INSTALL_DIR%\bin + +cd %BUILD_DIR% || goto :error + +if "%BSON_ONLY%"=="1" ( + set BSON_ONLY_OPTION=-DENABLE_MONGOC=OFF +) else ( + set BSON_ONLY_OPTION=-DENABLE_MONGOC=ON +) + +rem Build libmongoc, with flags that the downstream R driver mongolite uses +%CMAKE% -G "Ninja" -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake %BSON_ONLY_OPTION% .. || goto :error +%CMAKE% --build . || goto :error +%CMAKE% --build . --target install || goto :error + +REM no kms-message components should be installed +if exist %INSTALL_DIR%\include\kms_message\kms_message.h ( + echo kms_message.h found! + goto :error +) else ( + echo kms_message.h check ok +) +if exist %INSTALL_DIR%\lib\libkms_message-static.a ( + echo libkms_message-static.a found! + goto :error +) else ( + echo libkms_message-static.a check ok +) +if exist %INSTALL_DIR%\lib\cmake\kms_message\kms_message-config.cmake ( + echo kms_message-config.cmake found! + goto :error +) else ( + echo kms_message-config.cmake check ok +) + +echo > %INSTALL_DIR%\lib\canary.txt || goto :error + +dir %INSTALL_DIR%\share\mongo-c-driver || goto :error + +rem CDRIVER-6062: uninstall script may return non-zero exit code despite success. +%CMAKE% --build . --target uninstall || true + +if exist %INSTALL_DIR%\lib\pkgconfig\bson%major%.pc ( + echo bson%major%.pc found! + goto :error +) else ( + echo bson%major%.pc check ok +) +if not exist %INSTALL_DIR%\lib\canary.txt ( + echo canary.txt not found! + goto :error +) else ( + echo canary.txt check ok +) +if not exist %INSTALL_DIR%\lib ( + echo %INSTALL_DIR%\lib not found! + goto :error +) else ( + echo %INSTALL_DIR%\lib check ok +) +if "%BSON_ONLY%" NEQ "1" ( + if exist %INSTALL_DIR%\lib\pkgconfig\mongoc%major%.pc ( + echo mongoc%major%.pc found! + goto :error + ) else ( + echo mongoc%major%.pc check ok + ) + if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-1.0-config.cmake ( + echo mongoc-1.0-config.cmake found! + goto :error + ) else ( + echo mongoc-1.0-config.cmake check ok + ) + if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-1.0-config-version.cmake ( + echo mongoc-1.0-config-version.cmake found! + goto :error + ) else ( + echo mongoc-1.0-config-version.cmake check ok + ) + if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-targets.cmake ( + echo mongoc-targets.cmake found! + goto :error + ) else ( + echo mongoc-targets.cmake check ok + ) +) +if exist %INSTALL_DIR%\include\bson-%version%\bson\bson.h ( + echo bson\bson.h found! + goto :error +) else ( + echo bson\bson.h check ok +) +if exist %INSTALL_DIR%\include\bson-%version% ( + echo %INSTALL_DIR%\include\bson-%version% found! + goto :error +) else ( + echo %INSTALL_DIR%\include\bson-%version% check ok +) +if "%BSON_ONLY%" NEQ "1" ( + if exist %INSTALL_DIR%\include\libmongoc-1.0\mongoc\mongoc.h ( + echo mongoc\mongoc.h found! + goto :error + ) else ( + echo mongoc\mongoc.h check ok + ) + if exist %INSTALL_DIR%\include\libmongoc-1.0\mongoc.h ( + echo mongoc.h found! + goto :error + ) else ( + echo mongoc.h check ok + ) + if exist %INSTALL_DIR%\include\libmongoc-1.0 ( + echo %INSTALL_DIR%\include\libmongoc-1.0 found! + goto :error + ) else ( + echo %INSTALL_DIR%\include\libmongoc-1.0 check ok + ) +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall-bson.cmd ( + echo uninstall-bson.cmd found! + goto :error +) else ( + echo uninstall-bson.cmd check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall.cmd ( + echo uninstall.cmd found! + goto :error +) else ( + echo uninstall.cmd check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall-bson.sh ( + echo uninstall-bson.sh found! + goto :error +) else ( + echo uninstall-bson.sh check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall.sh ( + echo uninstall.sh found! + goto :error +) else ( + echo uninstall.sh check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver ( + echo %INSTALL_DIR%\share\mongo-c-driver found! + goto :error +) else ( + echo %INSTALL_DIR%\share\mongo-c-driver check ok +) + +goto :EOF +:error +exit /B %errorlevel% diff --git a/.evergreen/scripts/install-uninstall-check-msvc.cmd b/.evergreen/scripts/install-uninstall-check-msvc.cmd new file mode 100755 index 0000000000..00da95af22 --- /dev/null +++ b/.evergreen/scripts/install-uninstall-check-msvc.cmd @@ -0,0 +1,183 @@ +REM Supported/used environment variables: +REM BSON_ONLY Whether to build only the BSON library. + +rem Ensure Cygwin executables like sh.exe are not in PATH +rem set PATH=C:\Windows\system32;C:\Windows + +rem Load environment for Visual Studio 15 2017. +rem https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-150 +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" || goto :error + +echo on +echo + +set SRCROOT=%CD% +set TAR=C:\cygwin\bin\tar + +set version=1.31.0 +set major=1 + +if "%BSON_ONLY%"=="1" ( + set BUILD_DIR=%CD%\build-dir-bson + set INSTALL_DIR=%CD%\install-dir-bson +) else ( + set BUILD_DIR=%CD%\build-dir-mongoc + set INSTALL_DIR=%CD%\install-dir-mongoc +) +rmdir /S /Q %BUILD_DIR% 2>nul || true +mkdir %BUILD_DIR% || goto :error + +rmdir /S /Q %INSTALL_DIR% 2>nul || true +mkdir %INSTALL_DIR% || goto :error + +set PATH=%PATH%;%INSTALL_DIR%\bin + +cd %BUILD_DIR% || goto :error + +if "%BSON_ONLY%"=="1" ( + set BSON_ONLY_OPTION=-DENABLE_MONGOC=OFF +) else ( + set BSON_ONLY_OPTION=-DENABLE_MONGOC=ON +) + +%CMAKE% -G "Visual Studio 15 2017" -A x64 "-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%" %BSON_ONLY_OPTION% .. || goto :error +%CMAKE% --build . --config Debug || goto :error +%CMAKE% --build . --config Debug --target install || goto :error + +echo > %INSTALL_DIR%\lib\canary.txt || goto :error + +REM no kms-message components should be installed +if exist %INSTALL_DIR%\include\kms_message\kms_message.h ( + echo kms_message.h found! + goto :error +) else ( + echo kms_message.h check ok +) +if exist %INSTALL_DIR%\lib\libkms_message-static.a ( + echo libkms_message-static.a found! + goto :error +) else ( + echo libkms_message-static.a check ok +) +if exist %INSTALL_DIR%\lib\cmake\kms_message\kms_message-config.cmake ( + echo kms_message-config.cmake found! + goto :error +) else ( + echo kms_message-config.cmake check ok +) + +dir %INSTALL_DIR%\share\mongo-c-driver || goto :error + +rem CDRIVER-6062: uninstall script may return non-zero exit code despite success. +%CMAKE% --build . --config Debug --target uninstall || true + +if exist %INSTALL_DIR%\lib\pkgconfig\bson%major%.pc ( + echo bson%major%.pc found! + goto :error +) else ( + echo bson%major%.pc check ok +) +if not exist %INSTALL_DIR%\lib\canary.txt ( + echo canary.txt not found! + goto :error +) else ( + echo canary.txt check ok +) +if not exist %INSTALL_DIR%\lib ( + echo %INSTALL_DIR%\lib not found! + goto :error +) else ( + echo %INSTALL_DIR%\lib check ok +) +if "%BSON_ONLY%" NEQ "1" ( + if exist %INSTALL_DIR%\lib\pkgconfig\mongoc%major%.pc ( + echo mongoc%major%.pc found! + goto :error + ) else ( + echo mongoc%major%.pc check ok + ) + if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-1.0-config.cmake ( + echo mongoc-1.0-config.cmake found! + goto :error + ) else ( + echo mongoc-1.0-config.cmake check ok + ) + if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-1.0-config-version.cmake ( + echo mongoc-1.0-config-version.cmake found! + goto :error + ) else ( + echo mongoc-1.0-config-version.cmake check ok + ) + if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-targets.cmake ( + echo mongoc-targets.cmake found! + goto :error + ) else ( + echo mongoc-targets.cmake check ok + ) +) +if exist %INSTALL_DIR%\include\bson-%version%\bson\bson.h ( + echo bson\bson.h found! + goto :error +) else ( + echo bson\bson.h check ok +) +if exist %INSTALL_DIR%\include\bson-%version% ( + echo %INSTALL_DIR%\include\bson-%version% found! + goto :error +) else ( + echo %INSTALL_DIR%\include\bson-%version% check ok +) +if "%BSON_ONLY%" NEQ "1" ( + if exist %INSTALL_DIR%\include\libmongoc-1.0\mongoc\mongoc.h ( + echo mongoc\mongoc.h found! + goto :error + ) else ( + echo mongoc\mongoc.h check ok + ) + if exist %INSTALL_DIR%\include\libmongoc-1.0\mongoc.h ( + echo mongoc.h found! + goto :error + ) else ( + echo mongoc.h check ok + ) + if exist %INSTALL_DIR%\include\libmongoc-1.0 ( + echo %INSTALL_DIR%\include\libmongoc-1.0 found! + goto :error + ) else ( + echo %INSTALL_DIR%\include\libmongoc-1.0 check ok + ) +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall-bson.cmd ( + echo uninstall-bson.cmd found! + goto :error +) else ( + echo uninstall-bson.cmd check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall.cmd ( + echo uninstall.cmd found! + goto :error +) else ( + echo uninstall.cmd check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall-bson.sh ( + echo uninstall-bson.sh found! + goto :error +) else ( + echo uninstall-bson.sh check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall.sh ( + echo uninstall.sh found! + goto :error +) else ( + echo uninstall.sh check ok +) +if exist %INSTALL_DIR%\share\mongo-c-driver ( + echo %INSTALL_DIR%\share\mongo-c-driver found! + goto :error +) else ( + echo %INSTALL_DIR%\share\mongo-c-driver check ok +) + +goto :EOF +:error +exit /B %errorlevel% diff --git a/.evergreen/scripts/install-uninstall-check-windows.cmd b/.evergreen/scripts/install-uninstall-check-windows.cmd deleted file mode 100644 index 6687a2d017..0000000000 --- a/.evergreen/scripts/install-uninstall-check-windows.cmd +++ /dev/null @@ -1,231 +0,0 @@ -REM Supported/used environment variables: -REM CC Compiler, "mingw" or "Visual Studio 14 2015 Win64". -REM BSON_ONLY Whether to build only the BSON library. - -rem Ensure Cygwin executables like sh.exe are not in PATH -rem set PATH=C:\Windows\system32;C:\Windows - -echo on -echo - -set SRCROOT=%CD% -set TAR=C:\cygwin\bin\tar -set CMAKE=C:\cmake\bin\cmake -set CMAKE_MAKE_PROGRAM=C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin\mingw32-make.exe -rem Ensure Cygwin executables like sh.exe are not in PATH -set PATH=C:\cygwin\bin;C:\Windows\system32;C:\Windows;C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin;C:\mongoc;src\libbson;src\libmongoc - -set version=1.31.0 -set major=1 - -if "%BSON_ONLY%"=="1" ( - set BUILD_DIR=%CD%\build-dir-bson - set INSTALL_DIR=%CD%\install-dir-bson -) else ( - set BUILD_DIR=%CD%\build-dir-mongoc - set INSTALL_DIR=%CD%\install-dir-mongoc -) -rmdir /S /Q %BUILD_DIR% -mkdir %BUILD_DIR% - -rmdir /S /Q %INSTALL_DIR% -mkdir %INSTALL_DIR% - -set PATH=%PATH%;%INSTALL_DIR%\bin - -cd %BUILD_DIR% -robocopy "%SRCROOT%" "%BUILD_DIR%" /E /XD ".git" "%BUILD_DIR%" "_build" "cmake-build" /NP /NFL /NDL - -if "%BSON_ONLY%"=="1" ( - set BSON_ONLY_OPTION=-DENABLE_MONGOC=OFF -) else ( - set BSON_ONLY_OPTION=-DENABLE_MONGOC=ON -) - -echo.%CC%| findstr /I "gcc">Nul && ( - rem Build libmongoc, with flags that the downstream R driver mongolite uses - %CMAKE% -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=%CMAKE_MAKE_PROGRAM% -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake %BSON_ONLY_OPTION% . - %CMAKE% --build . - if errorlevel 1 ( - exit /B 1 - ) - %CMAKE% --build . --target install - if errorlevel 1 ( - exit /B 1 - ) - - REM no kms-message components should be installed - if exist %INSTALL_DIR%\include\kms_message\kms_message.h ( - echo kms_message.h found! - exit /B 1 - ) else ( - echo kms_message.h check ok - ) - if exist %INSTALL_DIR%\lib\libkms_message-static.a ( - echo libkms_message-static.a found! - exit /B 1 - ) else ( - echo libkms_message-static.a check ok - ) - if exist %INSTALL_DIR%\lib\cmake\kms_message\kms_message-config.cmake ( - echo kms_message-config.cmake found! - exit /B 1 - ) else ( - echo kms_message-config.cmake check ok - ) - - echo > %INSTALL_DIR%\lib\canary.txt - - dir %INSTALL_DIR%\share\mongo-c-driver - - %CMAKE% --build . --target uninstall - if errorlevel 1 ( - exit /B 1 - ) -) || ( - %CMAKE% -G "%CC%" "-DCMAKE_INSTALL_PREFIX=%INSTALL_DIR%" "-DCMAKE_BUILD_TYPE=Debug" %BSON_ONLY_OPTION% . - %CMAKE% --build . --config Debug - if errorlevel 1 ( - exit /B 1 - ) - %CMAKE% --build . --config Debug --target install - if errorlevel 1 ( - exit /B 1 - ) - - echo > %INSTALL_DIR%\lib\canary.txt - - REM no kms-message components should be installed - if exist %INSTALL_DIR%\include\kms_message\kms_message.h ( - echo kms_message.h found! - exit /B 1 - ) else ( - echo kms_message.h check ok - ) - if exist %INSTALL_DIR%\lib\libkms_message-static.a ( - echo libkms_message-static.a found! - exit /B 1 - ) else ( - echo libkms_message-static.a check ok - ) - if exist %INSTALL_DIR%\lib\cmake\kms_message\kms_message-config.cmake ( - echo kms_message-config.cmake found! - exit /B 1 - ) else ( - echo kms_message-config.cmake check ok - ) - - dir %INSTALL_DIR%\share\mongo-c-driver - - %CMAKE% --build . --target uninstall - if errorlevel 1 ( - exit /B 1 - ) -) - -if exist %INSTALL_DIR%\lib\pkgconfig\bson%major%.pc ( - echo bson%major%.pc found! - exit /B 1 -) else ( - echo bson%major%.pc check ok -) -if not exist %INSTALL_DIR%\lib\canary.txt ( - echo canary.txt not found! - exit /B 1 -) else ( - echo canary.txt check ok -) -if not exist %INSTALL_DIR%\lib ( - echo %INSTALL_DIR%\lib not found! - exit /B 1 -) else ( - echo %INSTALL_DIR%\lib check ok -) -if "%BSON_ONLY%" NEQ "1" ( - if exist %INSTALL_DIR%\lib\pkgconfig\mongoc%major%.pc ( - echo mongoc%major%.pc found! - exit /B 1 - ) else ( - echo mongoc%major%.pc check ok - ) - if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-1.0-config.cmake ( - echo mongoc-1.0-config.cmake found! - exit /B 1 - ) else ( - echo mongoc-1.0-config.cmake check ok - ) - if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-1.0-config-version.cmake ( - echo mongoc-1.0-config-version.cmake found! - exit /B 1 - ) else ( - echo mongoc-1.0-config-version.cmake check ok - ) - if exist %INSTALL_DIR%\lib\cmake\mongoc-1.0\mongoc-targets.cmake ( - echo mongoc-targets.cmake found! - exit /B 1 - ) else ( - echo mongoc-targets.cmake check ok - ) -) -if exist %INSTALL_DIR%\include\bson-%version%\bson\bson.h ( - echo bson\bson.h found! - exit /B 1 -) else ( - echo bson\bson.h check ok -) -if exist %INSTALL_DIR%\include\bson-%version% ( - echo $INSTALL_DIR\include\bson-%version% found! - exit /B 1 -) else ( - echo $INSTALL_DIR\include\bson-%version% check ok -) -if "%BSON_ONLY%" NEQ "1" ( - if exist %INSTALL_DIR%\include\libmongoc-1.0\mongoc\mongoc.h ( - echo mongoc\mongoc.h found! - exit /B 1 - ) else ( - echo mongoc\mongoc.h check ok - ) - if exist %INSTALL_DIR%\include\libmongoc-1.0\mongoc.h ( - echo mongoc.h found! - exit /B 1 - ) else ( - echo mongoc.h check ok - ) - if exist %INSTALL_DIR%\include\libmongoc-1.0 ( - echo $INSTALL_DIR\include\libmongoc-1.0 found! - exit /B 1 - ) else ( - echo $INSTALL_DIR\include\libmongoc-1.0 check ok - ) -) -if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall-bson.cmd ( - echo uninstall-bson.cmd found! - exit /B 1 -) else ( - echo uninstall-bson.cmd check ok -) -if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall.cmd ( - echo uninstall.cmd found! - exit /B 1 -) else ( - echo uninstall.cmd check ok -) -if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall-bson.sh ( - echo uninstall-bson.sh found! - exit /B 1 -) else ( - echo uninstall-bson.sh check ok -) -if exist %INSTALL_DIR%\share\mongo-c-driver\uninstall.sh ( - echo uninstall.sh found! - exit /B 1 -) else ( - echo uninstall.sh check ok -) -if exist %INSTALL_DIR%\share\mongo-c-driver ( - echo $INSTALL_DIR\share\mongo-c-driver found! - exit /B 1 -) else ( - echo $INSTALL_DIR\share\mongo-c-driver check ok -) diff --git a/.evergreen/scripts/link-sample-program-mingw-bson.cmd b/.evergreen/scripts/link-sample-program-mingw-bson.cmd old mode 100644 new mode 100755 index d8a6926889..b329ee1394 --- a/.evergreen/scripts/link-sample-program-mingw-bson.cmd +++ b/.evergreen/scripts/link-sample-program-mingw-bson.cmd @@ -1,45 +1,37 @@ +rem Load environment for Visual Studio 15 2017. +rem https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-150 +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" || goto :error + echo on echo set TAR=C:\cygwin\bin\tar -set CMAKE_MAKE_PROGRAM=C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin\mingw32-make.exe -set CC=C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin\gcc.exe -rem Ensure Cygwin executables like sh.exe are not in PATH -set "PATH=C:\cygwin\bin;C:\Windows\system32;C:\Windows;C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin;C:\mongoc;src\libbson;src\libmongoc;C:\Program Files\Git\cmd" set LINK_STATIC=1 set SRCROOT=%CD% set BUILD_DIR=%CD%\build-dir -rmdir /S /Q %BUILD_DIR% -mkdir %BUILD_DIR% +rmdir /S /Q %BUILD_DIR% 2>nul || true +mkdir %BUILD_DIR% || goto :error set INSTALL_DIR=%CD%\install-dir -rmdir /S /Q %INSTALL_DIR% -mkdir %INSTALL_DIR% +rmdir /S /Q %INSTALL_DIR% 2>nul || true +mkdir %INSTALL_DIR% || goto :error set PATH=%PATH%;%INSTALL_DIR%\bin set major=1 set version=1.31.0 -cd %BUILD_DIR% -robocopy "%SRCROOT%" "%BUILD_DIR%" /E /XD ".git" "%BUILD_DIR%" "_build" "cmake-build" /NP /NFL /NDL +cd %BUILD_DIR% || goto :error rem Build libmongoc, with flags that the downstream R driver mongolite uses -%CMAKE% -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=%CMAKE_MAKE_PROGRAM% -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_CFLAGS="-pedantic" -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DENABLE_STATIC=ON . -%CMAKE% --build . --parallel -if errorlevel 1 ( - exit /B 1 -) - -%CMAKE% --build . --target install -if errorlevel 1 ( - exit /B 1 -) +%CMAKE% -G "Ninja" DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_C_FLAGS="-pedantic" -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DENABLE_STATIC=ON .. || goto :error +%CMAKE% --build . --parallel || goto :error +%CMAKE% --build . --target install || goto :error rem Test our pkg-config file set EXAMPLE_DIR=%SRCROOT%\src\libbson\examples\ -cd %EXAMPLE_DIR% +cd %EXAMPLE_DIR% || goto :error rem Proceed from here once we have pkg-config on Windows exit /B 0 @@ -51,13 +43,15 @@ for /f %%i in ('pkg-config --libs --cflags bson%major%') do set PKG_CONFIG_OUT=% echo PKG_CONFIG_OUT is %PKG_CONFIG_OUT% -%CC% -o hello_bson hello_bson.c %PKG_CONFIG_OUT% +%CC% -o hello_bson hello_bson.c %PKG_CONFIG_OUT% || goto :error -rem Works on windows-64-vs2013-compile, VS 2013 is a.k.a. "Visual Studio 12" -rem And yes, they should've named the flag "dependencies". -"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\dumpbin.exe" /dependents Debug\hello_bson.exe +dumpbin.exe /dependents Debug\hello_bson.exe || goto :error rem Add DLLs to PATH set PATH=%PATH%;%INSTALL_DIR%\bin -Debug\hello_bson.exe %MONGODB_EXAMPLE_URI% +Debug\hello_bson.exe %MONGODB_EXAMPLE_URI% || goto :error + +goto :EOF +:error +exit /B %errorlevel% diff --git a/.evergreen/scripts/link-sample-program-mingw.cmd b/.evergreen/scripts/link-sample-program-mingw.cmd old mode 100644 new mode 100755 index 96031ea7d8..401280151c --- a/.evergreen/scripts/link-sample-program-mingw.cmd +++ b/.evergreen/scripts/link-sample-program-mingw.cmd @@ -1,45 +1,37 @@ +rem Load environment for Visual Studio 15 2017. +rem https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-150 +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" || goto :error + echo on echo rem Use DENABLE_SSL=OFF. Windows hosts do not have a MinGW ABI compatible OpenSSL install. set CMAKE_FLAGS=-DENABLE_SSL=OFF -DENABLE_SASL=CYRUS set TAR=C:\cygwin\bin\tar -set CMAKE_MAKE_PROGRAM=C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin\mingw32-make.exe -set CC=C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin\gcc.exe -rem Ensure Cygwin executables like sh.exe are not in PATH -set "PATH=C:\cygwin\bin;C:\Windows\system32;C:\Windows;C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin;C:\mongoc;src\libbson;src\libmongoc;C:\Program Files\Git\cmd" set SRCROOT=%CD% set BUILD_DIR=%CD%\build-dir -rmdir /S /Q %BUILD_DIR% -mkdir %BUILD_DIR% +rmdir /S /Q %BUILD_DIR% 2>nul || true +mkdir %BUILD_DIR% || goto :error set INSTALL_DIR=%CD%\install-dir -rmdir /S /Q %INSTALL_DIR% -mkdir %INSTALL_DIR% +rmdir /S /Q %INSTALL_DIR% 2>nul || true +mkdir %INSTALL_DIR% || goto :error set PATH=%PATH%;%INSTALL_DIR%\bin set major=1 -cd %BUILD_DIR% -robocopy "%SRCROOT%" "%BUILD_DIR%" /E /XD ".git" "%BUILD_DIR%" "_build" "cmake-build" /NP /NFL /NDL +cd %BUILD_DIR% || goto :error rem Build libmongoc, with flags that the downstream R driver mongolite uses -%CMAKE% -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=%CMAKE_MAKE_PROGRAM% -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_CFLAGS="-pedantic" -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake %CMAKE_FLAGS% . -%CMAKE% --build . --parallel -if errorlevel 1 ( - exit /B 1 -) - -%CMAKE% --build . --target install -if errorlevel 1 ( - exit /B 1 -) +%CMAKE% -G "Ninja" -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DCMAKE_C_FLAGS="-pedantic" -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake %CMAKE_FLAGS% .. || goto :error +%CMAKE% --build . --parallel || goto :error +%CMAKE% --build . --target install || goto :error rem Test our pkg-config file set EXAMPLE_DIR=%SRCROOT%\src\libmongoc\examples\ -cd %EXAMPLE_DIR% +cd %EXAMPLE_DIR% || goto :error rem Proceed from here once we have pkg-config on Windows exit /B 0 @@ -51,13 +43,15 @@ for /f %%i in ('pkg-config --libs --cflags mongoc%major%') do set PKG_CONFIG_OUT echo PKG_CONFIG_OUT is %PKG_CONFIG_OUT% -%CC% -o hello_mongoc hello_mongoc.c %PKG_CONFIG_OUT% +%CC% -o hello_mongoc hello_mongoc.c %PKG_CONFIG_OUT% || goto :error -rem Works on windows-64-vs2013-compile, VS 2013 is a.k.a. "Visual Studio 12" -rem And yes, they should've named the flag "dependencies". -"c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\dumpbin.exe" /dependents Debug\hello_mongoc.exe +dumpbin.exe /dependents Debug\hello_mongoc.exe || goto :error rem Add DLLs to PATH set PATH=%PATH%;%INSTALL_DIR%\bin -Debug\hello_mongoc.exe %MONGODB_EXAMPLE_URI% +Debug\hello_mongoc.exe %MONGODB_EXAMPLE_URI% || goto :error + +goto :EOF +:error +exit /B %errorlevel% diff --git a/.evergreen/scripts/link-sample-program-msvc-bson.cmd b/.evergreen/scripts/link-sample-program-msvc-bson.cmd old mode 100644 new mode 100755 index 6ecbc2883d..b7e3eab149 --- a/.evergreen/scripts/link-sample-program-msvc-bson.cmd +++ b/.evergreen/scripts/link-sample-program-msvc-bson.cmd @@ -4,6 +4,10 @@ REM LINK_STATIC Whether to statically link to libbson rem Ensure Cygwin executables like sh.exe are not in PATH rem set PATH=C:\Windows\system32;C:\Windows +rem Load environment for Visual Studio 15 2017. +rem https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-150 +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" || goto :error + echo on echo @@ -11,28 +15,25 @@ set TAR=C:\cygwin\bin\tar set SRCROOT=%CD% set BUILD_DIR=%CD%\build-dir -rmdir /S /Q %BUILD_DIR% -mkdir %BUILD_DIR% +rmdir /S /Q %BUILD_DIR% 2>nul || true +mkdir %BUILD_DIR% || goto :error set INSTALL_DIR=%CD%\install-dir -rmdir /S /Q %INSTALL_DIR% -mkdir %INSTALL_DIR% +rmdir /S /Q %INSTALL_DIR% 2>nul || true +mkdir %INSTALL_DIR% || goto :error set PATH=%PATH%;%INSTALL_DIR%\bin -rem Set path to dumpbin.exe and other VS tools. -call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" -cd %BUILD_DIR% -robocopy "%SRCROOT%" "%BUILD_DIR%" /E /XD ".git" "%BUILD_DIR%" "_build" "cmake-build" /NP /NFL /NDL +cd %BUILD_DIR% || goto :error if "%LINK_STATIC%"=="1" ( - %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_TESTS=OFF . + %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_TESTS=OFF .. || goto :error ) else ( - %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_TESTS=OFF -DENABLE_STATIC=OFF . + %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_TESTS=OFF -DENABLE_STATIC=OFF .. || goto :error ) -%CMAKE% --build . --target ALL_BUILD --config "Debug" -- /m -%CMAKE% --build . --target INSTALL --config "Debug" -- /m +%CMAKE% --build . --config "Debug" --target ALL_BUILD -- /m || goto :error +%CMAKE% --build . --config "Debug" --target INSTALL -- /m || goto :error rem Test our CMake package config file with CMake's find_package command. set EXAMPLE_DIR=%SRCROOT%\src\libbson\examples\cmake\find_package @@ -41,11 +42,15 @@ if "%LINK_STATIC%"=="1" ( set EXAMPLE_DIR="%EXAMPLE_DIR%_static" ) -cd %EXAMPLE_DIR% -%CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake . -%CMAKE% --build . --target ALL_BUILD --config "Debug" -- /m +cd %EXAMPLE_DIR% || goto :error +%CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake . || goto :error +%CMAKE% --build . --config "Debug" --target ALL_BUILD -- /m || goto :error rem Yes, they should've named it "dependencies". -dumpbin.exe /dependents Debug\hello_bson.exe +dumpbin.exe /dependents Debug\hello_bson.exe || goto :error + +Debug\hello_bson.exe || goto :error -Debug\hello_bson.exe +goto :EOF +:error +exit /B %errorlevel% diff --git a/.evergreen/scripts/link-sample-program-msvc.cmd b/.evergreen/scripts/link-sample-program-msvc.cmd old mode 100644 new mode 100755 index 351649c5ca..a6a73efd76 --- a/.evergreen/scripts/link-sample-program-msvc.cmd +++ b/.evergreen/scripts/link-sample-program-msvc.cmd @@ -6,6 +6,10 @@ REM ENABLE_SNAPPY Enable Snappy compression rem Ensure Cygwin executables like sh.exe are not in PATH rem set PATH=C:\Windows\system32;C:\Windows +rem Load environment for Visual Studio 15 2017. +rem https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-150 +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvars64.bat" || goto :error + echo on echo @@ -13,44 +17,40 @@ set TAR=C:\cygwin\bin\tar set SRCROOT=%CD% set BUILD_DIR=%CD%\build-dir -rmdir /S /Q %BUILD_DIR% -mkdir %BUILD_DIR% +rmdir /S /Q %BUILD_DIR% 2>nul || true +mkdir %BUILD_DIR% || goto :error set INSTALL_DIR=%CD%\install-dir -rmdir /S /Q %INSTALL_DIR% -mkdir %INSTALL_DIR% +rmdir /S /Q %INSTALL_DIR% 2>nul || true +mkdir %INSTALL_DIR% || goto :error set PATH=%PATH%;%INSTALL_DIR%\bin -rem Set path to dumpbin.exe and other VS tools. -call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat" - -cd %BUILD_DIR% -robocopy "%SRCROOT%" "%BUILD_DIR%" /E /XD ".git" "%BUILD_DIR%" "_build" "cmake-build" /NP /NFL /NDL +cd %BUILD_DIR% || goto :error if "%ENABLE_SNAPPY%"=="1" ( rem Enable Snappy - curl -sS --retry 5 -LO https://github.com/google/snappy/archive/1.1.7.tar.gz - %TAR% xzf 1.1.7.tar.gz - cd snappy-1.1.7 - %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% . - %CMAKE% --build . --target ALL_BUILD --config "Debug" -- /m - %CMAKE% --build . --target INSTALL --config "Debug" -- /m + curl -sS --retry 5 -LO https://github.com/google/snappy/archive/1.1.7.tar.gz || goto :error + %TAR% xzf 1.1.7.tar.gz || goto :error + cd snappy-1.1.7 || goto :error + %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -S snappy-1.1.7 -B snappy-1.1.7-build || goto :error + %CMAKE% --build snappy-1.1.7-build --config "Debug" --target ALL_BUILD -- /m || goto :error + %CMAKE% --build snappy-1.1.7-build --config "Debug" --target INSTALL -- /m || goto :error set SNAPPY_OPTION=-DENABLE_SNAPPY=ON ) else ( set SNAPPY_OPTION=-DENABLE_SNAPPY=OFF ) -cd %BUILD_DIR% +cd %BUILD_DIR% || goto :error rem Build libmongoc if "%ENABLE_SSL%"=="1" ( - %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_SSL=WINDOWS %ENABLE_SNAPPY_OPTION% . + %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_SSL=WINDOWS %ENABLE_SNAPPY_OPTION% .. || goto :error ) else ( - %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_SSL=OFF %ENABLE_SNAPPY_OPTION% . + %CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% -DENABLE_SSL=OFF %ENABLE_SNAPPY_OPTION% .. || goto :error ) -%CMAKE% --build . --target ALL_BUILD --config "Debug" -- /m -%CMAKE% --build . --target INSTALL --config "Debug" -- /m +%CMAKE% --build . --config "Debug" --target ALL_BUILD -- /m || goto :error +%CMAKE% --build . --config "Debug" --target INSTALL -- /m || goto :error rem Test our CMake package config file with CMake's find_package command. set EXAMPLE_DIR=%SRCROOT%\src\libmongoc\examples\cmake\find_package @@ -59,18 +59,22 @@ if "%LINK_STATIC%"=="1" ( set EXAMPLE_DIR="%EXAMPLE_DIR%_static" ) -cd %EXAMPLE_DIR% +cd %EXAMPLE_DIR% || goto :error if "%ENABLE_SSL%"=="1" ( - cp ..\..\..\tests\x509gen\client.pem . - cp ..\..\..\tests\x509gen\ca.pem . + cp ..\..\..\tests\x509gen\client.pem . || goto :error + cp ..\..\..\tests\x509gen\ca.pem . || goto :error set MONGODB_EXAMPLE_URI="mongodb://localhost/?ssl=true&sslclientcertificatekeyfile=client.pem&sslcertificateauthorityfile=ca.pem&sslallowinvalidhostnames=true" ) -%CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake . -%CMAKE% --build . --target ALL_BUILD --config "Debug" -- /m +%CMAKE% -G "Visual Studio 15 2017" -A x64 -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake . || goto :error +%CMAKE% --build . --config "Debug" --target ALL_BUILD -- /m || goto :error rem Yes, they should've named it "dependencies". -dumpbin.exe /dependents Debug\hello_mongoc.exe +dumpbin.exe /dependents Debug\hello_mongoc.exe || goto :error + +Debug\hello_mongoc.exe %MONGODB_EXAMPLE_URI% || goto :error -Debug\hello_mongoc.exe %MONGODB_EXAMPLE_URI% +goto :EOF +:error +exit /B %errorlevel% diff --git a/.evergreen/scripts/run-tests-mingw.bat b/.evergreen/scripts/run-tests-mingw.bat index c4077567fd..ff3acca39a 100644 --- a/.evergreen/scripts/run-tests-mingw.bat +++ b/.evergreen/scripts/run-tests-mingw.bat @@ -1,5 +1,3 @@ -set PATH=C:\Windows\system32;C:\Windows;C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin;C:\mongo-c-driver\bin - rem "make install" would work, except we run tests on different Evergreen hosts, rem in different working directories, than where the driver was built. This rem causes errors in "make install" like: diff --git a/.evergreen/scripts/run-tests.sh b/.evergreen/scripts/run-tests.sh index efc294c2e2..47d00e737b 100755 --- a/.evergreen/scripts/run-tests.sh +++ b/.evergreen/scripts/run-tests.sh @@ -168,7 +168,7 @@ wait_for_server() { return 1 } -if [[ "${CC}" =~ mingw ]]; then +if [[ "${CC}" =~ gcc ]]; then echo "Waiting for simple HTTP server to start..." wait_for_server "simple HTTP" 8000 echo "Waiting for simple HTTP server to start... done." diff --git a/.gitattributes b/.gitattributes index 91d07ef392..0f545b96f4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ tests/binary/* text eol=lf +*.bat text eol=crlf diff --git a/build/cmake/GenerateUninstaller.cmake b/build/cmake/GenerateUninstaller.cmake index fc9d80a36e..5e3e52059e 100644 --- a/build/cmake/GenerateUninstaller.cmake +++ b/build/cmake/GenerateUninstaller.cmake @@ -51,6 +51,13 @@ if(NOT CMAKE_SCRIPT_MODE_FILE) endif() # We get here if running in script mode (e.g. at CMake install-time) +cmake_policy(VERSION 3.15...4.0) + +# Avoid CMake Issue 26678: https://gitlab.kitware.com/cmake/cmake/-/issues/26678 +if("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.27") + cmake_policy(SET CMP0147 OLD) +endif() + if(NOT DEFINED CMAKE_INSTALL_MANIFEST_FILES) message(FATAL_ERROR "This file is only for use with CMake's install(CODE/SCRIPT) command") endif()