Merge branch 'blender-v3.0-release'
[blender.git] / build_files / build_environment / CMakeLists.txt
1 # ***** BEGIN GPL LICENSE BLOCK *****
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #
17 # ***** END GPL LICENSE BLOCK *****
18
19 ####################################################################################################
20 #
21 # This is a build system used by platform maintainers to build library dependencies on
22 # Windows, macOS and Linux.
23 #
24 # For users building Blender, we recommend using the precompiled libraries from lib/ on
25 # Windows and macOS, and install_deps.sh on Linux.
26 #
27 # WINDOWS USAGE:
28 #   Don't call this cmake file yourself, use build_deps.cmd
29 #   build_deps 2013 x64 / build_deps 2013 x86
30 #   build_deps 2015 x64 / build_deps 2015 x86
31 #
32 # MAC OS X USAGE:
33 #   Install with homebrew: brew install autoconf automake bison cmake libtool pkg-config yasm
34 #   Additional requirements for macOS arm64: brew install flex
35 #   Run "make deps" from main Blender directory
36 #
37 # LINUX USAGE:
38 #   Install compiler cmake autoconf automake libtool yasm tcl
39 #   Run "make deps" from main Blender directory
40 #
41 ####################################################################################################
42
43 project("BlenderDependencies")
44 cmake_minimum_required(VERSION 3.5)
45
46 include(ExternalProject)
47 include(cmake/check_software.cmake)
48 include(cmake/options.cmake)
49 include(cmake/versions.cmake)
50 include(cmake/download.cmake)
51
52 if(ENABLE_MINGW64)
53   include(cmake/setup_mingw64.cmake)
54 else()
55   set(mingw_LIBDIR ${LIBDIR})
56 endif()
57
58 include(cmake/zlib.cmake)
59 include(cmake/zstd.cmake)
60 include(cmake/openal.cmake)
61 include(cmake/png.cmake)
62 include(cmake/jpeg.cmake)
63 include(cmake/blosc.cmake)
64 include(cmake/pthreads.cmake)
65 include(cmake/openexr.cmake)
66 include(cmake/freetype.cmake)
67 include(cmake/freeglut.cmake)
68 include(cmake/glew.cmake)
69 include(cmake/alembic.cmake)
70 include(cmake/glfw.cmake)
71 include(cmake/clew.cmake)
72 include(cmake/cuew.cmake)
73 include(cmake/opensubdiv.cmake)
74 include(cmake/sdl.cmake)
75 include(cmake/opencollada.cmake)
76 include(cmake/llvm.cmake)
77 if(APPLE)
78   include(cmake/openmp.cmake)
79 endif()
80 if(UNIX)
81   include(cmake/nasm.cmake)
82 endif()
83 include(cmake/openimageio.cmake)
84 include(cmake/tiff.cmake)
85 if(WIN32)
86   include(cmake/flexbison.cmake)
87 elseif(UNIX AND NOT APPLE)
88   include(cmake/flex.cmake)
89 endif()
90 include(cmake/osl.cmake)
91 include(cmake/tbb.cmake)
92 include(cmake/openvdb.cmake)
93 include(cmake/nanovdb.cmake)
94 include(cmake/python.cmake)
95 option(USE_PIP_NUMPY "Install NumPy using pip wheel instead of building from source" OFF)
96 if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64"))
97   set(USE_PIP_NUMPY ON)
98 else()
99   include(cmake/numpy.cmake)
100 endif()
101 include(cmake/python_site_packages.cmake)
102 include(cmake/package_python.cmake)
103 include(cmake/usd.cmake)
104 include(cmake/potrace.cmake)
105 include(cmake/haru.cmake)
106 # Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed.
107 include(cmake/boost.cmake)
108 include(cmake/pugixml.cmake)
109 include(cmake/ispc.cmake)
110 include(cmake/openimagedenoise.cmake)
111 include(cmake/embree.cmake)
112 if(NOT APPLE)
113   include(cmake/xr_openxr.cmake)
114 endif()
115
116 # OpenColorIO and dependencies.
117 include(cmake/expat.cmake)
118 include(cmake/yamlcpp.cmake)
119 include(cmake/opencolorio.cmake)
120
121 if(BLENDER_PLATFORM_ARM)
122   include(cmake/sse2neon.cmake)
123 endif()
124
125 if(WITH_WEBP)
126   include(cmake/webp.cmake)
127 endif()
128
129 if(NOT WIN32 OR ENABLE_MINGW64)
130   include(cmake/gmp.cmake)
131   include(cmake/openjpeg.cmake)
132   if(NOT WIN32 OR BUILD_MODE STREQUAL Release)
133     if(WIN32)
134       include(cmake/zlib_mingw.cmake)
135     endif()
136     include(cmake/lame.cmake)
137     include(cmake/ogg.cmake)
138     include(cmake/vorbis.cmake)
139     include(cmake/theora.cmake)
140     include(cmake/opus.cmake)
141     include(cmake/vpx.cmake)
142     include(cmake/x264.cmake)
143     include(cmake/xvidcore.cmake)
144     include(cmake/ffmpeg.cmake)
145     include(cmake/fftw.cmake)
146     include(cmake/sndfile.cmake)
147     if(WIN32)
148       include(cmake/iconv.cmake)
149     endif()
150     if(UNIX)
151       include(cmake/flac.cmake)
152       include(cmake/xml2.cmake)
153       if(NOT APPLE)
154         include(cmake/spnav.cmake)
155         include(cmake/jemalloc.cmake)
156       endif()
157     endif()
158   endif()
159 endif()
160
161 if(UNIX)
162   include(cmake/bzip2.cmake)
163   include(cmake/ffi.cmake)
164   include(cmake/lzma.cmake)
165   include(cmake/ssl.cmake)
166   include(cmake/sqlite.cmake)
167 endif()
168
169 if(UNIX AND NOT APPLE)
170   include(cmake/libglu.cmake)
171   include(cmake/mesa.cmake)
172   include(cmake/wayland_protocols.cmake)
173 endif()
174
175 include(cmake/harvest.cmake)