Changeset View
Changeset View
Standalone View
Standalone View
CMakeLists.txt
| Show First 20 Lines • Show All 540 Lines • ▼ Show 20 Lines | |||||
| mark_as_advanced(WITH_GL_EGL) | mark_as_advanced(WITH_GL_EGL) | ||||
| if(WITH_GHOST_WAYLAND) | if(WITH_GHOST_WAYLAND) | ||||
| # Wayland can only use EGL to create OpenGL contexts, not GLX. | # Wayland can only use EGL to create OpenGL contexts, not GLX. | ||||
| set(WITH_GL_EGL ON) | set(WITH_GL_EGL ON) | ||||
| endif() | endif() | ||||
| if(UNIX AND NOT APPLE) | if(UNIX AND NOT APPLE) | ||||
| if(WITH_GL_EGL) | |||||
| # GLEW can only be built with either GLX or EGL support. Most binary distributions are | |||||
| # built with GLX support and we have no automated way to detect this. So always build | |||||
| # GLEW from source to be sure it has EGL support. | |||||
| set(WITH_SYSTEM_GLEW OFF) | |||||
| else() | |||||
| option(WITH_SYSTEM_GLEW "Use GLEW OpenGL wrapper library provided by the operating system" OFF) | |||||
| endif() | |||||
| option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON) | option(WITH_SYSTEM_GLES "Use OpenGL ES library provided by the operating system" ON) | ||||
| else() | else() | ||||
| # System GLEW and GLES not an option on other platforms. | # System GLES not an option on other platforms. | ||||
| set(WITH_SYSTEM_GLEW OFF) | |||||
| set(WITH_SYSTEM_GLES OFF) | set(WITH_SYSTEM_GLES OFF) | ||||
| endif() | endif() | ||||
| option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON) | option(WITH_OPENGL "When off limits visibility of the opengl headers to just bf_gpu and gawain (temporary option for development purposes)" ON) | ||||
| option(WITH_GLEW_ES "Switches to experimental copy of GLEW that has support for OpenGL ES. (temporary option for development purposes)" OFF) | |||||
| option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)" OFF) | option(WITH_GL_PROFILE_ES20 "Support using OpenGL ES 2.0. (through either EGL or the AGL/WGL/XGL 'es20' profile)" OFF) | ||||
| option(WITH_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF) | option(WITH_GPU_BUILDTIME_SHADER_BUILDER "Shader builder is a developer option enabling linting on GLSL during compilation" OFF) | ||||
| mark_as_advanced( | mark_as_advanced( | ||||
| WITH_OPENGL | WITH_OPENGL | ||||
| WITH_GLEW_ES | |||||
| WITH_GL_PROFILE_ES20 | WITH_GL_PROFILE_ES20 | ||||
| WITH_GPU_BUILDTIME_SHADER_BUILDER | WITH_GPU_BUILDTIME_SHADER_BUILDER | ||||
| ) | ) | ||||
| if(WITH_HEADLESS) | if(WITH_HEADLESS) | ||||
| set(WITH_OPENGL OFF) | set(WITH_OPENGL OFF) | ||||
| endif() | endif() | ||||
| Show All 10 Lines | if(WITH_METAL_BACKEND) | ||||
| set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) | set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) | ||||
| endif() | endif() | ||||
| if(WIN32) | if(WIN32) | ||||
| option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF) | option(WITH_GL_ANGLE "Link with the ANGLE library, an OpenGL ES 2.0 implementation based on Direct3D, instead of the system OpenGL library." OFF) | ||||
| mark_as_advanced(WITH_GL_ANGLE) | mark_as_advanced(WITH_GL_ANGLE) | ||||
| endif() | endif() | ||||
| if(WITH_GLEW_ES AND WITH_SYSTEM_GLEW) | |||||
| message(WARNING Ignoring WITH_SYSTEM_GLEW and using WITH_GLEW_ES) | |||||
| set(WITH_SYSTEM_GLEW OFF) | |||||
| endif() | |||||
| if(WIN32) | if(WIN32) | ||||
| getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) | getDefaultWindowsPrefixBase(CMAKE_GENERIC_PROGRAM_FILES) | ||||
| set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${}) | set(CPACK_INSTALL_PREFIX ${CMAKE_GENERIC_PROGRAM_FILES}/${}) | ||||
| endif() | endif() | ||||
| # Compiler tool-chain. | # Compiler tool-chain. | ||||
| if(UNIX AND NOT APPLE) | if(UNIX AND NOT APPLE) | ||||
| if(CMAKE_COMPILER_IS_GNUCC) | if(CMAKE_COMPILER_IS_GNUCC) | ||||
| ▲ Show 20 Lines • Show All 678 Lines • ▼ Show 20 Lines | else() | ||||
| list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY}) | list(APPEND BLENDER_GL_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY}) | ||||
| endif() | endif() | ||||
| endif() | endif() | ||||
| if(WITH_GL_EGL) | if(WITH_GL_EGL) | ||||
| find_package(OpenGL REQUIRED EGL) | find_package(OpenGL REQUIRED EGL) | ||||
| list(APPEND BLENDER_GL_LIBRARIES OpenGL::EGL) | list(APPEND BLENDER_GL_LIBRARIES OpenGL::EGL) | ||||
| list(APPEND GL_DEFINITIONS -DWITH_GL_EGL -DGLEW_EGL -DGLEW_INC_EGL) | list(APPEND GL_DEFINITIONS -DWITH_GL_EGL) | ||||
| if(WITH_SYSTEM_GLES) | if(WITH_SYSTEM_GLES) | ||||
| if(NOT OPENGLES_EGL_LIBRARY) | if(NOT OPENGLES_EGL_LIBRARY) | ||||
| message(FATAL_ERROR | message(FATAL_ERROR | ||||
| "Unable to find OpenGL ES libraries. " | "Unable to find OpenGL ES libraries. " | ||||
| "Install them or disable WITH_SYSTEM_GLES." | "Install them or disable WITH_SYSTEM_GLES." | ||||
| ) | ) | ||||
| endif() | endif() | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | if(WITH_OPENMP) | ||||
| mark_as_advanced( | mark_as_advanced( | ||||
| OpenMP_C_FLAGS | OpenMP_C_FLAGS | ||||
| OpenMP_CXX_FLAGS | OpenMP_CXX_FLAGS | ||||
| ) | ) | ||||
| endif() | endif() | ||||
| #----------------------------------------------------------------------------- | #----------------------------------------------------------------------------- | ||||
| # Configure GLEW | |||||
| if(WITH_SYSTEM_GLEW) | |||||
| find_package(GLEW) | |||||
| # Note: There is an assumption here that the system GLEW is not a static library. | |||||
| if(NOT GLEW_FOUND) | |||||
| message(FATAL_ERROR "GLEW is required to build Blender. Install it or disable WITH_SYSTEM_GLEW.") | |||||
| endif() | |||||
| set(GLEW_INCLUDE_PATH "${GLEW_INCLUDE_DIR}") | |||||
| set(BLENDER_GLEW_LIBRARIES ${GLEW_LIBRARY}) | |||||
| else() | |||||
| if(WITH_GLEW_ES) | |||||
| set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew-es/include") | |||||
| list(APPEND GL_DEFINITIONS -DGLEW_STATIC -DWITH_GLEW_ES) | |||||
| # These definitions remove APIs from glew.h, making GLEW smaller, and catching unguarded API usage | |||||
| if(WITH_GL_PROFILE_ES20) | |||||
| list(APPEND GL_DEFINITIONS -DGLEW_ES_ONLY) | |||||
| else() | |||||
| # No ES functions are needed | |||||
| list(APPEND GL_DEFINITIONS -DGLEW_NO_ES) | |||||
| endif() | |||||
| if(WITH_GL_PROFILE_ES20) | |||||
| if(WITH_GL_EGL) | |||||
| list(APPEND GL_DEFINITIONS -DGLEW_USE_LIB_ES20) | |||||
| endif() | |||||
| # ToDo: This is an experiment to eliminate ES 1 symbols, | |||||
| # GLEW doesn't really properly provide this level of control | |||||
| # (for example, without modification it eliminates too many symbols) | |||||
| # so there are lots of modifications to GLEW to make this work, | |||||
| # and no attempt to make it work beyond Blender at this point. | |||||
| list(APPEND GL_DEFINITIONS -DGL_ES_VERSION_1_0=0 -DGL_ES_VERSION_CL_1_1=0 -DGL_ES_VERSION_CM_1_1=0) | |||||
| endif() | |||||
| set(BLENDER_GLEW_LIBRARIES extern_glew_es bf_intern_glew_mx) | |||||
| else() | |||||
| set(GLEW_INCLUDE_PATH "${CMAKE_SOURCE_DIR}/extern/glew/include") | |||||
| list(APPEND GL_DEFINITIONS -DGLEW_STATIC) | |||||
| # This won't affect the non-experimental glew library, | |||||
| # but is used for conditional compilation elsewhere. | |||||
| list(APPEND GL_DEFINITIONS -DGLEW_NO_ES) | |||||
| set(BLENDER_GLEW_LIBRARIES extern_glew) | |||||
| endif() | |||||
| endif() | |||||
| list(APPEND GL_DEFINITIONS -DGLEW_NO_GLU) | |||||
| #----------------------------------------------------------------------------- | |||||
| # Configure Bullet | # Configure Bullet | ||||
| if(WITH_BULLET AND WITH_SYSTEM_BULLET) | if(WITH_BULLET AND WITH_SYSTEM_BULLET) | ||||
| find_package(Bullet) | find_package(Bullet) | ||||
| if(NOT BULLET_FOUND) | if(NOT BULLET_FOUND) | ||||
| message(STATUS "Bullet not found, disabling WITH_BULLET") | message(STATUS "Bullet not found, disabling WITH_BULLET") | ||||
| set(WITH_BULLET OFF) | set(WITH_BULLET OFF) | ||||
| endif() | endif() | ||||
| ▲ Show 20 Lines • Show All 508 Lines • ▼ Show 20 Lines | |||||
| if(WITH_BLENDER) | if(WITH_BLENDER) | ||||
| add_subdirectory(intern) | add_subdirectory(intern) | ||||
| add_subdirectory(extern) | add_subdirectory(extern) | ||||
| # source after intern and extern to gather all | # source after intern and extern to gather all | ||||
| # internal and external library information first, for test linking | # internal and external library information first, for test linking | ||||
| add_subdirectory(source) | add_subdirectory(source) | ||||
| elseif(WITH_CYCLES_STANDALONE OR WITH_CYCLES_HYDRA_RENDER_DELEGATE) | elseif(WITH_CYCLES_STANDALONE OR WITH_CYCLES_HYDRA_RENDER_DELEGATE) | ||||
| add_subdirectory(intern/glew-mx) | |||||
| add_subdirectory(intern/guardedalloc) | add_subdirectory(intern/guardedalloc) | ||||
| add_subdirectory(intern/libc_compat) | add_subdirectory(intern/libc_compat) | ||||
| add_subdirectory(intern/sky) | add_subdirectory(intern/sky) | ||||
| add_subdirectory(intern/cycles) | add_subdirectory(intern/cycles) | ||||
| if(WITH_CYCLES_LOGGING) | if(WITH_CYCLES_LOGGING) | ||||
| if(NOT WITH_SYSTEM_GFLAGS) | if(NOT WITH_SYSTEM_GFLAGS) | ||||
| add_subdirectory(extern/gflags) | add_subdirectory(extern/gflags) | ||||
| endif() | endif() | ||||
| add_subdirectory(extern/glog) | add_subdirectory(extern/glog) | ||||
| endif() | endif() | ||||
| if(WITH_CUDA_DYNLOAD) | if(WITH_CUDA_DYNLOAD) | ||||
| add_subdirectory(extern/cuew) | add_subdirectory(extern/cuew) | ||||
| endif() | endif() | ||||
| if(WITH_HIP_DYNLOAD) | if(WITH_HIP_DYNLOAD) | ||||
| add_subdirectory(extern/hipew) | add_subdirectory(extern/hipew) | ||||
| endif() | endif() | ||||
| if(NOT WITH_SYSTEM_GLEW) | |||||
| add_subdirectory(extern/glew) | |||||
| endif() | |||||
| endif() | endif() | ||||
| #----------------------------------------------------------------------------- | #----------------------------------------------------------------------------- | ||||
| # Testing | # Testing | ||||
| add_subdirectory(tests) | add_subdirectory(tests) | ||||
| #----------------------------------------------------------------------------- | #----------------------------------------------------------------------------- | ||||
| # Blender Application | # Blender Application | ||||
| ▲ Show 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | if(FIRST_RUN) | ||||
| info_cfg_text("Compiler Options:") | info_cfg_text("Compiler Options:") | ||||
| info_cfg_option(WITH_BUILDINFO) | info_cfg_option(WITH_BUILDINFO) | ||||
| info_cfg_option(WITH_OPENMP) | info_cfg_option(WITH_OPENMP) | ||||
| info_cfg_text("System Options:") | info_cfg_text("System Options:") | ||||
| info_cfg_option(WITH_INSTALL_PORTABLE) | info_cfg_option(WITH_INSTALL_PORTABLE) | ||||
| info_cfg_option(WITH_MEM_JEMALLOC) | info_cfg_option(WITH_MEM_JEMALLOC) | ||||
| info_cfg_option(WITH_MEM_VALGRIND) | info_cfg_option(WITH_MEM_VALGRIND) | ||||
| info_cfg_option(WITH_SYSTEM_GLEW) | |||||
| info_cfg_option(WITH_X11_ALPHA) | info_cfg_option(WITH_X11_ALPHA) | ||||
| info_cfg_option(WITH_X11_XF86VMODE) | info_cfg_option(WITH_X11_XF86VMODE) | ||||
| info_cfg_option(WITH_X11_XFIXES) | info_cfg_option(WITH_X11_XFIXES) | ||||
| info_cfg_option(WITH_X11_XINPUT) | info_cfg_option(WITH_X11_XINPUT) | ||||
| info_cfg_text("Image Formats:") | info_cfg_text("Image Formats:") | ||||
| info_cfg_option(WITH_IMAGE_CINEON) | info_cfg_option(WITH_IMAGE_CINEON) | ||||
| info_cfg_option(WITH_IMAGE_DDS) | info_cfg_option(WITH_IMAGE_DDS) | ||||
| Show All 37 Lines | if(FIRST_RUN) | ||||
| info_cfg_option(WITH_MOD_REMESH) | info_cfg_option(WITH_MOD_REMESH) | ||||
| info_cfg_text("OpenGL:") | info_cfg_text("OpenGL:") | ||||
| if(WIN32) | if(WIN32) | ||||
| info_cfg_option(WITH_GL_ANGLE) | info_cfg_option(WITH_GL_ANGLE) | ||||
| endif() | endif() | ||||
| info_cfg_option(WITH_GL_EGL) | info_cfg_option(WITH_GL_EGL) | ||||
| info_cfg_option(WITH_GL_PROFILE_ES20) | info_cfg_option(WITH_GL_PROFILE_ES20) | ||||
| info_cfg_option(WITH_GLEW_ES) | |||||
| info_cfg_text("") | info_cfg_text("") | ||||
| message("${_config_msg}") | message("${_config_msg}") | ||||
| endif() | endif() | ||||
| if(0) | if(0) | ||||
| print_all_vars() | print_all_vars() | ||||
| endif() | endif() | ||||
| # Should be the last step of configuration. | # Should be the last step of configuration. | ||||
| if(POSTCONFIGURE_SCRIPT) | if(POSTCONFIGURE_SCRIPT) | ||||
| include(${POSTCONFIGURE_SCRIPT}) | include(${POSTCONFIGURE_SCRIPT}) | ||||
| endif() | endif() | ||||