!I CL 2033159, 2033542 ce/main_stabilisation -> ce/release_candidate
[CRYENGINE.git] / Tools / CMake / BuildEngine.cmake
blob09e53d397f93f91e44862c894205fb6cf39c75f9
2 #options
4 option(PLUGIN_SCHEMATYC "Enables compilation of the Schematyc plugin (currently Schematyc2.dll)" OFF)
5 option(PLUGIN_SCHEMATYC_EXPERIMENTAL "Enables compilation of the Experimental Schematyc plugin (Schematyc.dll)" ON)
7 option(OPTION_PAKTOOLS "Build .pak encryption tools" OFF)
8 option(OPTION_RC "Include RC in the build" ${WINDOWS})
10 option(OPTION_DOXYGEN_EXAMPLES "Build Doxygen examples with the engine" OFF)
12 if (WINDOWS)
13         option(OPTION_ENABLE_CRASHRPT "Enable CrashRpt crash reporting library" ON)
14 endif()
16 if(NOT ANDROID AND NOT ORBIS)
17         option(OPTION_SCALEFORMHELPER "Use Scaleform Helper" ON)
18 else()
19         set(OPTION_SCALEFORMHELPER ON)
20 endif()
23 if(OPTION_DEDICATED_SERVER)
24         set(OPTION_SCALEFORMHELPER OFF)
25 endif()
28 option(OPTION_DEVELOPER_CONSOLE_IN_RELEASE "Enables the developer console in Release builds" ON)
30 #The remote console is useful in development, but it is a potential security vulnerability, therefore opt-in
31 option(OPTION_REMOTE_CONSOLE "Allows remote console connection" OFF)
33 if(NOT ANDROID) # Unit test is disabled for Android until fully supported
34         if(EXISTS "${SDK_DIR}/googletest_CE_Support")
35                 option(OPTION_UNIT_TEST "Unit Tests" ON)
36         elseif(OPTION_UNIT_TEST)
37                 message(STATUS "Google Test not found in ${SDK_DIR}/googletest_CE_Support - disabling unit tests.")
39                 # Disables the OPTION_UNIT_TEST option but also updates the message in the cache that is then used in the GUI as a tooltip.
40                 set(OPTION_UNIT_TEST OFF CACHE BOOL "OPTION_UNIT_TEST was previously set but Google Test is not available. Check bootstrap settings." FORCE)
41         endif()
42 endif()
44 #Plugins
45 if(WINDOWS)
47         # Oculus SDK 1.40.0 does not compile starting with Visual Studio 2019 16.3.0 (vc142)
48         if (MSVC_VERSION LESS 1923)
49                 if(EXISTS "${SDK_DIR}/OculusSDK")
50                         option(PLUGIN_VR_OCULUS "Oculus support" ON)
51                 else()
52                         option(PLUGIN_VR_OCULUS "Oculus support" OFF)
53                 endif()
54         else()
55                 message(WARNING "Disabling Oculus VR Plugin because Oculus SDK 1.40.0 does not compile starting with Visual Studio 2019 16.3.0 (vc142)")
56                 unset(PLUGIN_VR_OCULUS CACHE)
57         endif()
59         option(OPTION_CRYMONO "C# support" OFF)
61         if (OPTION_CRYMONO)
62                 option(OPTION_CRYMONO_SWIG "Expose C++ API to C# with SWIG" ON)
63         endif()
64         if(EXISTS "${SDK_DIR}/OSVR")
65                 option(PLUGIN_VR_OSVR "OSVR support" ON)
66         else()
67                 option(PLUGIN_VR_OSVR "OSVR support" OFF)
68         endif()
70         option(OPTION_PHYSDBGR "Include standalone physics debugger in the build" OFF)
71 endif()
74 if(WINDOWS)
75         option(PLUGIN_VR_EMULATOR "VR emulation support" ON)
76 endif()
79 if(WINDOWS OR LINUX)
80         option(PLUGIN_USERANALYTICS "Enable User Analytics" ON)
81         if(EXISTS "${SDK_DIR}/OpenVR")
82                 option(PLUGIN_VR_OPENVR "OpenVR support" ON)
83         else()
84                 option(PLUGIN_VR_OPENVR "OpenVR support" OFF)
85         endif()
86 endif()
88 option(OPTION_UNSIGNED_PAKS_IN_RELEASE "Allow unsigned PAK files to be used for release builds" ON)
90 if(WINDOWS AND EXISTS "${CRYENGINE_DIR}/Code/Sandbox/EditorQt")
91         option(OPTION_SANDBOX "Enable Sandbox" ON)
92         if (EXISTS "${SDK_DIR}/SubstanceEngines")
93                 option(OPTION_SANDBOX_SUBSTANCE "Enable Sandbox Substance Integration" ON)
94         endif()
95         if(NOT OPTION_SANDBOX AND OPTION_SANDBOX_SUBSTANCE)
96                 set(OPTION_SANDBOX_SUBSTANCE OFF)
97         endif()
98 endif()
100 if(WINDOWS)
101         option(OPTION_ENABLE_BROFILER "Enable Brofiler profiler support" ON)
102 endif()
104 #Renderer modules
105 if(NOT (ORBIS OR ANDROID OR LINUX))
106         option(RENDERER_DX11 "Renderer for DirectX 11" ON)
107 endif()
109 if (WINDOWS)
110         if (MSVC_VERSION LESS 1900)
111                 message(STATUS "MSVC 14.0 or above is required to build CryRenderD3D12.")
112         else()
113                 option(RENDERER_DX12 "Renderer for DirectX 12" ON)
114         endif()
115 endif()
117 if(ORBIS)
118         set(RENDERER_GNM ON) # TODO: remove after cleanup
119         option(GNM_VALIDATION "Enable GNM validation" ON)
120 endif()
122 if(WINDOWS OR LINUX OR ANDROID)
123         option(RENDERER_VULKAN "Renderer for Vulkan API" ON)
124         if (RENDERER_VULKAN AND NOT EXISTS "${SDK_DIR}/VulkanSDK")
125                 message(STATUS "Vulkan SDK not found in ${SDK_DIR}/VulkanSDK - disabling Vulkan renderer.")
127                 # Disables the RENDERER_VULKAN option but also updates the message in the cache that is then used in the GUI as a tooltip.
128                 set(RENDERER_VULKAN OFF CACHE BOOL "Disabled Vulkan renderer due to absent Vulkan SDK. Must reside in ${SDK_DIR}/VulkanSDK" FORCE)
129         endif()
130 endif()
132 # Audio
133 # Occlusion is enabled by default
134 option(AUDIO_USE_OCCLUSION "Enable" ON)
136 function(try_to_enable_fmod)
137 if (NOT ORBIS)
138         if (DEFINED AUDIO_FMOD)
139                 if (AUDIO_FMOD)
140                         if (EXISTS "${SDK_DIR}/Audio/fmod")
141                                 message(STATUS "Fmod SDK found in ${SDK_DIR}/Audio/fmod - enabling Fmod support.")
142                                 
143                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
144                                 option(AUDIO_FMOD "Fmod SDK found in ${SDK_DIR}/Audio/fmod." ON)
145                                 
146                                 include(${TOOLS_CMAKE_DIR}/modules/fmod.cmake)
147                         else()
148                                 message(STATUS "Fmod SDK not found in ${SDK_DIR}/Audio/fmod - disabling Fmod support.")
149                                 
150                                 # Disables the AUDIO_FMOD option but also updates the message in the cache that is then used in the GUI as a tooltip.
151                                 option(AUDIO_FMOD "Fmod SDK not found in ${SDK_DIR}/Audio/fmod." OFF)
152                         endif()
153                 else()
154                         if (EXISTS "${SDK_DIR}/Audio/fmod")
155                                 message(STATUS "Fmod SDK found in ${SDK_DIR}/Audio/fmod but AUDIO_FMOD option turned OFF")
156                                 
157                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
158                                 option(AUDIO_FMOD "Fmod SDK found in ${SDK_DIR}/Audio/fmod but AUDIO_FMOD option turned OFF." OFF)
159                         else()
160                                 message(STATUS "Fmod SDK not found in ${SDK_DIR}/Audio/fmod and AUDIO_FMOD option turned OFF")
161                                 
162                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
163                                 option(AUDIO_FMOD "Fmod SDK not found in ${SDK_DIR}/Audio/fmod and AUDIO_FMOD option turned OFF." OFF)
164                         endif()
165                 endif()
166         else()
167                 # If this option is not in the cache yet, set it depending on whether the SDK is present or not.
168                 if (EXISTS "${SDK_DIR}/Audio/fmod")
169                         message(STATUS "Fmod SDK found in ${SDK_DIR}/Audio/fmod - enabling Fmod support.")
170                         set(AUDIO_FMOD ON CACHE BOOL "Fmod SDK found in ${SDK_DIR}/Audio/fmod." FORCE)
171                         include(${TOOLS_CMAKE_DIR}/modules/fmod.cmake)
172                 else()
173                         message(STATUS "Fmod SDK not found in ${SDK_DIR}/Audio/fmod - disabling Fmod support.")
174                         set(AUDIO_FMOD OFF CACHE BOOL "Fmod SDK not found in ${SDK_DIR}/Audio/fmod." FORCE)
175                 endif()
176         endif()
177 else()
178         message(STATUS "Disabling Fmod support due to unsupported platform.")
179         set(AUDIO_FMOD OFF CACHE BOOL "Fmod disabled due to unsupported platform." FORCE)
180 endif()
181 endfunction(try_to_enable_fmod)
183 function(try_to_enable_portaudio)
184 if (WINDOWS)
185         if (DEFINED AUDIO_PORTAUDIO)
186                 if (AUDIO_PORTAUDIO)
187                         if (EXISTS "${SDK_DIR}/Audio/portaudio" AND EXISTS "${SDK_DIR}/Audio/libsndfile")
188                                 message(STATUS "PortAudio and libsndfile SDKs found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile - enabling PortAudio support.")
189                                 
190                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
191                                 option(AUDIO_PORTAUDIO "PortAudio and libsndfile SDKs found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile." ON)
192                                 
193                                 include(${TOOLS_CMAKE_DIR}/modules/PortAudio.cmake)
194                         else()
195                                 message(STATUS "PortAudio or libsndfile SDK not found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile - disabling PortAudio support.")
196                                 
197                                 # Disables the AUDIO_PORTAUDIO option but also updates the message in the cache that is then used in the GUI as a tooltip.
198                                 option(AUDIO_PORTAUDIO "PortAudio or libsndfile SDK not found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile." OFF)
199                         endif()
200                 else()
201                         if (EXISTS "${SDK_DIR}/Audio/portaudio" AND EXISTS "${SDK_DIR}/Audio/libsndfile")
202                                 message(STATUS "PortAudio and libsndfile SDKs found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile but AUDIO_PORTAUDIO option turned OFF")
203                                 
204                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
205                                 option(AUDIO_PORTAUDIO "PortAudio and libsndfile SDKs found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile but AUDIO_PORTAUDIO option turned OFF." OFF)
206                         else()
207                                 message(STATUS "PortAudio or libsndfile SDK not found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile and AUDIO_PORTAUDIO option turned OFF")
208                                 
209                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
210                                 option(AUDIO_PORTAUDIO "PortAudio or libsndfile SDK not found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile and AUDIO_PORTAUDIO option turned OFF." OFF)
211                         endif()
212                 endif()
213         else()
214                 # If this option is not in the cache yet, set it depending on whether the SDK is present or not.
215                 if (EXISTS "${SDK_DIR}/Audio/portaudio" AND EXISTS "${SDK_DIR}/Audio/libsndfile")
216                         message(STATUS "PortAudio and libsndfile SDKs found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile - enabling PortAudio support.")
217                         set(AUDIO_PORTAUDIO ON CACHE BOOL "PortAudio and libsndfile SDKs found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile." FORCE)
218                         include(${TOOLS_CMAKE_DIR}/modules/PortAudio.cmake)
219                 else()
220                         message(STATUS "PortAudio or libsndfile SDK not found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile - disabling PortAudio support.")
221                         set(AUDIO_PORTAUDIO OFF CACHE BOOL "PortAudio or libsndfile SDK not found in ${SDK_DIR}/Audio/portaudio and ${SDK_DIR}/Audio/libsndfile." FORCE)
222                 endif()
223         endif()
224 else()
225         message(STATUS "Disabling PortAudio support due to unsupported platform.")
226         set(AUDIO_PORTAUDIO OFF CACHE BOOL "PortAudio disabled due to unsupported platform." FORCE)
227 endif()
228 endfunction(try_to_enable_portaudio)
230 function(try_to_enable_sdl_mixer)
231 if (LINUX OR ANDROID OR WINDOWS)
232         # We build SDL_mixer ourselves for these platforms.
233         option(AUDIO_SDL_MIXER "SDL_mixer support" ON)
234         
235         if (AUDIO_SDL_MIXER)
236                 # Supported platforms and the user enabled the AUDIO_SDL_MIXER option.
237                 message(STATUS "Enabling SDL_mixer support.")
238         else()
239                 # Supported platforms but the user disabled the AUDIO_SDL_MIXER option.
240                 message(STATUS "SDL_mixer support manually disabled.")
241         endif()
242 else()
243         message(STATUS "Disabling SDL_mixer support due to unsupported platform.")
244         set(AUDIO_SDL_MIXER OFF CACHE BOOL "SDL_mixer disabled due to unsupported platform." FORCE)
245 endif()
246 endfunction(try_to_enable_sdl_mixer)
248 function(try_to_enable_wwise)
249 if (DEFINED AUDIO_WWISE)
250         if (AUDIO_WWISE)
251                 if (EXISTS "${SDK_DIR}/Audio/wwise")
252                         message(STATUS "Wwise SDK found in ${SDK_DIR}/Audio/wwise - enabling Wwise support.")
253                         
254                         # This is to update only the message in the cache that is then used in the GUI as a tooltip.
255                         option(AUDIO_WWISE "Wwise SDK found in ${SDK_DIR}/Audio/wwise." ON)
256                 else()
257                         message(STATUS "Wwise SDK not found in ${SDK_DIR}/Audio/wwise - disabling Wwise support.")
258                         
259                         # Disables the AUDIO_WWISE option but also updates the message in the cache that is then used in the GUI as a tooltip.
260                         option(AUDIO_WWISE "Wwise SDK not found in ${SDK_DIR}/Audio/wwise." OFF)
261                 endif()
262         else()
263                 if (EXISTS "${SDK_DIR}/Audio/wwise")
264                         message(STATUS "Wwise SDK found in ${SDK_DIR}/Audio/wwise but AUDIO_WWISE option turned OFF")
265                         
266                         # This is to update only the message in the cache that is then used in the GUI as a tooltip.
267                         option(AUDIO_WWISE "Wwise SDK found in ${SDK_DIR}/Audio/wwise but AUDIO_WWISE option turned OFF." OFF)
268                 else()
269                         message(STATUS "Wwise SDK not found in ${SDK_DIR}/Audio/wwise and AUDIO_WWISE option turned OFF")
270                         
271                         # This is to update only the message in the cache that is then used in the GUI as a tooltip.
272                         option(AUDIO_WWISE "Wwise SDK not found in ${SDK_DIR}/Audio/wwise and AUDIO_WWISE option turned OFF." OFF)
273                 endif()
274         endif()
275 else()
276         # If this option is not in the cache yet, set it depending on whether the SDK is present or not.
277         if (EXISTS "${SDK_DIR}/Audio/wwise")
278                 message(STATUS "Wwise SDK found in ${SDK_DIR}/Audio/wwise - enabling Wwise support.")
279                 set(AUDIO_WWISE ON CACHE BOOL "Wwise SDK found in ${SDK_DIR}/Audio/wwise." FORCE)
280         else()
281                 message(STATUS "Wwise SDK not found in ${SDK_DIR}/Audio/wwise - disabling Wwise support.")
282                 set(AUDIO_WWISE OFF CACHE BOOL "Wwise SDK not found in ${SDK_DIR}/Audio/wwise." FORCE)
283         endif()
284 endif()
285 endfunction(try_to_enable_wwise)
287 function(try_to_enable_adx2)
288 if (WINDOWS)
289         if (DEFINED AUDIO_ADX2)
290                 if (AUDIO_ADX2)
291                         if (EXISTS "${SDK_DIR}/Audio/adx2")
292                                 message(STATUS "ADX2 SDK found in ${SDK_DIR}/Audio/adx2 - enabling ADX2 support.")
293                                 
294                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
295                                 option(AUDIO_ADX2 "ADX2 SDK found in ${SDK_DIR}/Audio/adx2." ON)
296                         else()
297                                 message(STATUS "ADX2 SDK not found in ${SDK_DIR}/Audio/adx2 - disabling ADX2 support.")
298                                 
299                                 # Disables the AUDIO_ADX2 option but also updates the message in the cache that is then used in the GUI as a tooltip.
300                                 option(AUDIO_ADX2 "ADX2 SDK not found in ${SDK_DIR}/Audio/adx2." OFF)
301                         endif()
302                 else()
303                         if (EXISTS "${SDK_DIR}/Audio/adx2")
304                                 message(STATUS "ADX2 SDK found in ${SDK_DIR}/Audio/adx2 but AUDIO_ADX2 option turned OFF")
305                                 
306                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
307                                 option(AUDIO_ADX2 "ADX2 SDK found in ${SDK_DIR}/Audio/adx2 but AUDIO_ADX2 option turned OFF." OFF)
308                         else()
309                                 message(STATUS "ADX2 SDK not found in ${SDK_DIR}/Audio/adx2 and AUDIO_ADX2 option turned OFF")
310                                 
311                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
312                                 option(AUDIO_ADX2 "ADX2 SDK not found in ${SDK_DIR}/Audio/adx2 and AUDIO_ADX2 option turned OFF." OFF)
313                         endif()
314                 endif()
315         else()
316                 # If this option is not in the cache yet, set it depending on whether the SDK is present or not.
317                 if (EXISTS "${SDK_DIR}/Audio/adx2")
318                         message(STATUS "ADX2 SDK found in ${SDK_DIR}/Audio/adx2 - enabling ADX2 support.")
319                         set(AUDIO_ADX2 ON CACHE BOOL "ADX2 SDK found in ${SDK_DIR}/Audio/adx2." FORCE)
320                 else()
321                         message(STATUS "ADX2 SDK not found in ${SDK_DIR}/Audio/adx2 - disabling ADX2 support.")
322                         set(AUDIO_ADX2 OFF CACHE BOOL "ADX2 SDK not found in ${SDK_DIR}/Audio/adx2." FORCE)
323                 endif()
324         endif()
325 else()
326         message(STATUS "Disabling ADX2 support due to unsupported platform.")
327         set(AUDIO_ADX2 OFF CACHE BOOL "ADX2 disabled due to unsupported platform." FORCE)
328 endif()
329 endfunction(try_to_enable_adx2)
331 function(try_to_enable_oculus_hrtf)
332 if(WINDOWS)
333         if (DEFINED AUDIO_OCULUS_HRTF)
334                 if (AUDIO_OCULUS_HRTF)
335                         if (EXISTS "${SDK_DIR}/Audio/oculus")
336                                 message(STATUS "Oculus audio SDK found in ${SDK_DIR}/Audio/oculus - enabling Oculus HRTF support.")
337                                 
338                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
339                                 option(AUDIO_OCULUS_HRTF "Oculus audio SDK found in ${SDK_DIR}/Audio/oculus." ON)
340                         else()
341                                 message(STATUS "Oculus audio SDK not found in ${SDK_DIR}/Audio/oculus - disabling Oculus HRTF support.")
342                                 
343                                 # Disables the AUDIO_OCULUS_HRTF option but also updates the message in the cache that is then used in the GUI as a tooltip.
344                                 option(AUDIO_OCULUS_HRTF "Oculus audio SDK not found in ${SDK_DIR}/Audio/oculus." OFF)
345                         endif()
346                 else()
347                         if (EXISTS "${SDK_DIR}/Audio/oculus")
348                                 message(STATUS "Oculus audio SDK found in ${SDK_DIR}/Audio/oculus but AUDIO_OCULUS_HRTF option turned OFF")
349                                 
350                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
351                                 option(AUDIO_OCULUS_HRTF "Oculus audio SDK found in ${SDK_DIR}/Audio/oculus but AUDIO_OCULUS_HRTF option turned OFF." OFF)
352                         else()
353                                 message(STATUS "Oculus audio SDK not found in ${SDK_DIR}/Audio/oculus and AUDIO_OCULUS_HRTF option turned OFF")
354                                 
355                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
356                                 option(AUDIO_OCULUS_HRTF "Oculus audio SDK not found in ${SDK_DIR}/Audio/oculus and AUDIO_OCULUS_HRTF option turned OFF." OFF)
357                         endif()
358                 endif()
359         else()
360                 # If this option is not in the cache yet, set it depending on whether the SDK is present or not.
361                 if (EXISTS "${SDK_DIR}/Audio/oculus")
362                         message(STATUS "Oculus audio SDK found in ${SDK_DIR}/Audio/oculus - enabling Oculus HRTF support.")
363                         set(AUDIO_OCULUS_HRTF ON CACHE BOOL "Oculus audio SDK found in ${SDK_DIR}/Audio/oculus." FORCE)
364                 else()
365                         message(STATUS "Oculus audio SDK not found in ${SDK_DIR}/Audio/oculus - disabling Oculus HRTF support.")
366                         set(AUDIO_OCULUS_HRTF OFF CACHE BOOL "Oculus audio SDK not found in ${SDK_DIR}/Audio/oculus." FORCE)
367                 endif()
368         endif()
369 else()
370         message(STATUS "Disabling Oculus HRTF support due to unsupported platform.")
371         set(AUDIO_OCULUS_HRTF OFF CACHE BOOL "Oculus HRTF disabled due to unsupported platform." FORCE)
372 endif()
373 endfunction(try_to_enable_oculus_hrtf)
375 function(try_to_enable_cryspatial)
376 if(WINDOWS OR DURANGO)
377         if (DEFINED AUDIO_CRYSPATIAL)
378                 if (AUDIO_CRYSPATIAL)
379                         if (EXISTS "${SDK_DIR}/Audio/cryspatial")
380                                 message(STATUS "CrySpatial audio SDK found in ${SDK_DIR}/Audio/cryspatial - enabling CrySpatial HRTF support.")
381                                 
382                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
383                                 option(AUDIO_CRYSPATIAL "CrySpatial audio SDK found in ${SDK_DIR}/Audio/cryspatial." ON)
384                         else()
385                                 message(STATUS "CrySpatial audio SDK not found in ${SDK_DIR}/Audio/cryspatial - disabling CrySpatial HRTF support.")
386                                 
387                                 # Disables the AUDIO_CRYSPATIAL option but also updates the message in the cache that is then used in the GUI as a tooltip.
388                                 option(AUDIO_CRYSPATIAL "CrySpatial audio SDK not found in ${SDK_DIR}/Audio/cryspatial." OFF)
389                         endif()
390                 else()
391                         if (EXISTS "${SDK_DIR}/Audio/cryspatial")
392                                 message(STATUS "CrySpatial audio SDK found in ${SDK_DIR}/Audio/cryspatial but AUDIO_CRYSPATIAL option turned OFF")
393                                 
394                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
395                                 option(AUDIO_CRYSPATIAL "CrySpatial audio SDK found in ${SDK_DIR}/Audio/cryspatial but AUDIO_CRYSPATIAL option turned OFF." OFF)
396                         else()
397                                 message(STATUS "CrySpatial audio SDK not found in ${SDK_DIR}/Audio/cryspatial and AUDIO_CRYSPATIAL option turned OFF")
398                                 
399                                 # This is to update only the message in the cache that is then used in the GUI as a tooltip.
400                                 option(AUDIO_CRYSPATIAL "CrySpatial audio SDK not found in ${SDK_DIR}/Audio/cryspatial and AUDIO_CRYSPATIAL option turned OFF." OFF)
401                         endif()
402                 endif()
403         else()
404                 # If this option is not in the cache yet, set it depending on whether the SDK is present or not.
405                 if (EXISTS "${SDK_DIR}/Audio/cryspatial")
406                         message(STATUS "CrySpatial audio SDK found in ${SDK_DIR}/Audio/cryspatial - enabling CrySpatial HRTF support.")
407                         set(AUDIO_CRYSPATIAL ON CACHE BOOL "CrySpatial audio SDK found in ${SDK_DIR}/Audio/cryspatial." FORCE)
408                 else()
409                         message(STATUS "CrySpatial audio SDK not found in ${SDK_DIR}/Audio/cryspatial - disabling CrySpatial HRTF support.")
410                         set(AUDIO_CRYSPATIAL OFF CACHE BOOL "CrySpatial audio SDK not found in ${SDK_DIR}/Audio/cryspatial." FORCE)
411                 endif()
412         endif()
413 else()
414         message(STATUS "Disabling CrySpatial HRTF support due to unsupported platform.")
415         set(AUDIO_CRYSPATIAL OFF CACHE BOOL "CrySpatial HRTF disabled due to unsupported platform." FORCE)
416 endif()
417 endfunction(try_to_enable_cryspatial)
419 try_to_enable_fmod()
420 try_to_enable_portaudio()
421 try_to_enable_sdl_mixer()
422 try_to_enable_wwise()
423 try_to_enable_adx2()
424 try_to_enable_oculus_hrtf()
425 try_to_enable_cryspatial()
426 # ~Audio
428 #Physics modules
429 option(PHYSICS_CRYPHYSICS "Enable" ON)
430 if (WINDOWS)
431         option(PHYSICS_PHYSX "Enable" OFF)
432 endif()
433 if (PHYSICS_PHYSX)
434         include("${TOOLS_CMAKE_DIR}/modules/PhysX.cmake")
435 endif()
437 include_directories("${CRYENGINE_DIR}/Code/CryEngine/CryCommon")
438 include_directories("${CRYENGINE_DIR}/Code/CryEngine/CryCommon/3rdParty")
439 include_directories("${SDK_DIR}/boost")
440 include_directories("${CRYENGINE_DIR}/Code/CryEngine/CrySchematyc/Core/Interface")
442 #if (WINDOWS)
443 #       link_libraries (Ntdll)
444 #endif (WINDOWS)
446 if (OPTION_SCALEFORMHELPER AND NOT (OPTION_ENGINE OR OPTION_SHADERCACHEGEN))
447         add_subdirectory ("Code/CryEngine/CrySystem/Scaleform")
448 endif()
450 if (OPTION_ENGINE OR OPTION_SHADERCACHEGEN OR OPTION_DOXYGEN_EXAMPLES)
451         add_subdirectory ("Code/CryEngine/CryCommon")
452 endif()
453         
454 if (OPTION_ENGINE OR OPTION_SHADERCACHEGEN)
455         add_subdirectory ("Code/CryEngine/CrySystem")
456         add_subdirectory ("Code/CryEngine/RenderDll/XRenderD3D9")
457         
458         # Shaders custom project
459         if(EXISTS "${CRYENGINE_DIR}/Engine/Shaders")
460                 add_subdirectory(Engine/Shaders)
461         endif()
462 endif()
464 #engine
465 if (OPTION_ENGINE)
466         add_subdirectory ("Code/CryEngine/Cry3DEngine")
467         add_subdirectory ("Code/CryEngine/CryAction")
468         add_subdirectory ("Code/CryEngine/CryAISystem")
469         add_subdirectory ("Code/CryEngine/CryAnimation")
470         add_subdirectory ("Code/CryEngine/CryAudioSystem/Common")
471         add_subdirectory ("Code/CryEngine/CryAudioSystem")
472         add_subdirectory ("Code/CryEngine/CryDynamicResponseSystem")
473         add_subdirectory ("Code/CryEngine/CryEntitySystem")
474         add_subdirectory ("Code/CryEngine/CryFont")
475         add_subdirectory ("Code/CryEngine/CryInput")
476         add_subdirectory ("Code/CryEngine/CryMovie")
477         add_subdirectory ("Code/CryEngine/CryNetwork")
478         if (PLUGIN_SCHEMATYC_EXPERIMENTAL)
479                 target_compile_definitions(CrySystem PUBLIC USE_SCHEMATYC_EXPERIMENTAL=1)
480                 if (TARGET CrySystemLib)
481                         target_compile_definitions(CrySystemLib PUBLIC USE_SCHEMATYC_EXPERIMENTAL=1)
482                 endif()
483                 add_subdirectory ("Code/CryEngine/CrySchematyc")
484         endif()
486         if (NOT ANDROID AND PLUGIN_SCHEMATYC)
487                 target_compile_definitions(CrySystem PUBLIC USE_SCHEMATYC=1)
488                 if (TARGET CrySystemLib)
489                         target_compile_definitions(CrySystemLib PUBLIC USE_SCHEMATYC=1)
490                 endif()
491                 add_subdirectory ("Code/CryEngine/CrySchematyc2")
492         endif()
493         add_subdirectory ("Code/CryEngine/CryScriptSystem")
494         add_subdirectory ("Code/CryEngine/CryFlowGraph")
495         add_subdirectory ("Code/CryEngine/CryUDR")
497         if (WINDOWS)
498                 add_subdirectory ("Code/CryEngine/CryLiveCreate")
499         endif (WINDOWS)
501         #mono
502         if (OPTION_CRYMONO)
503                 target_compile_definitions(CrySystem PUBLIC USE_MONO=1)
504                 if (TARGET CrySystemLib)
505                         target_compile_definitions(CrySystemLib PUBLIC USE_MONO=1)
506                 endif()
507         endif()
509         #physics
510         if (PHYSICS_CRYPHYSICS)
511                 add_subdirectory ("Code/CryEngine/CryPhysics")
512         endif()
513         if (PHYSICS_PHYSX)
514                 add_subdirectory ("Code/CryEngine/CryPhysicsSystem/CryPhysX")
515         endif()
517         #audio
518         if (AUDIO_FMOD)
519                 add_subdirectory ("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplFmod")
520         endif (AUDIO_FMOD)
521         if (AUDIO_PORTAUDIO)
522                 add_subdirectory ("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplPortAudio")
523         endif (AUDIO_PORTAUDIO)
524         if (AUDIO_SDL_MIXER)
525                 add_subdirectory ("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplSDLMixer")
526                 add_subdirectory ("Code/Libs/libmikmod")
527                 add_subdirectory ("Code/Libs/libmodplug")
528                 add_subdirectory ("Code/Libs/libogg")
529                 add_subdirectory ("Code/Libs/libvorbis")
530                 add_subdirectory ("Code/Libs/SDL_mixer")
531                 add_subdirectory ("Code/Libs/smpeg")
532         endif (AUDIO_SDL_MIXER)
533         if (AUDIO_WWISE)
534                 add_subdirectory ("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplWwise")
535         endif (AUDIO_WWISE)
536         if (AUDIO_CRYSPATIAL)
537                 add_subdirectory("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplWwise/plugins/CrySpatial/WwisePlugin")
538                 add_subdirectory("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplWwise/plugins/CrySpatial/SoundEnginePlugin")
539                 add_subdirectory("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplFmod/plugins/CrySpatial")
540         endif()
541         if (AUDIO_ADX2)
542                 add_subdirectory ("Code/CryEngine/CryAudioSystem/implementations/CryAudioImplAdx2")
543         endif (AUDIO_ADX2)
545         #libs
546         add_subdirectory ("Code/Libs/bigdigits")
547         add_subdirectory ("Code/Libs/mikkelsen")
548         
549         if(PLUGIN_VR_OCULUS)
550                 add_subdirectory("Code/Libs/oculus")
551         endif()
552                 
553         if (WINDOWS OR LINUX)
554                 add_subdirectory ("Code/Libs/curl")
555         endif ()
556         add_subdirectory ("Code/Libs/freetype")
557         add_subdirectory ("Code/Libs/lua")
559     if (OPTION_UNIT_TEST)
560             set(TEST_MODULES "" CACHE INTERNAL "List of test modules being built" FORCE)        
561         set(temp ${BUILD_SHARED_LIBS})
562         set(gtest_force_shared_crt TRUE CACHE INTERNAL "" FORCE)
563         set(BUILD_SHARED_LIBS FALSE CACHE INTERNAL "" FORCE)
564         set(INSTALL_GTEST FALSE CACHE INTERNAL "" FORCE)
565         set(INSTALL_GMOCK FALSE CACHE INTERNAL "" FORCE)
566             if(ORBIS)
567                     set(MSVC_TEMP ${MSVC})
568                     set(MSVC FALSE)
569             endif()
570             add_subdirectory ("${SDK_DIR}/googletest_CE_Support")
571                 # Guard against wrongly setup bootstrap not finding gtest and gmock targets
572                 if (NOT (TARGET gtest AND TARGET gmock))
573                         message(FATAL_ERROR "Error adding google test. This could be caused by Bootstrap, please check Bootstrap.")
574                 endif()
575         mark_as_advanced(FORCE BUILD_GTEST BUILD_GMOCK BUILD_SHARED_LIBS INSTALL_GTEST INSTALL_GMOCK gtest_build_samples gtest_build_tests gtest_disable_pthreads gtest_force_shared_crt gtest_hide_internal_symbols gmock_build_tests)
576             if(ORBIS)
577                     set(MSVC ${MSVC_TEMP})
578                     target_compile_definitions(gtest PRIVATE GTEST_HAS_DEATH_TEST=0)
579                     target_compile_definitions(gmock PRIVATE GTEST_HAS_DEATH_TEST=0)
580             endif()
581         set(BUILD_SHARED_LIBS ${temp} CACHE INTERNAL "" FORCE)
582         set_solution_folder("Libs" gtest)
583             set_solution_folder("Libs" gmock)
584         set_solution_folder("Libs" gtest_main)
585         set_solution_folder("Libs" gmock_main)
586         set(CMAKE_DEBUG_POSTFIX "" CACHE STRING "Set debug library postfix" FORCE)
587             if (DURANGO OR ORBIS)
588                     set(THIS_PROJECT gtest)
589                     SET_PLATFORM_TARGET_PROPERTIES(gtest)
590                     set(THIS_PROJECT gmock)
591                     SET_PLATFORM_TARGET_PROPERTIES(gmock)
592             endif()
594                 # We want to hide gtest_main and gmock_main because we are not using these
595                 # Only do so when these targets are defined
596                 if (TARGET gmock_main)
597                         set_property(TARGET gmock_main PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE)
598                         set_property(TARGET gmock_main PROPERTY EXCLUDE_FROM_ALL TRUE)  
599                 endif()
600         
601                 if (TARGET gtest_main)
602                         set_property(TARGET gtest_main PROPERTY EXCLUDE_FROM_DEFAULT_BUILD TRUE)
603                         set_property(TARGET gtest_main PROPERTY EXCLUDE_FROM_ALL TRUE)
604                 endif()
606             add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/CryCommonUnitTest")
607         add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/CrySystemUnitTest")
608         add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/CryEntitySystemUnitTest")
609                 add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/CryAnimationUnitTest")
610                 add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/Cry3DEngineUnitTest")
611                 add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/CryAudioSystemUnitTest")
612                 add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/CryAISystemUnitTest")
613             if (ORBIS)
614                     add_subdirectory("${CRYENGINE_DIR}/Code/CryEngine/UnitTests/CryUnitTestOrbisMain")
615             endif()
616     endif()
617 endif()
619 if (OPTION_SCALEFORMHELPER OR OPTION_ENGINE OR OPTION_SHADERCACHEGEN)
620         add_subdirectory ("Code/Libs/zlib")
621         add_subdirectory ("Code/Libs/expat")
622         if (WINDOWS)
623                 add_subdirectory ("Code/Libs/png16")
624         endif ()
625 endif()
627 if (OPTION_ENGINE OR OPTION_SHADERCACHEGEN OR OPTION_PAKTOOLS)
628         add_subdirectory ("Code/Libs/tomcrypt")
629 endif()
631 if (OPTION_ENGINE OR OPTION_SHADERCACHEGEN)
632         add_subdirectory ("Code/Libs/md5")
633         add_subdirectory ("Code/Libs/lz4")
634         add_subdirectory ("Code/Libs/jsmn")
635         add_subdirectory ("Code/Libs/lzma")
636         add_subdirectory ("Code/Libs/lzss")
637         add_subdirectory ("Code/Libs/tiff")     
638 endif()
640 if (WINDOWS)
641         add_subdirectory ("Code/Libs/Detours")
642 endif ()
644 add_subdirectory ("Code/Libs/qpOASES")