From eb61a550c10e0cff000f801d7882e3e51de565a2 Mon Sep 17 00:00:00 2001 From: Xerbo Date: Sat, 10 Oct 2020 17:58:18 +0100 Subject: [PATCH] Add release windows build --- .github/workflows/win_debug.yml | 2 +- .github/workflows/win_release.yml | 30 ++++++++++++++++++++++++++++++ README.md | 2 ++ build_windows.sh | 7 ++++++- src/main.c | 7 +++++-- 5 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/win_release.yml diff --git a/.github/workflows/win_debug.yml b/.github/workflows/win_debug.yml index 79c06b2..7843a79 100644 --- a/.github/workflows/win_debug.yml +++ b/.github/workflows/win_debug.yml @@ -21,7 +21,7 @@ jobs: - name: Run build script shell: bash working-directory: ${{runner.workspace}} - run: cd $GITHUB_WORKSPACE && ./build_windows.sh + run: cd $GITHUB_WORKSPACE && ./build_windows.sh $BUILD_TYPE - name: Upload compilied binary uses: actions/upload-artifact@v2 diff --git a/.github/workflows/win_release.yml b/.github/workflows/win_release.yml new file mode 100644 index 0000000..8dd6782 --- /dev/null +++ b/.github/workflows/win_release.yml @@ -0,0 +1,30 @@ +name: x86 Win Release + +on: + push: + branches: + - master +env: + BUILD_TYPE: Debug + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + # The user does not run as root + run: sudo apt install wget cmake make mingw-w64 git unzip libsndfile-dev + + - name: Run build script + shell: bash + working-directory: ${{runner.workspace}} + run: cd $GITHUB_WORKSPACE && ./build_windows.sh $BUILD_TYPE + + - name: Upload compilied binary + uses: actions/upload-artifact@v2 + with: + name: Debug build + path: ${{runner.workspace}}/aptdec/winbuild/aptdec-1.7.0.zip diff --git a/README.md b/README.md index b900464..7e3bc13 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Copyright (c) 2004-2009 Thierry Leconte (F4DWV), Xerbo (xerbo@protonmail.com) 20 ![x86 Release](https://github.com/Xerbo/aptdec/workflows/x86%20Release/badge.svg?branch=master) ![x86 Debug](https://github.com/Xerbo/aptdec/workflows/x86%20Debug/badge.svg?branch=devel) +![x86 Win Release](https://github.com/Xerbo/aptdec/workflows/x86%20Win%20Release/badge.svg?branch=master) +![x86 Win Debug](https://github.com/Xerbo/aptdec/workflows/x86%20Win%20Debug/badge.svg?branch=devel) ## Introduction diff --git a/build_windows.sh b/build_windows.sh index 1518223..33fb150 100755 --- a/build_windows.sh +++ b/build_windows.sh @@ -40,8 +40,13 @@ cp "libsndfile-1.0.29-win64/lib/sndfile.lib" $TEMP_PATH/lib/sndfile.lib # Copy DLL's into root for CPack cp $TEMP_PATH/bin/*.dll ../ +buildtype="Debug" +if [[ "$1" == "Release" ]]; then + buildtype="Release" +fi + # Build aptdec mkdir -p winbuild && cd winbuild -cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH .. +cmake -DCMAKE_BUILD_TYPE=$buildtype -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$TEMP_PATH .. make -j 4 make package diff --git a/src/main.c b/src/main.c index 770770e..951f986 100644 --- a/src/main.c +++ b/src/main.c @@ -47,7 +47,7 @@ static int initsnd(char *filename); int getsample(float *sample, int nb); static int processAudio(char *filename, options_t *opts); -int main(int argc, char **argv) { +int main(int argc, const char **argv) { //fprintf(stderr, VERSION"\n"); // Check if there are actually any input files @@ -97,7 +97,10 @@ int main(int argc, char **argv) { // Actually decode the files for (int i = 0; i < argc; i++) { - processAudio(argv[i], &opts); + // Convert from a `const char *` to a normal `char *` + char *filename = NULL; + memcpy(filename, argv[i], strlen(argv[i])); + processAudio(filename, &opts); } return 0;