forked from rosebudai/OpenRCT2-Web
Remove the need to manually compiled vorbis and ogg for emscripten
This commit is contained in:
1 parent
1a7251d46f
commit
a460aa30da
4 files changed
+8
-36
No files matched your search
@@ -1,6 +1,6 @@
|
||||
FROM docker.io/library/fedora:41 AS builder
|
||||
|
||||
RUN dnf update -y && dnf install -y git cmake make gcc g++ nlohmann-json-devel autoreconf libtool openssl-devel libcurl-devel fontconfig-devel libzip-devel SDL2-devel flac-devel libvorbis-devel zip speexdsp-devel ninja-build
|
||||
RUN dnf update -y && dnf install -y git cmake make gcc g++ nlohmann-json-devel autoreconf libtool openssl-devel libcurl-devel fontconfig-devel libzip-devel SDL2-devel zip speexdsp-devel ninja-build
|
||||
|
||||
WORKDIR /
|
||||
|
||||
|
||||
@@ -29,16 +29,6 @@ build_ext() {
|
||||
cd zlib
|
||||
cd ..
|
||||
fi
|
||||
if [ ! -d "vorbis" ]; then
|
||||
git clone https://gitlab.xiph.org/xiph/vorbis.git --depth 1 --branch v1.3.7
|
||||
cd vorbis
|
||||
cd ..
|
||||
fi
|
||||
if [ ! -d "ogg" ]; then
|
||||
git clone https://gitlab.xiph.org/xiph/ogg.git --depth 1 --branch v1.3.5
|
||||
cd ogg
|
||||
cd ..
|
||||
fi
|
||||
if [ ! -d "$JSON_DIR" ]; then
|
||||
echo "$JSON_DIR does not exist. Set in build_emscripten.sh or install the nlohmann-json headers!"
|
||||
exit 1
|
||||
@@ -79,22 +69,6 @@ build_ext() {
|
||||
emcmake cmake ../ -DZLIB_INCLUDE_DIR="$ZLIB_ROOT" -DZLIB_LIBRARY="$ZLIB_ROOT/libz.a"
|
||||
emmake make zip -j$(nproc)
|
||||
emmake make install
|
||||
cd $START_DIR/ext/
|
||||
|
||||
cd ogg
|
||||
mkdir -p build/
|
||||
cd build/
|
||||
emcmake cmake ../
|
||||
emmake make -j$(nproc)
|
||||
emmake make install
|
||||
cd $START_DIR/ext/
|
||||
|
||||
cd vorbis
|
||||
mkdir -p build/
|
||||
cd build/
|
||||
emcmake cmake ../
|
||||
emmake make -j$(nproc)
|
||||
emmake make install
|
||||
|
||||
cd $START_DIR
|
||||
}
|
||||
|
||||
@@ -13,15 +13,14 @@ option(DISABLE_OPENGL "Disable OpenGL support.")
|
||||
# Third party libraries
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
set(USE_FLAGS "${EMSCRIPTEN_FLAGS}")
|
||||
if (NOT DISABLE_VORBIS)
|
||||
set(USE_FLAGS "${USE_FLAGS} -s USE_VORBIS=1 -s USE_OGG=1")
|
||||
endif ()
|
||||
set(SHARED_FLAGS "-fexceptions")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS} ${SHARED_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${USE_FLAGS} ${SHARED_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_LDFLAGS} --bind ${SHARED_FLAGS}")
|
||||
find_package(SpeexDSP REQUIRED)
|
||||
if (NOT DISABLE_VORBIS)
|
||||
PKG_CHECK_MODULES(OGG REQUIRED IMPORTED_TARGET ogg)
|
||||
PKG_CHECK_MODULES(VORBISFILE REQUIRED IMPORTED_TARGET vorbisfile vorbisenc vorbis)
|
||||
endif ()
|
||||
elseif (MSVC)
|
||||
find_package(SDL2 REQUIRED)
|
||||
find_library(SPEEX_LDFLAGS libspeexdsp)
|
||||
@@ -97,7 +96,7 @@ if (NOT DISABLE_FLAC)
|
||||
endif ()
|
||||
|
||||
if (NOT DISABLE_VORBIS)
|
||||
if (NOT MSVC AND NOT WIN32)
|
||||
if (NOT MSVC AND NOT WIN32 AND NOT CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
target_link_libraries(${PROJECT_NAME} PkgConfig::OGG PkgConfig::VORBISFILE)
|
||||
else ()
|
||||
target_link_libraries(${PROJECT_NAME} ${OGG_LDFLAGS} ${VORBISFILE_LDFLAGS})
|
||||
|
||||
@@ -117,14 +117,13 @@ endif ()
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE ${ICU_INCLUDE_DIR})
|
||||
set(USE_FLAGS "${EMSCRIPTEN_FLAGS}")
|
||||
if (NOT DISABLE_VORBIS)
|
||||
set(USE_FLAGS "${USE_FLAGS} -s USE_VORBIS=1 -s USE_OGG=1")
|
||||
endif ()
|
||||
set(SHARED_FLAGS "-fexceptions")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USE_FLAGS} ${SHARED_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${EMSCRIPTEN_LDFLAGS} --bind ${SHARED_FLAGS}")
|
||||
find_package(SpeexDSP REQUIRED)
|
||||
if (NOT DISABLE_VORBIS)
|
||||
PKG_CHECK_MODULES(OGG REQUIRED IMPORTED_TARGET ogg)
|
||||
PKG_CHECK_MODULES(VORBISFILE REQUIRED IMPORTED_TARGET vorbisfile vorbisenc vorbis)
|
||||
endif ()
|
||||
elseif (MSVC)
|
||||
find_package(png 1.6 REQUIRED)
|
||||
find_package(zlib REQUIRED)
|
||||
|
||||
Reference in new issue
Block a user