Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build improvements #646

Merged
merged 3 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 14 additions & 7 deletions .github/workflows/msbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,23 @@ jobs:
strategy:
matrix:
arch: [x86, x64, arm64]
conf:
- name: ""
value: "release"
ovpn3:
- preset: ""
name: ""
upload_name: ""
- preset: -ovpn3
name: "- ovpn3"
upload_name: "_ovpn3"
include:
- conf:
name: " ASAN"
value: "asan"
arch: x64

name: 'msvc - ${{matrix.arch}} ${{ matrix.ovpn3.name }}'
name: 'msvc - ${{matrix.arch}} ${{ matrix.ovpn3.name }}${{ matrix.conf.name }}'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -54,15 +62,15 @@ jobs:
- name: Run CMake consuming CMakePreset.json and vcpkg.json by mean of vcpkg.
uses: lukka/run-cmake@v10
with:
configurePreset: '${{ matrix.arch }}-release${{ matrix.ovpn3.preset }}'
buildPreset: '${{ matrix.arch }}-release${{ matrix.ovpn3.preset }}'
configurePreset: '${{ matrix.arch }}${{ matrix.ovpn3.preset }}'
buildPreset: '${{ matrix.arch }}-${{ matrix.conf.value }}${{ matrix.ovpn3.preset }}'

