build: switch to msvc as default release builder

build: add separate extra dll from msvc with support for windows xp
This commit is contained in:
jeefo 2023-06-27 14:20:23 +03:00
commit 52bfac2b09
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
5 changed files with 36 additions and 16 deletions

View file

@ -20,7 +20,7 @@ jobs:
strategy: strategy:
matrix: matrix:
arch: ['linux-x86', 'linux-amd64', 'linux-x86-gcc', 'linux-aarch64', 'darwin-x86', 'windows-x86', 'windows-amd64', 'windows-x86-gcc'] arch: ['linux-x86', 'linux-amd64', 'linux-x86-gcc', 'linux-aarch64', 'darwin-x86', 'windows-x86-clang', 'windows-amd64', 'windows-x86-gcc']
fail-fast: false fail-fast: false
steps: steps:
@ -58,7 +58,11 @@ jobs:
env: env:
name: windows-x86-msvc name: windows-x86-msvc
name: bot-build (windows-x86-msvc) strategy:
matrix:
arch: ['windows-x86', 'windows-x86-msvc-xp']
fail-fast: false
runs-on: windows-latest runs-on: windows-latest
steps: steps:
@ -75,18 +79,24 @@ jobs:
run: | run: |
python -m pip install --upgrade meson ninja python -m pip install --upgrade meson ninja
- name: Configure meson - name: Configure meson
shell: pwsh
run: | run: |
meson setup ${{env.name}} if ('${{matrix.arch}}' -eq 'windows-x86-msvc-xp') {
meson setup ${{matrix.arch}} -Dwinxp=true
}
else {
meson setup ${{matrix.arch}}
}
- name: Build sources - name: Build sources
run: | run: |
meson compile -C ${{env.name}} meson compile -C ${{matrix.arch}}
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: ${{env.name}} name: ${{matrix.arch}}
path: | path: |
${{env.name}}/yapb.dll ${{matrix.arch}}/yapb.dll
${{env.name}}/yapb.pdb ${{matrix.arch}}/yapb.pdb
bot-release: bot-release:
if: | if: |

@ -1 +1 @@
Subproject commit 99c8383ae2fccd6b0263bef92a154e571a0de12d Subproject commit 71bcf0e921611f591b2a2f9c68368f2dd158279e

View file

@ -40,6 +40,7 @@ build_type = get_option ('buildtype')
opt_64bit = get_option('64bit') opt_64bit = get_option('64bit')
opt_native = get_option('native') opt_native = get_option('native')
opt_winxp = get_option('winxp')
# cpp and ldflags from scratch # cpp and ldflags from scratch
cxxflags = [] cxxflags = []
@ -201,19 +202,24 @@ if cxx == 'clang' or cxx == 'gcc'
] ]
endif endif
elif os == 'windows' and (cxx =='msvc' or cxx == 'clang-cl') elif os == 'windows' and (cxx =='msvc' or cxx == 'clang-cl')
# define for building on winxp on msvc
if opt_winxp
cxxflags += [
'/TP', '/DCR_HAS_WINXP_SUPPORT', '/D_WIN32_WINNT=0x0501', '/D_USING_V110_SDK71_'
]
ldflags += ['/SUBSYSTEM:WINDOWS,5.01']
endif
if not opt_64bit and cxx == 'clang' if not opt_64bit and cxx == 'clang'
cxxflags += '/MACHINE:X86' cxxflags += '/MACHINE:X86'
ldflags += '/MACHINE:X86' ldflags += '/MACHINE:X86'
endif endif
cxxflags += [
'/TP', '/D _WIN32_WINNT=0x0501', '/D _USING_V110_SDK71_', '/Zc:threadSafeInit-'
]
# minor optimizations for release build # minor optimizations for release build
if build_type == 'release' if build_type == 'release'
cxxflags += [ cxxflags += [
'/GS-', '/Ob2', '/Oy', '/Oi', '/Ot', '/fp:precise', '/GF', '/GS-', '/GF', '/arch:SSE2', '/Zi' '/Zc:threadSafeInit-', '/GS-', '/Ob2', '/Oy', '/Oi', '/Ot', '/fp:precise', '/GF', '/Gw', '/arch:SSE2', '/Zi', '/guard:ehcont-', '/guard:cf-'
] ]
# add wpo if msvc # add wpo if msvc
@ -225,7 +231,7 @@ elif os == 'windows' and (cxx =='msvc' or cxx == 'clang-cl')
# add linker flags # add linker flags
ldflags += [ ldflags += [
'/LTCG', 'delayimp.lib', '/DELAYLOAD:user32.dll', '/DELAYLOAD:ws2_32.dll', '/SUBSYSTEM:WINDOWS,5.01', '/OPT:REF,ICF', '/GUARD:NO ', '/LTCG', 'delayimp.lib', '/DELAYLOAD:user32.dll', '/DELAYLOAD:ws2_32.dll',
] ]
endif endif

View file

@ -9,4 +9,7 @@ option('64bit', type : 'boolean', value : false,
description: 'Enables bot build with as 64-bit binary.') description: 'Enables bot build with as 64-bit binary.')
option('native', type : 'boolean', value : false, option('native', type : 'boolean', value : false,
description: 'Configure compiler for a native machine build.') description: 'Configure compiler for a native machine build.')
option('winxp', type : 'boolean', value : false,
description: 'Configure MSVC build to output Windows XP compatible binary.')

View file

@ -137,8 +137,9 @@ class BotRelease(object):
'linux-amd64': 'so', 'linux-amd64': 'so',
'linux-x86-gcc': 'so', 'linux-x86-gcc': 'so',
'windows-x86-gcc': 'dll', 'windows-x86-gcc': 'dll',
'windows-x86-clang': 'dll',
'windows-x86-msvc-xp': 'dll',
'windows-amd64': 'dll', 'windows-amd64': 'dll',
'windows-x86-msvc': 'dll',
'darwin-x86': 'dylib', 'darwin-x86': 'dylib',
}, extra=True)) }, extra=True))