[CMake] Enable building ogg together with flac (#325)
This reverts the part of commit 2013738
that searched for a local
ogg build
This commit is contained in:
parent
1793632ee6
commit
0caf685360
10
.github/workflows/action.yml
vendored
10
.github/workflows/action.yml
vendored
@ -72,7 +72,7 @@ jobs:
|
|||||||
- name: windows-latest-cmake
|
- name: windows-latest-cmake
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
build-system: cmake
|
build-system: cmake
|
||||||
configure-opts: '-DWITH_OGG=OFF'
|
configure-opts: ''
|
||||||
|
|
||||||
- name: ubuntu-latest-gcc-autotools-64-bit-words
|
- name: ubuntu-latest-gcc-autotools-64-bit-words
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
@ -121,8 +121,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
if: startsWith(matrix.build-system,'cmake')
|
||||||
|
with:
|
||||||
|
repository: xiph/ogg
|
||||||
|
path: ./ogg
|
||||||
|
|
||||||
- name: Install MacOS dependencies
|
- name: Install MacOS dependencies
|
||||||
if: startsWith(matrix.os,'macos')
|
if: startsWith(matrix.os,'macos') && !startsWith(matrix.build-system,'cmake')
|
||||||
run: |
|
run: |
|
||||||
brew update
|
brew update
|
||||||
brew install automake pkg-config libogg
|
brew install automake pkg-config libogg
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -75,6 +75,7 @@ test/picture.diff
|
|||||||
test/picture.log
|
test/picture.log
|
||||||
.dirstamp
|
.dirstamp
|
||||||
microbench/benchmark_residual
|
microbench/benchmark_residual
|
||||||
|
/ogg/
|
||||||
oss-fuzz/fuzzer_decoder
|
oss-fuzz/fuzzer_decoder
|
||||||
oss-fuzz/fuzzer_encoder
|
oss-fuzz/fuzzer_encoder
|
||||||
|
|
||||||
|
@ -34,9 +34,18 @@ if(NOT UNIX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WITH_OGG)
|
if(WITH_OGG)
|
||||||
|
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ogg")
|
||||||
|
add_subdirectory("ogg")
|
||||||
|
set(OGG_FOUND 1 CACHE INTERNAL "ogg has been added as subdirectory")
|
||||||
|
set_target_properties(ogg PROPERTIES FOLDER Libraries)
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
set_target_properties(test_bitwise test_framing PROPERTIES FOLDER Tests)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
find_package(Ogg REQUIRED)
|
find_package(Ogg REQUIRED)
|
||||||
set(OGG_PACKAGE "ogg")
|
set(OGG_PACKAGE "ogg")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
find_program (HAVE_GIT git)
|
find_program (HAVE_GIT git)
|
||||||
|
|
||||||
|
69
README
69
README
@ -1,6 +1,6 @@
|
|||||||
/* FLAC - Free Lossless Audio Codec
|
/* FLAC - Free Lossless Audio Codec
|
||||||
* Copyright (C) 2001-2009 Josh Coalson
|
* Copyright (C) 2001-2009 Josh Coalson
|
||||||
* Copyright (C) 2011-2016 Xiph.Org Foundation
|
* Copyright (C) 2011-2022 Xiph.Org Foundation
|
||||||
*
|
*
|
||||||
* This file is part the FLAC project. FLAC is comprised of several
|
* This file is part the FLAC project. FLAC is comprised of several
|
||||||
* components distributed under different licenses. The codec libraries
|
* components distributed under different licenses. The codec libraries
|
||||||
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
|
|
||||||
FLAC is an Open Source lossless audio codec developed by Josh Coalson from 2001
|
FLAC is an Open Source lossless audio codec developed by Josh Coalson from 2001
|
||||||
to 2009. From 2012 to 2021 it was maintained by Erik de Castro Lopo. It continues to be maintained by various volunteers under the auspices of the Xiph.org Foundation.
|
to 2009. From 2012 to 2021 it was maintained by Erik de Castro Lopo. It continues
|
||||||
|
to be maintained by various volunteers under the auspices of the Xiph.org Foundation.
|
||||||
|
|
||||||
FLAC is comprised of
|
FLAC is comprised of
|
||||||
* `libFLAC', a library which implements reference encoders and
|
* `libFLAC', a library which implements reference encoders and
|
||||||
@ -264,74 +265,86 @@ CMake is a cross-platform build system. FLAC can be built on Windows, Linux, Mac
|
|||||||
OS X using CMake.
|
OS X using CMake.
|
||||||
|
|
||||||
You can use either CMake's CLI or GUI. We recommend you to have a separate build
|
You can use either CMake's CLI or GUI. We recommend you to have a separate build
|
||||||
folder outside the repository in order to not spoil it with generated files.
|
folder outside the repository in order to not spoil it with generated files. It is
|
||||||
|
possible however to do a so-called in-tree build, in that case /path/to/flac-build
|
||||||
|
in the following examples is equal to /path/to/flac-source.
|
||||||
|
|
||||||
CLI
|
CLI
|
||||||
---
|
---
|
||||||
Go to your build folder and run something like this:
|
Go to your build folder and run something like this:
|
||||||
|
|
||||||
/path/to/flac/build$ cmake /path/to/flac/source
|
/path/to/flac-build$ cmake /path/to/flac-source
|
||||||
|
|
||||||
or e.g. in Windows shell
|
or e.g. in Windows shell
|
||||||
|
|
||||||
C:\path\to\flac\build> cmake \path\to\flac\source
|
C:\path\to\flac-build> cmake \path\to\flac-source
|
||||||
(provided that cmake is in your %PATH% variable)
|
(provided that cmake is in your %PATH% variable)
|
||||||
|
|
||||||
That will generate build scripts for the default build system (e.g. Makefiles
|
That will generate build scripts for the default build system (e.g. Makefiles
|
||||||
for UNIX). After that you start build with a command like this:
|
for UNIX). After that you start build with a command like this:
|
||||||
|
|
||||||
/path/to/flac/build$ make
|
/path/to/flac-build$ make
|
||||||
|
|
||||||
And afterwards you can run tests or install the built libraries and headers
|
And afterwards you can run tests or install the built libraries and headers
|
||||||
|
|
||||||
/path/to/flac/build$ make test
|
/path/to/flac-build$ make test
|
||||||
/path/to/flac/build$ make install
|
/path/to/flac-build$ make install
|
||||||
|
|
||||||
If you want use a build system other than default add -G flag to cmake, e.g.:
|
If you want use a build system other than default add -G flag to cmake, e.g.:
|
||||||
|
|
||||||
/path/to/flac/build$ cmake /path/to/flac/source -GNinja
|
/path/to/flac-build$ cmake /path/to/flac-source -GNinja
|
||||||
/path/to/flac/build$ ninja
|
/path/to/flac-build$ ninja
|
||||||
|
|
||||||
or:
|
or:
|
||||||
|
|
||||||
/path/to/flac/build$ cmake /path/to/flac/source -GXcode
|
/path/to/flac-build$ cmake /path/to/flac-source -GXcode
|
||||||
|
|
||||||
Use cmake --help to see the list of available generators.
|
Use cmake --help to see the list of available generators.
|
||||||
|
|
||||||
If you have OGG on your system you can tell CMake to use it:
|
By default CMake will search for OGG. If CMake fails to find it you can help
|
||||||
|
CMake by specifying the exact path:
|
||||||
|
|
||||||
/path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=ON
|
/path/to/flac-build$ cmake /path/to/flac-source -DOGG_ROOT=/path/to/ogg
|
||||||
|
|
||||||
If CMake fails to find it you can help CMake by specifying the exact path:
|
If you would like CMake to build OGG alongside FLAC, you can place the ogg
|
||||||
|
sources directly in the flac source directory as a subdirectory with the name
|
||||||
|
ogg, for example
|
||||||
|
|
||||||
/path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=ON -DOGG_ROOT=/path/to/ogg
|
/path/to/flac-source/ogg
|
||||||
|
|
||||||
CMake will search for OGG by default so if you don't have it you can tell
|
If you don't want to build flac with OGG support you can tell CMake not to
|
||||||
cmake to not do so:
|
look for OGG:
|
||||||
|
|
||||||
/path/to/flac/build$ cmake /path/to/flac/source -DWITH_OGG=OFF
|
/path/to/flac-build$ cmake /path/to/flac-source -DWITH_OGG=OFF
|
||||||
|
|
||||||
Other FLAC's options (e.g. building C++ lib or docs) can also be put to cmake
|
Other FLAC's options (e.g. building C++ lib or docs) can also be put to cmake
|
||||||
through -D flag.
|
through -D flag.
|
||||||
|
|
||||||
GUI
|
GUI
|
||||||
---
|
---
|
||||||
It is likely that you would prefer to use it on Windows building for Visual
|
It is likely that you would prefer to use the CMake GUI if you use Visual
|
||||||
Studio. It's in essence the same process as building using CLI.
|
Studio to build FLAC. It's in essence the same process as building using CLI.
|
||||||
|
|
||||||
Open cmake-gui. In the window select a source directory (the repository's
|
Open cmake-gui. In the window select a source directory (the repository's
|
||||||
root), a build directory (some other directory outside the repository). Then
|
root), a build directory (some other directory outside the repository). Then
|
||||||
press button "Configure". CMake will ask you which build system you prefer.
|
press button "Configure". CMake will ask you which build system you prefer.
|
||||||
Choose that version of Visual Studio which you have on your system, choose
|
Choose that version of Visual Studio which you have on your system, choose
|
||||||
whether you want to build for x86 or amd64. Press OK. After CMake finishes
|
whether you want to build for Win32 or x64. Press OK. After CMake finishes
|
||||||
press "Generate" button, and after that "Open Project". In response CMake
|
you can change the configuration to your liking and if you change anything,
|
||||||
will launch Visual Studio and open the generated solution. You can use it as
|
run Configure again. With the "Generate" button, CMake creates Visual Studio
|
||||||
usual but remember that it was generated by CMake. That means that your
|
files, which can be opened from Visual Studio. With the button "Open Project"
|
||||||
changes (e.g. some addidional compile flags) will be lost when you run CMake
|
CMake will launch Visual Studio and open the generated solution. You can use
|
||||||
next time.
|
the project files as usual but remember that they were generated by CMake.
|
||||||
|
That means that your changes (e.g. some additional compile flags) will be
|
||||||
|
lost when you run CMake next time.
|
||||||
|
|
||||||
Again, if you have OGG on your system set WITH_OGG flag in the list of
|
CMake searches by default for OGG on your system and returns an error if it
|
||||||
variables in cmake-gui window before you press "Configure".
|
cannot find it. If you want to build OGG alongside FLAC, you can download the
|
||||||
|
OGG sources and extract them in a subdirectory of the FLAC source directory
|
||||||
|
with the name ogg (i.e. /path/to/flac-source/ogg) before running CMake. If
|
||||||
|
you don't want to build FLAC with OGG support, untick the box following
|
||||||
|
WITH_OGG flag in the list of variables in cmake-gui window and run
|
||||||
|
"Configure" again.
|
||||||
|
|
||||||
If CMake fails to find MSVC compiler then running cmake-gui from MS Developer
|
If CMake fails to find MSVC compiler then running cmake-gui from MS Developer
|
||||||
comand prompt should help.
|
comand prompt should help.
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(_OGG QUIET ogg)
|
pkg_check_modules(_OGG QUIET ogg)
|
||||||
|
|
||||||
file(GLOB _OGG_DIR ../libogg-*)
|
|
||||||
|
|
||||||
find_path(OGG_INCLUDE_DIR
|
find_path(OGG_INCLUDE_DIR
|
||||||
NAMES "ogg/ogg.h"
|
NAMES "ogg/ogg.h"
|
||||||
PATHS ${_OGG_INCLUDE_DIRS}
|
PATHS ${_OGG_INCLUDE_DIRS})
|
||||||
HINTS "${_OGG_DIR}/include")
|
|
||||||
|
|
||||||
find_library(OGG_LIBRARY
|
find_library(OGG_LIBRARY
|
||||||
NAMES ogg libogg
|
NAMES ogg libogg
|
||||||
HINTS ${_OGG_LIBRARY_DIRS}
|
HINTS ${_OGG_LIBRARY_DIRS})
|
||||||
HINTS "${_OGG_DIR}/Release")
|
|
||||||
|
|
||||||
mark_as_advanced(
|
mark_as_advanced(
|
||||||
OGG_INCLUDE_DIR
|
OGG_INCLUDE_DIR
|
||||||
|
Loading…
Reference in New Issue
Block a user