Skip to content

Commit 1600966

Browse files
committed
Use MSVC on CI
1 parent 3020c8d commit 1600966

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ jobs:
7272
restore-keys: |
7373
vcpkg-${{ matrix.os }}-${{ matrix.arch }}-
7474
75+
- name: Setup MSVC (Windows)
76+
if: matrix.os == 'windows'
77+
uses: ilammy/msvc-dev-cmd@v1
78+
with:
79+
arch: ${{ matrix.arch }}
80+
7581
- name: Setup vcpkg cache (Windows)
7682
if: matrix.os == 'windows'
7783
uses: actions/cache@v4

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
cmake_minimum_required(VERSION 3.10)
2+
3+
if(VCPKG_TARGET_TRIPLET MATCHES "^x86-")
4+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32" CACHE STRING "" FORCE)
5+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" CACHE STRING "" FORCE)
6+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32" CACHE STRING "" FORCE)
7+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32" CACHE STRING "" FORCE)
8+
endif()
9+
210
project(gwsockets)
311
add_subdirectory(GmodLUA)
412

@@ -23,10 +31,6 @@ if(WIN32)
2331
target_compile_definitions(gwsockets PRIVATE WIN32 GMMODULE BOOST_ALL_NO_LIB NDEBUG)
2432
else()
2533
target_compile_definitions(gwsockets PRIVATE LINUX GMMODULE BOOST_ALL_NO_LIB NDEBUG)
26-
if(VCPKG_TARGET_TRIPLET MATCHES "^x86-")
27-
target_compile_options(gwsockets PRIVATE -m32)
28-
target_link_options(gwsockets PRIVATE -m32)
29-
endif()
3034
endif()
3135

3236
# Link with OpenSSL and Boost from vcpkg

CMakePresets.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
"inherits": "vcpkg-base",
1818
"generator": "Ninja",
1919
"binaryDir": "${sourceDir}/cmake-build-x86-release",
20+
"architecture": {
21+
"value": "x86",
22+
"strategy": "external"
23+
},
2024
"cacheVariables": {
2125
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
2226
"VCPKG_TARGET_TRIPLET": "x86-windows-static"
@@ -33,6 +37,10 @@
3337
"inherits": "vcpkg-base",
3438
"generator": "Ninja",
3539
"binaryDir": "${sourceDir}/cmake-build-x64-release",
40+
"architecture": {
41+
"value": "x64",
42+
"strategy": "external"
43+
},
3644
"cacheVariables": {
3745
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
3846
"VCPKG_TARGET_TRIPLET": "x64-windows-static"
@@ -50,7 +58,7 @@
5058
"binaryDir": "${sourceDir}/cmake-build-x86-release",
5159
"cacheVariables": {
5260
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
53-
"VCPKG_TARGET_TRIPLET": "x86-linux"
61+
"VCPKG_TARGET_TRIPLET": "x86-linux-static"
5462
},
5563
"condition": {
5664
"type": "equals",
@@ -65,7 +73,7 @@
6573
"binaryDir": "${sourceDir}/cmake-build-x64-release",
6674
"cacheVariables": {
6775
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
68-
"VCPKG_TARGET_TRIPLET": "x64-linux"
76+
"VCPKG_TARGET_TRIPLET": "x64-linux-static"
6977
},
7078
"condition": {
7179
"type": "equals",

0 commit comments

Comments
 (0)