diff --git a/.github/workflows/cmake-lx.yml b/.github/workflows/cmake-lx.yml index 08a9982b..05b56358 100644 --- a/.github/workflows/cmake-lx.yml +++ b/.github/workflows/cmake-lx.yml @@ -27,14 +27,60 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y libmpg123-dev libvorbis-dev libavformat-dev libavcodec-dev libavutil-dev libswresample-dev - sudo apt-get install -y libao-dev audacious-dev libjansson-dev yasm libopus-dev + sudo apt-get install -y libvorbis-dev libjansson-dev yasm libopus-dev - name: Create build environment # Some projects don't allow in-source building, so create a separate build directory # We'll use this as our working directory for all subsequent commands run: cmake -E make_directory ${{runner.workspace}}/build + - name: Cache celt + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/dependencies/celt-0061 + ${{runner.workspace}}/dependencies/celt-0110 + ${{runner.workspace}}/build/dependencies/celt-0061/libcelt/.libs + ${{runner.workspace}}/build/dependencies/celt-0110/libcelt/.libs + key: linux-celt-${{ hashFiles('cmake/dependencies/celt.cmake') }} + + - name: Cache ffmpeg + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/build/dependencies/ffmpeg/bin/usr/local/include + ${{runner.workspace}}/build/dependencies/ffmpeg/bin/usr/local/lib + key: linux-ffmpeg-${{ hashFiles('cmake/dependencies/ffmpeg.cmake') }} + + - name: Cache atrac9 + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/build/dependencies/LibAtrac9/bin + key: linux-atrac9-${{ hashFiles('cmake/dependencies/atrac9.cmake') }} + + - name: Cache g719 + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/build/dependencies/libg719_decode/libg719_decode.a + key: linux-g719-${{ hashFiles('cmake/dependencies/g719.cmake') }} + + - name: Cache mpg123 + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/dependencies/mpg123 + ${{runner.workspace}}/build/dependencies/mpg123/src/libmpg123/.libs + key: linux-mpg123-${{ hashFiles('cmake/dependencies/mpg123.cmake') }} + + - name: Cache speex + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/build/dependencies/speex/libspeex/.libs + key: linux-speex-${{ hashFiles('cmake/dependencies/speex.cmake') }} + - name: Configure CMake # Use a bash shell so we can use the same syntax for environment variable # access regardless of the host operating system diff --git a/.github/workflows/cmake-wasm.yml b/.github/workflows/cmake-wasm.yml index 67c5b987..9b4d1cec 100644 --- a/.github/workflows/cmake-wasm.yml +++ b/.github/workflows/cmake-wasm.yml @@ -31,6 +31,60 @@ jobs: - name: Create build environment run: cmake -E make_directory ${{runner.workspace}}/embuild + - name: Cache celt + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/dependencies/celt-0061 + ${{runner.workspace}}/dependencies/celt-0110 + ${{runner.workspace}}/embuild/dependencies/celt-0061/libcelt/.libs + ${{runner.workspace}}/embuild/dependencies/celt-0110/libcelt/.libs + key: wasm-celt-${{ hashFiles('cmake/dependencies/celt.cmake') }} + + - name: Cache ffmpeg + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/embuild/dependencies/ffmpeg/bin/usr/local/include + ${{runner.workspace}}/embuild/dependencies/ffmpeg/bin/usr/local/lib + key: wasm-ffmpeg-${{ hashFiles('cmake/dependencies/ffmpeg.cmake') }} + + - name: Cache atrac9 + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/embuild/dependencies/LibAtrac9/bin + key: wasm-atrac9-${{ hashFiles('cmake/dependencies/atrac9.cmake') }} + + - name: Cache g719 + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/embuild/dependencies/libg719_decode/libg719_decode.a + key: wasm-g719-${{ hashFiles('cmake/dependencies/g719.cmake') }} + + - name: Cache speex + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/embuild/dependencies/speex/libspeex/.libs + key: wasm-speex-${{ hashFiles('cmake/dependencies/speex.cmake') }} + + - name: Cache ogg + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/embuild/dependencies/ogg/libogg.a + ${{runner.workspace}}/embuild/dependencies/ogg/include + key: wasm-ogg-${{ hashFiles('cmake/dependencies/ogg.cmake') }} + + - name: Cache vorbis + uses: actions/cache@v2 + with: + path: | + ${{runner.workspace}}/embuild/dependencies/vorbis/lib/*.a + key: wasm-vorbis-${{ hashFiles('cmake/dependencies/vorbis.cmake') }} + - name: Configure CMake shell: bash working-directory: ${{runner.workspace}}/embuild diff --git a/cmake/dependencies/g719.cmake b/cmake/dependencies/g719.cmake index 6df599d5..eafe2335 100644 --- a/cmake/dependencies/g719.cmake +++ b/cmake/dependencies/g719.cmake @@ -6,11 +6,21 @@ if(NOT WIN32 AND USE_G719) ) if(G719_PATH) + set(G719_LINK_PATH ${G719_BIN}/libg719_decode.a) + configure_file( ${VGM_SOURCE_DIR}/ext_libs/libg719_decode/CMakeLists.txt ${G719_PATH}/CMakeLists.txt COPYONLY) - add_subdirectory(${G719_PATH} ${G719_BIN} EXCLUDE_FROM_ALL) + + if(EXISTS ${G719_LINK_PATH}) + add_library(g719_decode STATIC IMPORTED) + set_target_properties(g719_decode PROPERTIES + IMPORTED_LOCATION ${G719_LINK_PATH} + ) + else() + add_subdirectory(${G719_PATH} ${G719_BIN} EXCLUDE_FROM_ALL) + endif() endif() endif() if(NOT USE_G719) diff --git a/cmake/dependencies/ogg.cmake b/cmake/dependencies/ogg.cmake index b3d3074c..b9aa4fbe 100644 --- a/cmake/dependencies/ogg.cmake +++ b/cmake/dependencies/ogg.cmake @@ -14,7 +14,17 @@ if(NOT WIN32 AND USE_VORBIS) ) if(OGG_PATH) - add_subdirectory(${OGG_PATH} ${OGG_BIN} EXCLUDE_FROM_ALL) + set(OGG_LINK_PATH ${OGG_BIN}/libogg.a) + + if(EXISTS ${OGG_LINK_PATH} AND EXISTS ${OGG_BIN}/include) + add_library(ogg STATIC IMPORTED) + set_target_properties(ogg PROPERTIES + IMPORTED_LOCATION ${OGG_LINK_PATH} + ) + else() + add_subdirectory(${OGG_PATH} ${OGG_BIN} EXCLUDE_FROM_ALL) + endif() + set(OGG_INCLUDE_DIR ${OGG_PATH}/include ${OGG_BIN}/include) set(OGG_LIBRARY ogg) endif() diff --git a/cmake/dependencies/vorbis.cmake b/cmake/dependencies/vorbis.cmake index 23857a14..3ce0be07 100644 --- a/cmake/dependencies/vorbis.cmake +++ b/cmake/dependencies/vorbis.cmake @@ -14,7 +14,22 @@ if(NOT WIN32 AND USE_VORBIS) ) if(VORBIS_PATH) - add_subdirectory(${VORBIS_PATH} ${VORBIS_BIN} EXCLUDE_FROM_ALL) + set(VORBIS_LINK_PATH ${VORBIS_BIN}/lib/libvorbis.a) + set(VORBISFILE_LINK_PATH ${VORBIS_BIN}/lib/libvorbisfile.a) + + if(EXISTS ${VORBIS_LINK_PATH} AND EXISTS ${VORBISFILE_LINK_PATH}) + add_library(vorbis STATIC IMPORTED) + set_target_properties(vorbis PROPERTIES + IMPORTED_LOCATION ${VORBIS_LINK_PATH} + ) + add_library(vorbisfile STATIC IMPORTED) + set_target_properties(vorbisfile PROPERTIES + IMPORTED_LOCATION ${VORBISFILE_LINK_PATH} + ) + else() + add_subdirectory(${VORBIS_PATH} ${VORBIS_BIN} EXCLUDE_FROM_ALL) + endif() + set(OGG_VORBIS_INCLUDE_DIR ${VORBIS_PATH}/include) set(OGG_VORBIS_LIBRARY vorbis)