From 3a67870e173c8e7e1c8ca6a490a415a1b035335f Mon Sep 17 00:00:00 2001 From: Angelo Theodorou Date: Sun, 3 Mar 2024 17:42:42 +0100 Subject: [PATCH] Build libogg and libvorbis with CMake - Run GitHub Actions on both old and updated macOS images - Update libogg to 1.3.5 - Add a patch to compile libvorbis on MinGW --- .github/workflows/macos.yml | 16 ++++- cmake/ogg.cmake | 58 ++++++++---------- cmake/vorbis.cmake | 113 +++++++++++++----------------------- patches/vorbis_mingw.patch | 33 +++++++++++ 4 files changed, 110 insertions(+), 110 deletions(-) create mode 100644 patches/vorbis_mingw.patch diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 76ec107..c86a62e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,8 +15,10 @@ jobs: strategy: fail-fast: false matrix: + os: [macOS-12, macOS-14] BuildType: [Debug, Release] - runs-on: 'macOS-12' + + runs-on: ${{ matrix.os }} steps: - name: 'Checkout code' @@ -24,7 +26,11 @@ jobs: - name: 'CMake Configuration' run: | - cmake -B ../nCine-libraries-build -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} + if [[ "${{ matrix.os }}" == "macOS-14" ]]; then + export OSX_ARCHITECTURES="arm64;x86_64" + fi + + cmake -B ../nCine-libraries-build -D CMAKE_BUILD_TYPE=${{ matrix.BuildType }} -D CMAKE_OSX_ARCHITECTURES=$OSX_ARCHITECTURES - name: 'Make' run: | @@ -41,7 +47,11 @@ jobs: export BRANCH_NAME=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD) export DEPLOY_MESSAGE=`sed 's/BRANCH_NAME/'"$BRANCH_NAME"'/' <<< "$DEPLOY_MESSAGE"` - export OS=darwin + if [[ "${{ matrix.os }}" == "macOS-14" ]]; then + export OS=macos14 + else + export OS=macos12 + fi export CC=appleclang git fetch --unshallow || true diff --git a/cmake/ogg.cmake b/cmake/ogg.cmake index 029d370..58995b9 100644 --- a/cmake/ogg.cmake +++ b/cmake/ogg.cmake @@ -1,64 +1,56 @@ set(TARGET_OGG ogg) -set(URL_OGG http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gz) -set(URL_MD5_OGG 1eda7efc22a97d08af98265107d65f95) -set(LIBNAME_OGG libogg) +set(URL_OGG http://downloads.xiph.org/releases/ogg/libogg-1.3.5.tar.gz) +set(URL_MD5_OGG 3267127fe8d7ba77d3e00cb9d7ad578d) +set(COMMON_CMAKE_ARGS_OGG -DBUILD_SHARED_LIBS=ON -DINSTALL_DOCS=OFF) +set(INCLUDE_DIR_OGG ${EP_BASE}/Source/project_${TARGET_OGG}/include) if(MSVC) - set(LIBFILE_OGG_NOEXT ${EP_BASE}/Source/project_${TARGET_OGG}/win32/VS2015/${CMAKE_VS_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}/${LIBNAME_OGG}) + set(LIBNAME_OGG ogg) + set(LIBFILE_OGG_NOEXT ${CMAKE_BUILD_TYPE}/${LIBNAME_OGG}) + set(INCLUDE_DIR_VORBIS ${EP_BASE}/Source/project_${TARGET_VORBIS}/include/vorbis) ExternalProject_Add(project_${TARGET_OGG} URL ${URL_OGG} URL_MD5 ${URL_MD5_OGG} - CONFIGURE_COMMAND devenv win32/VS2015/libogg_dynamic.vcxproj /Upgrade - BUILD_COMMAND msbuild win32/VS2015/libogg_dynamic.vcxproj -m /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=${CMAKE_VS_PLATFORM_NAME} /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} - BUILD_IN_SOURCE 1 + CMAKE_ARGS ${COMMON_CMAKE_ARGS_OGG} + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --parallel + BUILD_IN_SOURCE 0 INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_OGG_NOEXT}.dll ${BINDIR}/ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_OGG_NOEXT}.lib ${LIBDIR}/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/ogg/ogg.h ${INCDIR}/ogg/ogg.h - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/ogg/os_types.h ${INCDIR}/ogg/os_types.h - ) - - set(TARGET_OGG_STATIC ogg_static) - ExternalProject_Add(project_${TARGET_OGG_STATIC} - DEPENDS project_${TARGET_OGG} - DOWNLOAD_COMMAND "" - SOURCE_DIR ${EP_BASE}/Source/project_${TARGET_OGG} - CONFIGURE_COMMAND devenv win32/VS2015/libogg_static.vcxproj /Upgrade - BUILD_COMMAND msbuild win32/VS2015/libogg_static.vcxproj -m /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=${CMAKE_VS_PLATFORM_NAME} /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} - BUILD_IN_SOURCE 1 - INSTALL_COMMAND "" #${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_OGG_NOEXT}_static.lib ${LIBDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_OGG}/ogg/ogg.h ${INCDIR}/ogg/ogg.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_OGG}/ogg/os_types.h ${INCDIR}/ogg/os_types.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different include/ogg/config_types.h ${INCDIR}/ogg/config_types.h ) elseif(APPLE) set(FRAMEWORK_DIR_OGG ${DESTINATION_PATH}/${TARGET_OGG}.framework) set(DYLIBNAME_OGG libogg.0.dylib) + set(DYLIBNAME_VERSIONED_OGG libogg.0.8.5.dylib) ExternalProject_Add(project_${TARGET_OGG} URL ${URL_OGG} URL_MD5 ${URL_MD5_OGG} - CONFIGURE_COMMAND ./configure --prefix= - BUILD_COMMAND make -j${CPUS} - BUILD_IN_SOURCE 1 + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${COMMON_CMAKE_ARGS_OGG} + BUILD_COMMAND ${CMAKE_COMMAND} --build . --parallel + BUILD_IN_SOURCE 0 INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_OGG}/Versions/A COMMAND ${CMAKE_COMMAND} -E create_symlink A ${FRAMEWORK_DIR_OGG}/Versions/Current - COMMAND ${CMAKE_COMMAND} -E copy_if_different src/.libs/${DYLIBNAME_OGG} ${FRAMEWORK_DIR_OGG}/Versions/A/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DYLIBNAME_VERSIONED_OGG} ${FRAMEWORK_DIR_OGG}/Versions/A/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DYLIBNAME_OGG} ${FRAMEWORK_DIR_OGG}/Versions/A/ COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/${DYLIBNAME_OGG} ${FRAMEWORK_DIR_OGG}/${TARGET_OGG} COMMAND install_name_tool -id "@rpath/${TARGET_OGG}.framework/${TARGET_OGG}" ${FRAMEWORK_DIR_OGG}/${TARGET_OGG} COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_OGG}/Versions/A/Headers/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/ogg/ogg.h ${FRAMEWORK_DIR_OGG}/Versions/A/Headers/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/ogg/os_types.h ${FRAMEWORK_DIR_OGG}/Versions/A/Headers/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_OGG}/ogg/ogg.h ${FRAMEWORK_DIR_OGG}/Versions/A/Headers/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_OGG}/ogg/os_types.h ${FRAMEWORK_DIR_OGG}/Versions/A/Headers/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different include/ogg/config_types.h ${FRAMEWORK_DIR_OGG}/Versions/A/Headers/ COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${FRAMEWORK_DIR_OGG}/Headers - COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_OGG}/Versions/A/Resources - COMMAND ${CMAKE_COMMAND} -E copy_if_different macosx/English.lproj ${FRAMEWORK_DIR_OGG}/Versions/A/Resources/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different macosx/Info.plist ${FRAMEWORK_DIR_OGG}/Versions/A/Resources/ - COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Resources ${FRAMEWORK_DIR_OGG}/Resources ) elseif(NOT EMSCRIPTEN) ExternalProject_Add(project_${TARGET_OGG} URL ${URL_OGG} URL_MD5 ${URL_MD5_OGG} - CONFIGURE_COMMAND ./configure --prefix=${DESTINATION_PATH} --exec-prefix=${DESTINATION_PATH} - BUILD_COMMAND make -j${CPUS} - BUILD_IN_SOURCE 1 + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${COMMON_CMAKE_ARGS_OGG} -DCMAKE_INSTALL_PREFIX=${DESTINATION_PATH} + BUILD_COMMAND ${CMAKE_COMMAND} --build . --parallel + BUILD_IN_SOURCE 0 INSTALL_COMMAND make install ) endif() diff --git a/cmake/vorbis.cmake b/cmake/vorbis.cmake index 70d6862..d5b5679 100644 --- a/cmake/vorbis.cmake +++ b/cmake/vorbis.cmake @@ -5,13 +5,15 @@ endif() set(TARGET_VORBIS vorbis) set(URL_VORBIS http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.gz) set(URL_MD5_VORBIS 9b8034da6edc1a17d18b9bc4542015c7) - -set(LIBNAME_VORBIS libvorbis) +set(COMMON_CMAKE_ARGS_VORBIS -DBUILD_SHARED_LIBS=ON) +set(INCLUDE_DIR_VORBIS ${EP_BASE}/Source/project_${TARGET_VORBIS}/include) set(TARGET_VORBISFILE vorbisfile) -set(LIBNAME_VORBISFILE libvorbisfile) if(MSVC) - set(LIBFILE_VORBIS_NOEXT ${EP_BASE}/Source/project_${TARGET_VORBIS}/win32/VS2010/libvorbis/${CMAKE_VS_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}/${LIBNAME_VORBIS}) + set(LIBNAME_VORBIS vorbis) + set(LIBNAME_VORBISFILE vorbisfile) + set(LIBFILE_VORBIS_NOEXT lib/${CMAKE_BUILD_TYPE}/${LIBNAME_VORBIS}) + set(LIBFILE_VORBISFILE_NOEXT lib/${CMAKE_BUILD_TYPE}/${LIBNAME_VORBISFILE}) get_filename_component(LIBDIR_OGG ${LIBFILE_OGG_NOEXT}.dll DIRECTORY) set(INCLUDEDIR_OGG ${EP_BASE}/Source/project_${TARGET_OGG}/include) @@ -19,109 +21,72 @@ if(MSVC) DEPENDS project_${TARGET_OGG} URL ${URL_VORBIS} URL_MD5 ${URL_MD5_VORBIS} - CONFIGURE_COMMAND devenv win32/VS2010/libvorbis/libvorbis_dynamic.vcxproj /Upgrade - BUILD_COMMAND set CL=/I${INCLUDEDIR_OGG} COMMAND set LINK=/LIBPATH:${LIBDIR_OGG} - COMMAND msbuild win32/VS2010/libvorbis/libvorbis_dynamic.vcxproj -m /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=${CMAKE_VS_PLATFORM_NAME} /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} - BUILD_IN_SOURCE 1 + # Clearing `CMAKE_FIND_ROOT_PATH` to build with MSVC under MSYS/MinGW + CMAKE_ARGS -DOGG_LIBRARY=${EP_BASE}/Build/project_${TARGET_OGG}/${LIBFILE_OGG_NOEXT}.lib -DOGG_INCLUDE_DIR=${EP_BASE}/Source/project_${TARGET_OGG}/include -DCMAKE_FIND_ROOT_PATH="" ${COMMON_CMAKE_ARGS_VORBIS} + BUILD_COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} --parallel + BUILD_IN_SOURCE 0 INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_VORBIS_NOEXT}.dll ${BINDIR}/ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_VORBIS_NOEXT}.lib ${LIBDIR}/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/vorbis/codec.h ${INCDIR}/vorbis/codec.h - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/vorbis/vorbisenc.h ${INCDIR}/vorbis/vorbisenc.h - ) - set(TARGET_VORBIS_STATIC vorbis_static) - ExternalProject_Add(project_${TARGET_VORBIS_STATIC} - DEPENDS project_${TARGET_VORBIS} - DOWNLOAD_COMMAND "" - SOURCE_DIR ${EP_BASE}/Source/project_${TARGET_VORBIS} - CONFIGURE_COMMAND devenv win32/VS2010/libvorbis/libvorbis_static.vcxproj /Upgrade - BUILD_COMMAND set CL=/I${INCLUDEDIR_OGG} COMMAND set LINK=/LIBPATH:${LIBDIR_OGG} - COMMAND msbuild win32/VS2010/libvorbis/libvorbis_static.vcxproj -m /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=${CMAKE_VS_PLATFORM_NAME} /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} - BUILD_IN_SOURCE 1 - INSTALL_COMMAND "" #${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_VORBIS_NOEXT}_static.lib ${LIBDIR}/ - ) - - set(LIBFILE_VORBISFILE_NOEXT ${EP_BASE}/Source/project_${TARGET_VORBIS}/win32/VS2010/libvorbisfile/${CMAKE_VS_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}/${LIBNAME_VORBISFILE}) + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_VORBIS}/vorbis/codec.h ${INCDIR}/vorbis/codec.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_VORBIS}/vorbis/vorbisenc.h ${INCDIR}/vorbis/vorbisenc.h - get_filename_component(LIBDIR_VORBIS ${LIBFILE_VORBIS_NOEXT}.dll DIRECTORY) - ExternalProject_Add(project_${TARGET_VORBISFILE} - DEPENDS project_${TARGET_VORBIS} - DOWNLOAD_COMMAND "" # Vorbis project is going to download the archive, but a dummy command is needed - SOURCE_DIR ${EP_BASE}/Source/project_${TARGET_VORBIS} - CONFIGURE_COMMAND devenv win32/VS2010/libvorbisfile/libvorbisfile_dynamic.vcxproj /Upgrade - BUILD_COMMAND set CL=/I${INCLUDEDIR_OGG} COMMAND set LINK=/LIBPATH:${LIBDIR_OGG} /LIBPATH:${LIBDIR_VORBIS} - COMMAND msbuild win32/VS2010/libvorbisfile/libvorbisfile_dynamic.vcxproj -m /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=${CMAKE_VS_PLATFORM_NAME} /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} - BUILD_IN_SOURCE 1 - INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_VORBISFILE_NOEXT}.dll ${BINDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_VORBISFILE_NOEXT}.dll ${BINDIR}/ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_VORBISFILE_NOEXT}.lib ${LIBDIR}/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/vorbis/vorbisfile.h ${INCDIR}/vorbis/vorbisfile.h - ) - set(TARGET_VORBISFILE_STATIC vorbisfile_static) - ExternalProject_Add(project_${TARGET_VORBISFILE_STATIC} - DEPENDS project_${TARGET_VORBISFILE} - DOWNLOAD_COMMAND "" - SOURCE_DIR ${EP_BASE}/Source/project_${TARGET_VORBIS} - CONFIGURE_COMMAND devenv win32/VS2010/libvorbisfile/libvorbisfile_static.vcxproj /Upgrade - BUILD_COMMAND set CL=/I${INCLUDEDIR_OGG} COMMAND set LINK=/LIBPATH:${LIBDIR_OGG} - COMMAND msbuild win32/VS2010/libvorbisfile/libvorbisfile_static.vcxproj -m /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=${CMAKE_VS_PLATFORM_NAME} /p:PlatformToolset=${CMAKE_VS_PLATFORM_TOOLSET} /p:WindowsTargetPlatformVersion=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION} - BUILD_IN_SOURCE 1 - INSTALL_COMMAND "" #${CMAKE_COMMAND} -E copy_if_different ${LIBFILE_VORBISFILE_NOEXT}_static.lib ${LIBDIR}/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_VORBIS}/vorbis/vorbisfile.h ${INCDIR}/vorbis/vorbisfile.h ) elseif(APPLE) set(FRAMEWORK_DIR_VORBIS ${DESTINATION_PATH}/${TARGET_VORBIS}.framework) - set(DYLIBNAME_VORBIS libvorbis.0.dylib) + set(DYLIBNAME_VORBIS libvorbis.dylib) + set(DYLIBNAME_VERSIONED_VORBIS libvorbis.0.4.9.dylib) set(FRAMEWORK_DIR_VORBISFILE ${DESTINATION_PATH}/${TARGET_VORBISFILE}.framework) - set(DYLIBNAME_VORBISFILE libvorbisfile.3.dylib) + set(DYLIBNAME_VORBISFILE libvorbisfile.dylib) + set(DYLIBNAME_VERSIONED_VORBISFILE libvorbisfile.3.3.8.dylib) ExternalProject_Add(project_${TARGET_VORBIS} DEPENDS project_${TARGET_OGG} URL ${URL_VORBIS} URL_MD5 ${URL_MD5_VORBIS} - CONFIGURE_COMMAND ./configure --with-ogg-libraries=${EP_BASE}/Source/project_${TARGET_OGG}/src/.libs/ --with-ogg-includes=${EP_BASE}/Source/project_${TARGET_OGG}/include/ --enable-oggtest=no --prefix= - BUILD_COMMAND make -j${CPUS} - BUILD_IN_SOURCE 1 + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DOGG_LIBRARY=${EP_BASE}/Build/project_${TARGET_OGG}/${DYLIBNAME_OGG} -DOGG_INCLUDE_DIR=${EP_BASE}/Source/project_${TARGET_OGG}/include ${COMMON_CMAKE_ARGS_VORBIS} + BUILD_COMMAND ${CMAKE_COMMAND} --build . --parallel + BUILD_IN_SOURCE 0 INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_VORBIS}/Versions/A COMMAND ${CMAKE_COMMAND} -E create_symlink A ${FRAMEWORK_DIR_VORBIS}/Versions/Current - COMMAND ${CMAKE_COMMAND} -E copy_if_different lib/.libs/${DYLIBNAME_VORBIS} ${FRAMEWORK_DIR_VORBIS}/Versions/A/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different lib/${DYLIBNAME_VORBIS} ${FRAMEWORK_DIR_VORBIS}/Versions/A/ + COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/${DYLIBNAME_VERSIONED_VORBIS} ${FRAMEWORK_DIR_VORBIS}/${TARGET_VORBIS} COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/${DYLIBNAME_VORBIS} ${FRAMEWORK_DIR_VORBIS}/${TARGET_VORBIS} COMMAND install_name_tool -id "@rpath/${TARGET_VORBIS}.framework/${TARGET_VORBIS}" ${FRAMEWORK_DIR_VORBIS}/${TARGET_VORBIS} COMMAND sh -c "install_name_tool -change $(otool -L ${FRAMEWORK_DIR_VORBIS}/${TARGET_VORBIS} | grep ${DYLIBNAME_OGG} | cut -f2 | cut -d \" \" -f1) \"@rpath/${TARGET_OGG}.framework/${TARGET_OGG}\" ${FRAMEWORK_DIR_VORBIS}/${TARGET_VORBIS}" COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_VORBIS}/Versions/A/Headers/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/vorbis/codec.h ${FRAMEWORK_DIR_VORBIS}/Versions/A/Headers/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/vorbis/vorbisenc.h ${FRAMEWORK_DIR_VORBIS}/Versions/A/Headers/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/vorbis/vorbisfile.h ${FRAMEWORK_DIR_VORBIS}/Versions/A/Headers/ # needed here too + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_VORBIS}/vorbis/codec.h ${FRAMEWORK_DIR_VORBIS}/Versions/A/Headers/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_VORBIS}/vorbis/vorbisenc.h ${FRAMEWORK_DIR_VORBIS}/Versions/A/Headers/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_VORBIS}/vorbis/vorbisfile.h ${FRAMEWORK_DIR_VORBIS}/Versions/A/Headers/ # needed here too COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${FRAMEWORK_DIR_VORBIS}/Headers - COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_VORBIS}/Versions/A/Resources - COMMAND ${CMAKE_COMMAND} -E copy_if_different macosx/English.lproj ${FRAMEWORK_DIR_VORBIS}/Versions/A/Resources/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different macosx/Info.plist ${FRAMEWORK_DIR_VORBIS}/Versions/A/Resources/ - COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Resources ${FRAMEWORK_DIR_VORBIS}/Resources - ) - ExternalProject_Add(project_${TARGET_VORBISFILE} - DEPENDS project_${TARGET_VORBIS} - DOWNLOAD_COMMAND "" # Vorbis project is going to download the archive, but a dummy command is needed - SOURCE_DIR ${EP_BASE}/Source/project_${TARGET_VORBIS} - CONFIGURE_COMMAND "" - BUILD_COMMAND make -j${CPUS} - BUILD_IN_SOURCE 1 - INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_VORBISFILE}/Versions/A + COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_VORBISFILE}/Versions/A COMMAND ${CMAKE_COMMAND} -E create_symlink A ${FRAMEWORK_DIR_VORBISFILE}/Versions/Current - COMMAND ${CMAKE_COMMAND} -E copy_if_different lib/.libs/${DYLIBNAME_VORBISFILE} ${FRAMEWORK_DIR_VORBISFILE}/Versions/A/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different lib/${DYLIBNAME_VERSIONED_VORBISFILE} ${FRAMEWORK_DIR_VORBISFILE}/Versions/A/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different lib/${DYLIBNAME_VORBISFILE} ${FRAMEWORK_DIR_VORBISFILE}/Versions/A/ COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/${DYLIBNAME_VORBISFILE} ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE} COMMAND install_name_tool -id "@rpath/${TARGET_VORBISFILE}.framework/${TARGET_VORBISFILE}" ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE} - COMMAND sh -c "install_name_tool -change $(otool -L ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE} | grep ${DYLIBNAME_VORBIS} | cut -f2 | cut -d ' ' -f1) \"@rpath/${TARGET_VORBIS}.framework/${TARGET_VORBIS}\" ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE}" + COMMAND sh -c "install_name_tool -change $(otool -L ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE} | grep ${DYLIBNAME_VERSIONED_VORBIS} | cut -f2 | cut -d ' ' -f1) \"@rpath/${TARGET_VORBIS}.framework/${TARGET_VORBIS}\" ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE}" COMMAND sh -c "install_name_tool -change $(otool -L ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE} | grep ${DYLIBNAME_OGG} | cut -f2 | cut -d ' ' -f1) \"@rpath/${TARGET_OGG}.framework/${TARGET_OGG}\" ${FRAMEWORK_DIR_VORBISFILE}/${TARGET_VORBISFILE}" COMMAND ${CMAKE_COMMAND} -E make_directory ${FRAMEWORK_DIR_VORBISFILE}/Versions/A/Headers/ - COMMAND ${CMAKE_COMMAND} -E copy_if_different include/vorbis/vorbisfile.h ${FRAMEWORK_DIR_VORBISFILE}/Versions/A/Headers/ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCLUDE_DIR_VORBIS}/vorbis/vorbisfile.h ${FRAMEWORK_DIR_VORBISFILE}/Versions/A/Headers/ COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${FRAMEWORK_DIR_VORBISFILE}/Headers ) elseif(NOT EMSCRIPTEN) + if(MINGW) + set(MINGW_PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/patches/vorbis_mingw.patch) + endif() + ExternalProject_Add(project_${TARGET_VORBIS} DEPENDS project_${TARGET_OGG} URL ${URL_VORBIS} URL_MD5 ${URL_MD5_VORBIS} - CONFIGURE_COMMAND ./configure --with-ogg-libraries=${DESTINATION_PATH}/lib --with-ogg-includes=${DESTINATION_PATH}/include/ --prefix=${DESTINATION_PATH} --exec-prefix=${DESTINATION_PATH} - BUILD_COMMAND make -j${CPUS} - BUILD_IN_SOURCE 1 + PATCH_COMMAND ${MINGW_PATCH_COMMAND} + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DOGG_ROOT=${DESTINATION_PATH} ${COMMON_CMAKE_ARGS_VORBIS} -DCMAKE_INSTALL_PREFIX=${DESTINATION_PATH} + BUILD_COMMAND ${CMAKE_COMMAND} --build . --parallel + BUILD_IN_SOURCE 0 INSTALL_COMMAND make install ) endif() diff --git a/patches/vorbis_mingw.patch b/patches/vorbis_mingw.patch new file mode 100644 index 0000000..d72a9b7 --- /dev/null +++ b/patches/vorbis_mingw.patch @@ -0,0 +1,33 @@ +diff -urN libvorbis-1.3.7.orig/win32/vorbis.def libvorbis-1.3.7/win32/vorbis.def +--- libvorbis-1.3.7.orig/win32/vorbis.def 2020-03-23 16:04:43.000000000 +0100 ++++ libvorbis-1.3.7/win32/vorbis.def 2024-03-03 23:20:43.006801685 +0100 +@@ -1,6 +1,6 @@ + ; vorbis.def + ; +-LIBRARY ++LIBRARY vorbis + EXPORTS + _floor_P + _mapping_P +diff -urN libvorbis-1.3.7.orig/win32/vorbisenc.def libvorbis-1.3.7/win32/vorbisenc.def +--- libvorbis-1.3.7.orig/win32/vorbisenc.def 2020-03-23 16:04:43.000000000 +0100 ++++ libvorbis-1.3.7/win32/vorbisenc.def 2024-03-03 23:20:41.623468396 +0100 +@@ -1,6 +1,6 @@ + ; vorbisenc.def + ; +-LIBRARY ++LIBRARY vorbisenc + + EXPORTS + vorbis_encode_init +diff -urN libvorbis-1.3.7.orig/win32/vorbisfile.def libvorbis-1.3.7/win32/vorbisfile.def +--- libvorbis-1.3.7.orig/win32/vorbisfile.def 2020-03-23 16:04:43.000000000 +0100 ++++ libvorbis-1.3.7/win32/vorbisfile.def 2024-03-03 23:20:31.176802055 +0100 +@@ -1,6 +1,6 @@ + ; vorbisfile.def + ; +-LIBRARY ++LIBRARY vorbisfile + EXPORTS + ov_clear + ov_open