Skip to content

Commit

Permalink
Build libogg and libvorbis with CMake
Browse files Browse the repository at this point in the history
- Run GitHub Actions on both old and updated macOS images
- Update libogg to 1.3.5
- Add a patch to compile libvorbis on MinGW
  • Loading branch information
encelo committed Mar 3, 2024
1 parent 09386ce commit 3a67870
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 110 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ 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'
uses: actions/checkout@v4

- 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: |
Expand All @@ -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
Expand Down
58 changes: 25 additions & 33 deletions cmake/ogg.cmake
Original file line number Diff line number Diff line change
@@ -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()
113 changes: 39 additions & 74 deletions cmake/vorbis.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,123 +5,88 @@ 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)
ExternalProject_Add(project_${TARGET_VORBIS}
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()
Loading

0 comments on commit 3a67870

Please sign in to comment.