- uses: actions/upload-artifact@v3
with:
name: openvpn-gui_${{ matrix.arch }}${{ matrix.ovpn3.upload_name }}
name: openvpn-gui_${{ matrix.arch }}_${{ matrix.conf }}${{ matrix.ovpn3.upload_name }}
path: |
out/build/${{ matrix.arch }}-release${{ matrix.ovpn3.preset }}/*.dll
out/build/${{ matrix.arch }}-release${{ matrix.ovpn3.preset }}/*.exe
out/build/${{ matrix.arch }}${{ matrix.ovpn3.preset }}/${{ matrix.conf.value }}/*.dll
out/build/${{ matrix.arch }}${{ matrix.ovpn3.preset }}/${{ matrix.conf.value }}/*.exe

mingw:
strategy:
Expand Down Expand Up @@ -107,4 +115,3 @@ jobs:
- name: make
run: make
working-directory: openvpn-gui

29 changes: 20 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,24 @@ add_executable(${PROJECT_NAME} WIN32
res/openvpn-gui-res.rc)

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /guard:cf /Qspectre")

if(MSVC)
list(APPEND CMAKE_CONFIGURATION_TYPES Asan)
endif(MSVC)

set(CMAKE_C_FLAGS_ASAN
"${CMAKE_C_FLAGS_DEBUG} /fsanitize=address" CACHE STRING
"Flags used by the C compiler during AddressSanitizer builds." FORCE)

set(CMAKE_EXE_LINKER_FLAGS_ASAN
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used by the linker during AddressSanitizer builds." FORCE)

set(CMAKE_SHARED_LINKER_FLAGS_ASAN
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG}" CACHE STRING
"Flags used by the linker during AddressSanitizer builds." FORCE)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf /Qspectre")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf /DYNAMICBASE")

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4267 /wd4244")
Expand Down Expand Up @@ -153,18 +169,13 @@ target_compile_definitions(${TEST_PLAP_EXE} PRIVATE
HAVE_CONFIG_H)

if(MSVC)
# work around msvc generator Debug/Release directory ugliness, doesn't apply for Ninja
set_target_properties(${PROJECT_NAME} ${PROJECT_NAME_PLAP} ${TEST_PLAP_EXE} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>)

target_compile_options(${PROJECT_NAME} PRIVATE "$<$<CONFIG:Release>:/Zi>")
target_link_options(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Release>:/DEBUG:FULL>"
"$<$<CONFIG:Release>:/OPT:REF>"
"$<$<CONFIG:Release>:/OPT:ICF>")
endif(MSVC)

set_target_properties(${TEST_PLAP_EXE} PROPERTIES
LINK_FLAGS " /MANIFEST:EMBED /MANIFESTINPUT:${CMAKE_SOURCE_DIR}/plap/test-plap.manifest ")
target_link_options(${TEST_PLAP_EXE} PRIVATE
"/MANIFEST:EMBED"
"/MANIFESTINPUT:${CMAKE_SOURCE_DIR}/plap/test-plap.manifest")
97 changes: 26 additions & 71 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,25 @@
},
{
"name": "x64",
"hidden": true,
"inherits": "base",
"architecture": {
"value": "x64"
}
},
{
"name": "arm64",
"hidden": true,
"inherits": "base",
"architecture": {
"value": "arm64"
}
},
{
"name": "x86",
"hidden": true,
"inherits": "base",
"architecture": {
"value": "Win32"
}
},
{
"name": "debug",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "release",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "ovpn3",
"hidden": true,
Expand All @@ -57,113 +43,82 @@
}
},
{
"name": "x64-debug",
"inherits": [ "base", "x64", "debug" ]
},
{
"name": "arm64-debug",
"inherits": [ "base", "arm64", "debug" ]
"name": "x64-ovpn3",
"inherits": [ "x64", "ovpn3" ]
},
{
"name": "x86-debug",
"inherits": [ "base", "x86", "debug" ]
"name": "arm64-ovpn3",
"inherits": [ "arm64", "ovpn3" ]
},
{
"name": "x64-release",
"inherits": [ "base", "x64", "release" ]
},
{
"name": "arm64-release",
"inherits": [ "base", "arm64", "release" ]
},
{
"name": "x86-release",
"inherits": [ "base", "x86", "release" ]
},
{
"name": "x64-debug-ovpn3",
"inherits": [ "x64-debug", "ovpn3" ]
},
{
"name": "arm64-debug-ovpn3",
"inherits": [ "arm64-debug", "ovpn3" ]
},
{
"name": "x86-debug-ovpn3",
"inherits": [ "x86-debug", "ovpn3" ]
},
{
"name": "x64-release-ovpn3",
"inherits": [ "x64-release", "ovpn3" ]
},
{
"name": "arm64-release-ovpn3",
"inherits": [ "arm64-release", "ovpn3" ]
},
{
"name": "x86-release-ovpn3",
"inherits": [ "x86-release", "ovpn3" ]
"name": "x86-ovpn3",
"inherits": [ "x86", "ovpn3" ]
}
],
"buildPresets": [
{
"name": "x64-release",
"configurePreset": "x64-release",
"configurePreset": "x64",
"configuration": "Release"
},
{
"name": "x86-release",
"configurePreset": "x86-release",
"configurePreset": "x86",
"configuration": "Release"
},
{
"name": "arm64-release",
"configurePreset": "arm64-release",
"configurePreset": "arm64",
"configuration": "Release"
},
{
"name": "x64-debug",
"configurePreset": "x64-debug",
"configurePreset": "x64",
"configuration": "Debug"
},
{
"name": "x64-asan",
"configurePreset": "x64",
"configuration": "Asan"
},
{
"name": "x86-debug",
"configurePreset": "x86-debug",
"configurePreset": "x86",
"configuration": "Debug"
},
{
"name": "arm64-debug",
"configurePreset": "arm64-debug",
"configurePreset": "arm64",
"configuration": "Debug"
},
{
"name": "x64-release-ovpn3",
"configurePreset": "x64-release-ovpn3",
"configurePreset": "x64-ovpn3",
"configuration": "Release"
},
{
"name": "x86-release-ovpn3",
"configurePreset": "x86-release-ovpn3",
"configurePreset": "x86-ovpn3",
"configuration": "Release"
},
{
"name": "arm64-release-ovpn3",
"configurePreset": "arm64-release-ovpn3",
"configurePreset": "arm64-ovpn3",
"configuration": "Release"
},
{
"name": "x64-debug-ovpn3",
"configurePreset": "x64-debug-ovpn3",
"configurePreset": "x64-ovpn3",
"configuration": "Debug"
},
{
"name": "x86-debug-ovpn3",
"configurePreset": "x86-debug-ovpn3",
"configurePreset": "x86-ovpn3",
"configuration": "Debug"
},
{
"name": "arm64-debug-ovpn3",
"configurePreset": "arm64-debug-ovpn3",
"configurePreset": "arm64-ovpn3",
"configuration": "Debug"
}
]
Expand Down