Skip to content

Commit

Permalink
workflow: Static build and upload artifact (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
koolkdev authored Jan 10, 2022
1 parent 8b2f1e8 commit ea8cc49
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 22 deletions.
47 changes: 34 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest] # macos-latest
include:
- platform: ubuntu-latest
configure_preset: 'static'
build_preset: 'static-release'
release_name: 'linux-x86-64'
cc: 'gcc-11'
cxx: 'g++-11'

- platform: windows-latest
configure_preset: 'windows-static'
build_preset: 'windows-static-release'
release_name: 'windows-x64'

runs-on: ${{matrix.platform}}

steps:
Expand All @@ -18,27 +31,35 @@ jobs:

- name: Run vcpkg
uses: lukka/run-vcpkg@v10
with:
vcpkgJsonGlob: 'vcpkg.json'

- name: Update gcc
run: |
sudo apt update
sudo apt install gcc-11 g++-11
echo "CC=gcc-11" >> $GITHUB_ENV
echo "CXX=g++-11" >> $GITHUB_ENV
shell: bash
- name: Install requirements
run: sudo apt install gcc-11 g++-11
if: matrix.platform == 'ubuntu-latest'

- name: Set clang
- name: Set compiler
run: |
echo "CC=/usr/local/opt/llvm/bin/clang" >> $GITHUB_ENV
echo "CXX=/usr/local/opt/llvm/bin/clang++" >> $GITHUB_ENV
echo "CC=${{matrix.cc}}" >> $GITHUB_ENV
echo "CXX=${{matrix.cxx}}" >> $GITHUB_ENV
shell: bash
if: matrix.platform == 'macos-latest'
if: matrix.cc != ''

- name: Run cmake
uses: lukka/run-cmake@v10
with:
configurePreset: 'default'
buildPreset: 'release'
configurePreset: ${{matrix.configure_preset}}
buildPreset: ${{matrix.build_preset}}

- name: Upload wfs-extract
uses: actions/upload-artifact@v2
with:
name: wfs-extract-${{matrix.release_name}}
path: build/${{matrix.configure_preset}}/wfs-extract/Release

- name: Upload wfs-file-injector
uses: actions/upload-artifact@v2
with:
name: wfs-file-injector-${{matrix.release_name}}
path: build/${{matrix.configure_preset}}/wfs-file-injector/Release

26 changes: 21 additions & 5 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,21 @@
}
},
{
"name": "windows-static",
"name": "static",
"inherits": [
"default"
],
"generator": "Ninja",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "$env{VSCMD_ARG_TGT_ARCH}-windows-static",
"CMAKE_BUILD_TYPE": "Release",
"BUILD_STATIC_MSVC": "ON"
"BUILD_STATIC": "ON"
}
},
{
"name": "windows-static",
"inherits": [
"static"
],
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "$env{Platform}-windows-static"
}
}
],
Expand All @@ -40,6 +46,16 @@
"name": "release",
"configurePreset": "default",
"configuration": "Release"
},
{
"name": "static-release",
"configurePreset": "static",
"configuration": "Release"
},
{
"name": "windows-static-release",
"configurePreset": "windows-static",
"configuration": "Release"
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ sudo wfs-fuse /dev/sdb /mnt --otp otp.bin --seeprom seeprom.bin -o default_permi

## Build
Requirements:
* Visual Studio 2022 / GCC 12+ / LLVM 13+
* Visual Studio 2022 / GCC 12+ / ~~LLVM 13+~~
* CMake 3.20+
* Ninja

Expand Down
2 changes: 1 addition & 1 deletion wfs-extract/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_compile_options(${PROJECT_NAME} PRIVATE
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
)

if (BUILD_STATIC_MSVC)
if(BUILD_STATIC AND MSVC)
set_property(TARGET ${PROJECT_NAME} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
Expand Down
2 changes: 1 addition & 1 deletion wfs-file-injector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target_compile_options(${PROJECT_NAME} PRIVATE
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
)

if (BUILD_STATIC_MSVC)
if(BUILD_STATIC AND MSVC)
set_property(TARGET ${PROJECT_NAME} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
Expand Down
3 changes: 3 additions & 0 deletions wfs-fuse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ target_link_libraries(wfs-fuse
PRIVATE
wfslib
)

if
target_link_libraries(myLib -static-libgcc -static-libstdc++)
2 changes: 1 addition & 1 deletion wfslib

0 comments on commit ea8cc49

Please sign in to comment.