1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-22 17:39:53 +03:00

Merge PR #1196: Use "clang-cl" for Windows builds on Azure Pipelines, fix non-const wchar_t array literal initialization

This commit is contained in:
Davide Beatrici 2020-08-16 02:32:57 +02:00 committed by GitHub
commit 490fc7b65c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 4 deletions

View File

@ -1,6 +1,8 @@
parameters: parameters:
- name: architecture - name: architecture
type: string type: string
- name: compilerPath
type: string
- name: vcpkgTriplet - name: vcpkgTriplet
type: string type: string
- name: vcvarsPath - name: vcvarsPath
@ -18,7 +20,7 @@ steps:
displayName: 'Prepare environment' displayName: 'Prepare environment'
- script: | - script: |
call "${{parameters.vcvarsPath}}" call "${{parameters.vcvarsPath}}"
cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{parameters.vcpkgTriplet}} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl $(Build.SourcesDirectory) cmake -G "Ninja" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=${{parameters.vcpkgTriplet}} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER="${{parameters.compilerPath}}" -DCMAKE_CXX_COMPILER="${{parameters.compilerPath}}" $(Build.SourcesDirectory)
cmake --build . cmake --build .
workingDirectory: $(Build.BinariesDirectory) workingDirectory: $(Build.BinariesDirectory)
displayName: 'Build' displayName: 'Build'

View File

@ -7,6 +7,7 @@ jobs:
- template: "azure-pipelines-win-steps.yml" - template: "azure-pipelines-win-steps.yml"
parameters: parameters:
architecture: "x86_64" architecture: "x86_64"
compilerPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/x64/bin/clang-cl.exe"
vcpkgTriplet: "x64-windows-static-md" vcpkgTriplet: "x64-windows-static-md"
vcvarsPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat" vcvarsPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
- job: windows_x86 - job: windows_x86
@ -17,5 +18,6 @@ jobs:
- template: "azure-pipelines-win-steps.yml" - template: "azure-pipelines-win-steps.yml"
parameters: parameters:
architecture: "x86" architecture: "x86"
compilerPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/bin/clang-cl.exe"
vcpkgTriplet: "x86-windows-static-md" vcpkgTriplet: "x86-windows-static-md"
vcvarsPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvarsamd64_x86.bat" vcvarsPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvarsamd64_x86.bat"

View File

@ -56,7 +56,7 @@ bool Win32UPnPAddPort(UINT outside_port, UINT inside_port, bool udp, char *local
IUPnPNAT *nat = NULL; IUPnPNAT *nat = NULL;
wchar_t ip_str[MAX_SIZE]; wchar_t ip_str[MAX_SIZE];
BSTR bstr_ip, bstr_description, bstr_protocol; BSTR bstr_ip, bstr_description, bstr_protocol;
wchar_t *protocol_str = (udp ? L"UDP" : L"TCP"); const wchar_t *protocol_str = (udp ? L"UDP" : L"TCP");
// Validate arguments // Validate arguments
if (outside_port == 0 || outside_port >= 65536 || inside_port == 0 || inside_port >= 65536 || if (outside_port == 0 || outside_port >= 65536 || inside_port == 0 || inside_port >= 65536 ||
IsEmptyStr(local_ip) || UniIsEmptyStr(description)) IsEmptyStr(local_ip) || UniIsEmptyStr(description))

View File

@ -13,8 +13,10 @@ set(COMPONENT_FILE_NAME "${COMPONENT_FILE_NAME}.exe")
configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc") configure_file("${TOP_DIRECTORY}/src/BuildFiles/VerScript/ver.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
target_sources(vpndrvinst PRIVATE "vpndrvinst.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc") target_sources(vpndrvinst PRIVATE "vpndrvinst.rc" "${CMAKE_CURRENT_BINARY_DIR}/ver.rc")
if(MSVC)
# Fixes manifest authoring error c1010001 # Fixes manifest authoring error c1010001
set_target_properties(vpndrvinst PROPERTIES LINK_FLAGS "/MANIFESTUAC:level='requireAdministrator'") set_target_properties(vpndrvinst PROPERTIES LINK_FLAGS "/manifestuac:level='requireAdministrator'")
endif()
if(${COMPILER_ARCHITECTURE} STREQUAL "x64") if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
target_sources(vpndrvinst PRIVATE "${TOP_DIRECTORY}/src/BuildFiles/Manifests/x64_admin.manifest") target_sources(vpndrvinst PRIVATE "${TOP_DIRECTORY}/src/BuildFiles/Manifests/x64_admin.manifest")