From 2c2ef754c206cb1d931b49b68ddf7a5a99c0b7f3 Mon Sep 17 00:00:00 2001 From: Christoph Neidahl Date: Thu, 20 Jan 2022 08:58:44 +0100 Subject: [PATCH 1/2] Init GitHub Action CI --- .github/workflows/build.yml | 103 ++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..49184c6e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,103 @@ +name: Build furnace + +on: + push: + branches: master + pull_request: + branches: master + +defaults: + run: + shell: bash + +env: + BUILD_TYPE: Release + +jobs: + build: + strategy: + matrix: + config: + - { name: 'Windows MSVC', os: windows-latest, compiler: msvc, shell: bash } + - { name: 'Windows MinGW', os: windows-latest, compiler: mingw, shell: 'msys2 {0}' } + - { name: 'macOS', os: macos-latest, shell: bash } + - { name: 'Ubuntu', os: ubuntu-18.04, shell: bash } + fail-fast: false + + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + defaults: + run: + shell: ${{ matrix.config.shell }} + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Setup Toolchain [Windows MSVC] + if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }} + uses: seanmiddleditch/gha-setup-vsdevenv@v3 + + - name: Setup Toolchain [Windows MinGW] + if: ${{ runner.os == 'Windows' && matrix.config.compiler == 'mingw' }} + uses: msys2/setup-msys2@v2 + with: + msystem: MINGW64 + update: true + install: | + mingw-w64-x86_64-toolchain + mingw-w64-x86_64-cmake + make + + - name: Install Dependencies [macOS] + if: ${{ runner.os == 'macOS' }} + run: | + export HOMEBREW_NO_INSTALL_CLEANUP=1 + brew update + brew install \ + pkg-config \ + sdl2 \ + libsndfile \ + zlib \ + jack + + - name: Install Dependencies [Ubuntu] + if: ${{ runner.os == 'Linux' }} + run: | + sudo apt update + sudo apt install \ + libsdl2-dev \ + libsndfile1-dev \ + zlib1g-dev \ + libjack-jackd2-dev + + - name: Configure + run: | + export CMAKE_EXTRA_ARGS=() + if [ '${{ runner.os }}' == 'Windows' ]; then + if [ '${{ matrix.config.compiler }}' == 'mingw' ]; then + CMAKE_EXTRA_ARGS+=('-G' 'MSYS Makefiles') + fi + fi + + cmake \ + -B ${PWD}/build \ + -DCMAKE_INSTALL_PREFIX=${PWD}/target \ + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + "${CMAKE_EXTRA_ARGS[@]}" + + - name: Build + run: | + export VERBOSE=1 + cmake \ + --build ${PWD}/build \ + --config ${{ env.BUILD_TYPE }} \ + --parallel 2 + + - name: Install + run: | + cmake \ + --install ${PWD}/build \ + --config ${{ env.BUILD_TYPE }} From c061b367203243da566d5e27c1fea1e883f6bf09 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Thu, 20 Jan 2022 08:59:14 +0100 Subject: [PATCH 2/2] Fix MSVC linking --- CMakeLists.txt | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9382c624..162618eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -181,11 +181,18 @@ if (WIN32) list(APPEND ENGINE_SOURCES res/furnace.rc) endif() +set(USED_SOURCES ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp) + if (BUILD_GUI) - add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} ${GUI_SOURCES} src/main.cpp) + list(APPEND USED_SOURCES ${GUI_SOURCES}) + if (MSVC) + add_executable(furnace WIN32 ${USED_SOURCES}) + else() + add_executable(furnace ${USED_SOURCES}) + endif() target_compile_definitions(furnace PUBLIC HAVE_GUI) else() - add_executable(furnace ${ENGINE_SOURCES} ${AUDIO_SOURCES} src/main.cpp) + add_executable(furnace ${USED_SOURCES}) endif() if (DEVENDOR_LIBRARIES) @@ -200,7 +207,10 @@ if (HAVE_JACK) endif() if (WIN32) - target_link_libraries(furnace shlwapi -static) + target_link_libraries(furnace shlwapi) + if (NOT MSVC) + target_link_libraries(furnace -static) + endif() endif() install(TARGETS furnace RUNTIME DESTINATION bin)