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;