You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

344 lines
13 KiB

  1. # Building Tenacity
  2. ## Prerequisites
  3. ### Linux
  4. Most distributions do not package all of Tenacity's dependencies (yet).
  5. wxWidgets 3.1 is suggested for building Tenacity but many distributions only
  6. package wxWidgets 3.0. When 3.0 is used instead of 3.1, the main user visible
  7. known drawback is that a few user interface texts will not be localized, and
  8. the effects of not having various wxWidgets bug fixes that have not been
  9. backported to the stable 3.0 series.
  10. [PortMidi]( and
  11. [PortSMF]( are required for MIDI support
  12. but some distributions do not package PortSMF (Tenacity can still build without
  13. MIDI support). [libsbsms]( is an
  14. optional dependency used for time stretching that is not available in many Linux
  15. distribution package managers either. Optionally,
  16. [vcpkg can be used](#vcpkg-on-Linux) to build dependencies from source which
  17. may be helpful if your distribution is missing some packages.
  18. Installing ccache and ninja-build is highly recommended for faster builds but
  19. not required. CMake will automatically use ccache if it is installed.
  20. #### wxWidgets from source
  21. Where wxWidgets is not provided as a binary package,
  22. a possible way to build and install wxWidgets from source is given by the
  23. following example. After [downloading]( and extracting the
  24. source code into a location, such as `~/Downloads/wxWidgets-3.1.5`, it can be built in a local
  25. directory, such as `~/Downloads/wxWidgets-build`:
  26. ```
  27. cd ~/Downloads
  28. mkdir wxWidgets-build && cd wxWidgets-build # create and go to a new empty build directory
  29. cmake -G Ninja ~/Downloads/wxWidgets-3.1.5 # configure wxWidgets from the assumed download location
  30. cmake --build . # actual compilation
  31. ```
  32. Then to install wxWidgets in the default location, run
  33. ```
  34. sudo cmake --build . --target install
  35. ```
  36. #### Debian, Ubuntu, and derived distributions
  37. To install Tenacity's dependencies, run:
  38. ```
  39. sudo apt-get install build-essential libavcodec-dev libavformat-dev libavutil-dev libflac++-dev libglib2.0-dev libgtk-3-dev libid3tag0-dev libjack-dev liblilv-dev libmad0-dev libmp3lame-dev libogg-dev libpng-dev portaudio19-dev libportmidi-dev libserd-dev libsndfile1-dev libsord-dev libsoundtouch-dev libsoxr-dev libsuil-dev libtwolame-dev vamp-plugin-sdk libvorbis-dev lv2-dev zlib1g-dev cmake ninja-build libjpeg-dev libtiff-dev liblzma-dev libsqlite3-dev
  40. ```
  41. ##### Notes
  42. - The version of PortSMF included in Debian & Ubuntu distributions
  43. (`libportsmf-dev`) is not included in the above list because it is outdated
  44. and using it will cause Tenacity to fail to build. If you want to use MIDI, it
  45. is recommended to use our modified version of
  46. [PortSMF]( that you should build
  47. from source until the packaged version gets updated. If you are installing
  48. PortSMF to any other location than the default location where libraries get
  49. installed (`/usr/local/lib`, `/usr/lib`, etc.) such as your `$HOME` directory,
  50. you should point CMake to it by adding `-DCMAKE_PREFIX_PATH=/path/to/portsmf`
  51. to the CMake configuration step.
  52. - Additionally, if you happen to come across a package conflict involving a
  53. package called `libjack0`, you may need to install `libjack-jack2-dev` instead
  54. of `libjack-dev`.
  55. - wxWidgets 3.1 is suggested but not packaged in Debian or Ubuntu. Refer
  56. to the
  57. [wxWidgets documentation](
  58. for how to install it from source code, or see the [previous section](#wxwidgets-from-source). The above package list
  59. includes wxWidgets' build dependencies. If you install wxWidgets
  60. somewhere other than the default /usr/local, you need to set the
  61. `WX_CONFIG` environment variable to the location of the `wx-config`
  62. script installed by wxWidgets to get CMake to find wxWidgets 3.1. For
  63. example, if you installed wxWidgets to /home/user/local:
  64. ```
  65. export WX_CONFIG=/home/user/local/bin/wx-config
  66. ```
  67. - Alternatively, you may skip installing wxWidgets 3.1 and use 3.0 instead:
  68. ```
  69. sudo apt-get install libwxgtk3.0-dev
  70. ```
  71. #### Fedora
  72. First, if you want to build Tenacity with FFmpeg support, enable the
  73. [RPM Fusion]( free repository if you do not
  74. have enabled already. The nonfree RPM Fusion repository is not
  75. required. If you do not mind building without FFmpeg support,
  76. RPM Fusion is not required and this first step can be skipped (also
  77. remove `ffmpeg-devel` from the end of the package list in the second
  78. step below).
  79. ```
  80. sudo dnf install$(rpm -E %fedora).noarch.rpm
  81. ```
  82. Then install Tenacity's dependencies:
  83. ```
  84. sudo dnf install alsa-lib-devel cmake expat-devel flac-devel gcc-g++ gettext-devel lame-devel libid3tag-devel libmad-devel libogg-devel libsndfile-devel libvorbis-devel lilv-devel lv2-devel portaudio-devel portmidi-devel serd-devel sord-devel soundtouch-devel soxr-devel sqlite-devel sratom-devel suil-devel taglib-devel twolame-devel vamp-plugin-sdk-devel wxGTK-devel zlib-devel ccache ninja-build git ffmpeg-devel
  85. ```
  86. If you use a high DPI screen, the wxWidgets 3.1.4 package in Fedora 34
  87. does not work well for that. You can compile wxWidgets 3.1.5 instead of
  88. using the Fedora package. Refer to the
  89. [wxWidgets documentation](
  90. for details. If you install wxWidgets somewhere other than the default
  91. /usr/local, you need to set the `WX_CONFIG` environment variable to
  92. the location of the `wx-config` script installed by wxWidgets to get
  93. CMake to find wxWidgets 3.1. For example, if you installed wxWidgets to
  94. /home/user/local:
  95. ```
  96. export WX_CONFIG=/home/user/local/bin/wx-config
  97. ```
  98. #### Arch
  99. To use wxWidgets 3.1, install `wxgtk3-dev-light` with your AUR helper of
  100. choice, for example:
  101. ```
  102. paru -S wxgtk3-dev-light
  103. ```
  104. CMake requires explicitly specifying the path to the wx-config script from
  105. this AUR package:
  106. ```
  107. export WX_CONFIG=/usr/bin/wx-config-gtk3-3.1
  108. ```
  109. Alternatively, install `wxgtk3` with pacman to use wxWidgets 3.0, and set
  110. `WX_CONFIG=/usr/bin/wx-config-gtk3`.
  111. Install the rest of the build dependencies from the main Arch repository:
  112. ```
  113. sudo pacman -S cmake ninja ccache expat gcc-libs gdk-pixbuf2 glibc flac gtk3 glib2 libid3tag lilv libmad libogg portaudio portmidi libsndfile libsoxr suil twolame vamp-plugin-sdk libvorbis soundtouch ffmpeg
  114. ```
  115. TODO: add portsmf and sbsms to this package list when those packages are updated.
  116. #### Alpine
  117. The build dependencies for Tenacity and wxWidgets can be found on Alpine's
  118. community repository:
  119. ```
  120. sudo apk add cmake samurai lame-dev libsndfile-dev soxr-dev sqlite-dev portaudio-dev portmidi-dev libid3tag-dev soundtouch-dev libmad-dev ffmpeg-dev
  121. ```
  122. wxWidgets 3.1 is suggested but not packaged in Alpine Linux. Refer to the
  123. [wxWidgets documentation](
  124. for how to install it from source code, and make sure to set
  125. `--disable-xlocale` in the configuration.
  126. To install wxWidgets' dependencies:
  127. ```
  128. sudo apk add gtk+3.0-dev zlib-dev libpng-dev tiff-dev libjpeg-turbo-dev expat-dev
  129. ```
  130. Alternatively, install `wxgtk3-dev` with apk to use wxWidgets 3.0, and set
  131. `WX_CONFIG=/usr/bin/wx-config-gtk3`.
  132. TODO: add portsmf and libsbsms to this package list when aports are accepted.
  133. #### FreeBSD
  134. wxWidgets 3.1.5 is packaged in FreeBSD's repositories. Install it and the rest
  135. of Tenacity's dependencies:
  136. ```
  137. sudo pkg install wx31-gtk3 cmake ninja pkgconf lame libsndfile libsoxr portaudio lv2 lilv suil vamp-plugin-sdk portmidi libid3tag twolame libmad soundtouch ffmpeg
  138. ```
  139. #### vcpkg on Linux
  140. Optionally, you can build dependencies from source using vcpkg, with the
  141. exception of wxWidgets due to
  142. [bugs in vcpkg's wxwidgets package](
  143. vcpkg is not set up to build GTK or GLib either. To use vcpkg for
  144. dependencies, pass `-D VCPKG=ON` to the CMake configure command. You will need
  145. [nasm]( installed to build ffmpeg from vcpkg which you can
  146. install from your distribution's package manager. If you use vcpkg, you need to
  147. set the `WX_CONFIG` environment variable to the path of the wx-config script
  148. installed by wxWidgets. For example, if you installed wxWidgets to /usr/local:
  149. ```
  150. export WX_CONFIG=/usr/local/bin/wx-config
  151. ```
  152. If you switch between system packages and vcpkg, you may need to delete
  153. `CMakeCache.txt` inside your CMake build directory.
  154. ### Windows
  155. Install
  156. [Microsoft Visual Studio](
  157. with the **Desktop development with C++** installation option. Microsoft's ATL/MFC components are also needed to build the application.
  158. Installing [sccache]( is highly recommended
  159. for faster builds but not required. CMake will automatically use sccache if you
  160. have it installed. You can install it from
  161. [Chocolatey](
  162. ```
  163. choco install sccache
  164. ```
  165. Alternatively, if you have a [Rust toolchain
  166. installed](,
  167. you can build sccache from source:
  168. ```
  169. cargo install sccache
  170. ```
  171. Tenacity's dependencies will be built automatically with vcpkg when configuring
  172. CMake. You can turn off vcpkg by passing `-D VCPKG=OFF` to the CMake
  173. configuration command, but then it is up to you to install all of Tenacity's
  174. dependencies.
  175. Note that building the dependencies requires 10 GB of storage space.
  176. ### macOS
  177. Install the Clang C++ compiler and macOS SDK from the Xcode command line tools.
  178. If you have the Xcode IDE installed, you already have the command line tools
  179. too. To install the Xcode command line tools without the Xcode IDE, launch the
  180. Terminal application, and type the following command:
  181. ```
  182. xcode-select --install
  183. ```
  184. Click "Install" on the software update popup window that will appear and wait
  185. for the download and installation to finish.
  186. You will also need to install a few build tools and dependencies, which can be
  187. installed from [Homebrew](
  188. ```
  189. brew install cmake ccache ninja nasm mono wxwidgets
  190. ```
  191. You must set the `WX_CONFIG` environment variable for CMake to find wxWidgets
  192. installed from Homebrew:
  193. ```
  194. export WX_CONFIG=/usr/local/bin/wx-config
  195. ```
  196. The rest of the dependencies will be built automatically with vcpkg when
  197. configuring CMake. You turn off vcpkg by passing `-D VCPKG=OFF` to the CMake
  198. configuration command, but then it is up to you to install all of Tenacity's
  199. dependencies.
  200. ## Building Tenacity
  201. On Windows, run the commands below from the x64 Native Tools Command Prompt. For
  202. other operating systems, run them from a normal shell.
  203. First, download the Tenacity source code:
  204. ```
  205. git clone
  206. cd tenacity
  207. ```
  208. Then, configure CMake. This will take a long time the first time on macOS and
  209. Windows (or if you use `-D VCPKG=ON` on Linux) because vcpkg will compile
  210. itself, then compile Tenacity's dependencies. `-G Ninja` is recommended for
  211. faster builds but not required. Add `-D CMAKE_INSTALL_PREFIX=/some/path` to
  212. change the installation path from the default /usr/local:
  213. ```
  214. cmake -G Ninja -S . -B build
  215. ```
  216. Build Tenacity:
  217. ```
  218. cmake --build build --config Release
  219. ```
  220. Run Tenacity:
  221. ```
  222. build/bin/Release/tenacity
  223. ```
  224. Optionally, install Tenacity:
  225. ```
  226. cmake --install build
  227. ```
  228. ## Build options
  229. These are set with a `-D` prefix, for example `cmake -DLV2=OFF ...`
  230. * **VCPKG** (ON|OFF): whether to use dependencies from vcpkg. ON by default
  231. for Windows and macOS; OFF by default for Linux.
  232. * **VCPKG_ROOT** (file path): path to vcpkg Git repository, defaults to
  233. using the vcpkg submodule in the Tenacity repository
  234. * **SCCACHE** (ON|OFF): whether to use sccache for compiler caching to
  235. speed up rebuilds. ON by default if sccache is installed.
  236. * **CCACHE** (ON|OFF): whether to use ccache for compiler caching to speed
  237. up rebuilds. ON by default if ccache is installed. If sccache and ccache
  238. are both installed, sccache will be prefered.
  239. The following feature options are enabled by default if the required libraries
  240. are found. You may explicitly disable them if you prefer or your distribution
  241. has outdated libraries that do not build with Tenacity.
  242. * **MIDI** (ON|OFF): MIDI support. Requires PortMidi and PortSMF.
  243. * **ID3TAG** (ON|OFF): ID3 tag support for MP3 files. Requires libid3tag.
  244. * **MP3_DECODING** (ON|OFF): MP3 decoding support. Requires libmad.
  245. * **MP2_ENCODING** (ON|OFF): MP2 encoding support. Requires Twolame library.
  246. * **OGG** (ON|OFF): Ogg container format support. Requires libogg.
  247. * **VORBIS** (ON|OFF): Vorbis codec support. Requires libvorbis.
  248. * **FLAC** (ON|OFF): FLAC codec support. Requires libflac and libflac++ C++
  249. bindings.
  250. * **SBSMS** (ON|OFF): SBSMS timestretching support. Requires libsbsms.
  251. * **SOUNDTOUCH** (ON|OFF): SoundTouch timestretching support. Requires
  252. SoundTouch library.
  253. * **FFMPEG** (ON|OFF): Support for a wide variety of codecs with FFmpeg.
  254. Requires FFmpeg libraries.
  255. * **VAMP** (ON|OFF): VAMP plugin hosting support. Requires VAMP host SDK.
  256. * **LV2** (ON|OFF): LV2 plugin hosting support. Requires LV2, lilv, and
  257. suil libraries.
  258. * **VST2** (ON|OFF): VST2 plugin hosting support. Requires GTK with X11
  259. support on non-Apple/Windows.