• Home
  • Raw
  • Download

Lines Matching +full:cmake +full:- +full:version

11 Erik de Castro Lopo <erikd@mega-nerd.com> aka @erikd. The project was developed
14 After the release of version 1.0.30, @erikd transferred the project to
30 modern CMake based build system. Use of the CMake build system is documented
35 sudo apt install autoconf autogen automake build-essential libasound2-dev \
36 libflac-dev libogg-dev libtool libvorbis-dev libopus-dev pkg-config python
43 brew install autoconf autogen automake flac libogg libtool libvorbis opus pkg-config
49 ./configure --enable-werror
53 ## The CMake build system
55 Although Autotools is the primary and recommended build toolchain, CMake meta
56 build generator is also available. The build process with CMake takes
59 building. CMake can produce Microsoft Visual Studio project and solution files,
60 Unix Makefiles, Xcode projects and [many more](https://cmake.org/cmake/help/latest/manual/cmake-gen…
62 Some IDE support CMake natively or with plugins, check you IDE documentation
67 1. C99-compliant compiler toolchain (tested with GCC, Clang and Visual
69 2. CMake 3.1.3 or newer
74 2. ALSA development package under Linux to build sndfile-play utility
75 3. Sndio development package under BSD to build sndfile-play utility
79 CMake can handle out-of-place builds, enabling several builds from
80 the same source tree, and cross-compilation. The ability to build a directory
87 Then run `cmake` command with directory where CMakeLists.txt script is located
90 cmake ..
93 directory. CMake is smart enough to create Unix makefiles under Linux or Visual
95 [generator](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)
96 with `-G` command line parameter:
98 cmake .. -G"Unix Makefiles"
110 cmake --build .
112 CMake also provides Qt-based cross platform GUI, cmake-gui. Using it is trivial
115 ### Configuring CMake
118 `cmake` command. Some useful system options:
120 * `CMAKE_C_FLAGS` - additional C compiler flags
121 * `CMAKE_BUILD_TYPE` - configuration type, `DEBUG`, `RELEASE`, `RELWITHDEBINFO`
123 * `CMAKE_INSTALL_PREFIX` - build install location, the same as `--prefix` option
128 * `BUILD_SHARED_LIBS` - build shared library (DLL under Windows) when `ON`,
130 * `BUILD_PROGRAMS` - build libsndfile's utilities from `programs/` directory,
132 * `BUILD_EXAMPLES` - build examples, `ON` by default.
133 * `BUILD_TESTING` - build tests. Then you can run tests with `ctest` command,
135 * `ENABLE_EXTERNAL_LIBS` - enable Ogg, Vorbis, FLAC and Opus support. This
137 * `ENABLE_CPU_CLIP` - enable tricky cpu specific clipper. Enabled and set to
139 * `ENABLE_BOW_DOCS` - enable black-on-white documentation theme, `OFF` by
141 * `ENABLE_EXPERIMENTAL` - enable experimental code. Don't use it if you are
143 * `ENABLE_CPACK` - enable [CPack](https://cmake.org/cmake/help/latest/module/CPack.html) support.
145 …ACKAGE_CONFIG` - generate and install [package config file](https://cmake.org/cmake/help/latest/ma…
146 * `INSTALL_PKGCONFIG_MODULE` - generate and install [pkg-config module](https://people.freedesktop.…
147 * `INSTALL_MANPAGES` - install [man pages](https://en.wikipedia.org/wiki/Man_page) for programs. Th…
148 * `ENABLE_STATIC_RUNTIME` - enable static runtime on Windows platform (MSVC and
151 **Note**: For MSVC compiler this option is deprecated for CMake >= 3.15, see
152 policy [CMP0091](https://cmake.org/cmake/help/latest/policy/CMP0091.html).
156 and then disabled again, you need to clear CMake cache (delete CMakeCache.txt).
157 * `ENABLE_COMPATIBLE_LIBSNDFILE_NAME` - set DLL name to `libsndfile-1.dll`
160 DLL name on Windows platform is `libsndfile-1.dll`, because the only way to
163 rules from `sndfile` target. But when you build with CMake using native
166 because you can search library using package manager or CMake's
169 * `ENABLE_SSE2` - add compiler flag to enable SSE2 if required, `ON` by default.
181 * `DISABLE_EXTERNAL_LIBS` - disable Ogg, Vorbis and FLAC support. Replaced by
183 * `DISABLE_CPU_CLIP` - disable tricky cpu specific clipper. Replaced by
185 * `BUILD_STATIC_LIBS` - build static library. Use `BUILD_SHARED_LIBS` instead
187 ### Linking from CMake projects
189 First you need to add `FindOgg.cmake`, `FindVorbis.cmake`, `FindFLAC.cmake` and
190 `FindOpus.cmake` files to some directory inside your CMake project (usually
191 `cmake`) and add it to `CMAKE_MODULE_PATH`:
195 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
212 You can also add version check:
216 `find_package` will report error, if `libsndfile` version is < 1.0.29.
218 You can combine `REQUIRED` and version if you need.
228 … CRT libraries](https://docs.microsoft.com/en-us/cpp/c-runtime-library/c-run-time-library-referenc…
233 C/C++ -> Code Generation -> Runtime Library
235 Dynamic version of system CRT library is defaut and it means that end user needs
239 …"The program can't start because <crt-dll-name>.dll is missing from your computer. Try reinstallin…
244 version of the system CRT library.
246 CMake project will use dynamic system CRT libraries by default, just like
253 If you have CMake >= 3.15 you should use
254 [`CMAKE_MSVC_RUNTIME_LIBRARY`](https://cmake.org/cmake/help/v3.15/variable/CMAKE_MSVC_RUNTIME_LIBRA…
258 cmake .. -D"MultiThreaded$<$<CONFIG:Debug>:Debug>"
261 linking for CMake project: `OFF` or unset (default) for dynamic, and `ON` for
264 cmake .. -DENABLE_STATIC_RUNTIME=ON
276 vcpkg install libogg:x64-windows-static libvorbis:x64-windows-static
277 libflac:x64-windows-static opus:x64-windows-static libogg:x86-windows-static
278 libvorbis:x86-windows-static libflac:x86-windows-static opus:x86-windows-static
280 Then and add this parameter to cmake command line:
282 -DCMAKE_TOOLCHAIN_FILE=<path-to-vcpkg>/scripts/buildsystems/vcpkg.cmake
286 -DVCPKG_TARGET_TRIPLET=x64-windows-static
289 libsndfile library itself. For `*-static` triplets Vcpkg uses
298 [BuildingForAndroid]: https://github.com/libsndfile/libsndfile/blob/master/Building-for-Android.md