From 6de99881b57cf37f440fb3a8e20717dfbf172935 Mon Sep 17 00:00:00 2001 From: Kristofer Munsterhjelm Date: Wed, 31 Jul 2024 21:07:52 +0200 Subject: [PATCH] More CI workflow work. Also change msvc_random hack to detect MSVC itself, as it turned out that the Windows CI environment was actually running MinGW. --- .github/workflows/build_cmake.yml | 4 ++++ src/hack/msvc_random.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index e4bf3f5..476476a 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -32,6 +32,7 @@ jobs: matrix: os: [ubuntu-22.04, windows-latest] build_type: [Release] + # TODO? mingw32 on Windows? cpp_compiler: [g++, clang++, cl] include: - os: ubuntu-22.04 @@ -76,6 +77,9 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} submodules: true + - if: matrix.os == 'windows-latest' + uses: ilammy/msvc-dev-cmd@v1.4.1 + - name: "Create directory '${{ env.VCPKG_DEFAULT_BINARY_CACHE }}'" run: mkdir -p $VCPKG_DEFAULT_BINARY_CACHE shell: bash diff --git a/src/hack/msvc_random.h b/src/hack/msvc_random.h index 62f2ed9..99623b6 100644 --- a/src/hack/msvc_random.h +++ b/src/hack/msvc_random.h @@ -8,7 +8,7 @@ // need in a way that MSVC understands. // MSVC RANDOM HACK -#if _WIN32 +#if defined(_MSC_VER) #define srand48(x) (srand((unsigned int(x)))) #define drand48() ((double)rand()/(RAND_MAX+1.0)) #define srandom(x) (srand((unsigned int)(x)))