Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,22 @@ jobs:
- name: Build
run: cmake --build build

# The zip ships the .exe alone, and this runner has the Redistributable, so only the imports can tell.
- name: Assert the binary needs no Visual C++ Redistributable (Windows)
if: runner.os == 'Windows'
run: |
dumpbin -nologo -dependents build/sendspin-cli.exe >imports.txt
cat imports.txt
if grep -Eiq '^[[:space:]]*(msvcp|vcruntime|concrt)[0-9a-z_]*\.dll' imports.txt; then
echo '::error::sendspin-cli.exe imports a Visual C++ Redistributable DLL, which a clean Windows install does not have'
exit 1
fi
grep -Eiq '^[[:space:]]*kernel32\.dll' imports.txt || {
echo '::error::dumpbin listed no imports at all, so the check above proved nothing'
exit 1
}
rm -f imports.txt

# Read the target architecture off the linked binary, which covers every dependency, before running the suite.
- name: Assert the binary is built for the architecture this leg claims
if: matrix.arm32
Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Static CRT for every target, so the Windows .exe runs without the Visual C++ Redistributable.
if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
Expand Down Expand Up @@ -475,8 +480,6 @@ if(SENDSPIN_CLI_BUILD_TESTS)
)
set(INSTALL_GTEST OFF CACHE BOOL "Install GoogleTest alongside our own targets")
set(BUILD_GMOCK OFF CACHE BOOL "Build GoogleMock")
# The CRT the rest of the build links (/MD), not GoogleTest's own /MT default.
set(gtest_force_shared_crt ON CACHE BOOL "Use the shared CRT for GoogleTest")
FetchContent_MakeAvailable(googletest)
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
# GoogleTest builds itself with /WX, which newer clang-cl warnings break.
Expand Down
Loading