2014-01-20 19:41:54 +00:00
|
|
|
# Standalone or with Blender
|
|
|
|
if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
|
|
|
|
set(CYCLES_INSTALL_PATH "")
|
|
|
|
else()
|
|
|
|
set(WITH_CYCLES_BLENDER ON)
|
|
|
|
set(CYCLES_INSTALL_PATH "scripts/addons/cycles")
|
|
|
|
endif()
|
2011-08-16 16:15:34 +00:00
|
|
|
|
|
|
|
# External Libraries
|
|
|
|
|
|
|
|
include(cmake/external_libs.cmake)
|
|
|
|
|
|
|
|
# Build Flags
|
Remove SCons building system
While SCons building system was serving us really good for ages it's no longer
having much attention by the developers and started to become quite a difficult
task to maintain.
What's even worse -- there started to be quite serious divergence between SCons
and CMake which was only accumulating over the releases now. The fact that none
of the active developers are really using SCons and that our main studio is also
using CMake spotting bugs in the SCons builds became quite a difficult task and
we aren't always spotting them in time.
Meanwhile CMake became really mature building system which is available on every
platform we support and arguably it's also easier and more robust to use.
This commit includes:
- Removal of actual SCons building system
- Removal of SCons git submodule
- Removal of documentation which is stored in the sources and covers SCons
- Tweaks to the buildbot master to stop using SCons submodule
(this change requires deploying to the server)
- Tweaks to the install dependencies script to skip installing or mentioning
SCons building system
- Tweaks to various helper scripts to avoid mention of SCons folders/files
as well
Reviewers: mont29, dingto, dfelinto, lukastoenne, lukasstockner97, brecht, Severin, merwin, aligorith, psy-fi, campbellbarton, juicyfruit
Reviewed By: campbellbarton, juicyfruit
Differential Revision: https://developer.blender.org/D1680
2016-01-04 09:20:48 +00:00
|
|
|
# todo: this code could be refactored a bit to avoid duplication
|
2014-03-26 21:28:59 +00:00
|
|
|
# note: CXX_HAS_SSE is needed in case passing SSE flags fails altogether (gcc-arm)
|
2011-08-16 16:15:34 +00:00
|
|
|
|
2016-03-25 15:09:05 +00:00
|
|
|
if(WITH_CYCLES_NATIVE_ONLY)
|
|
|
|
set(CXX_HAS_SSE FALSE)
|
|
|
|
set(CXX_HAS_AVX FALSE)
|
|
|
|
set(CXX_HAS_AVX2 FALSE)
|
|
|
|
add_definitions(
|
|
|
|
-DWITH_KERNEL_NATIVE
|
|
|
|
)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
|
|
|
|
elseif(NOT WITH_CPU_SSE)
|
2014-10-15 12:43:47 +00:00
|
|
|
set(CXX_HAS_SSE FALSE)
|
2014-12-14 22:51:43 +00:00
|
|
|
set(CXX_HAS_AVX FALSE)
|
|
|
|
set(CXX_HAS_AVX2 FALSE)
|
2014-10-15 12:43:47 +00:00
|
|
|
elseif(WIN32 AND MSVC)
|
2014-03-26 21:28:59 +00:00
|
|
|
set(CXX_HAS_SSE TRUE)
|
2014-12-07 10:22:05 +00:00
|
|
|
set(CXX_HAS_AVX TRUE)
|
|
|
|
set(CXX_HAS_AVX2 TRUE)
|
2014-03-26 21:28:59 +00:00
|
|
|
|
2014-02-03 13:22:50 +00:00
|
|
|
# /arch:AVX for VC2012 and above
|
|
|
|
if(NOT MSVC_VERSION LESS 1700)
|
|
|
|
set(CYCLES_AVX_ARCH_FLAGS "/arch:AVX")
|
2014-06-13 20:23:58 +00:00
|
|
|
set(CYCLES_AVX2_ARCH_FLAGS "/arch:AVX /arch:AVX2")
|
2014-02-03 13:22:50 +00:00
|
|
|
elseif(NOT CMAKE_CL_64)
|
|
|
|
set(CYCLES_AVX_ARCH_FLAGS "/arch:SSE2")
|
2014-06-13 20:23:58 +00:00
|
|
|
set(CYCLES_AVX2_ARCH_FLAGS "/arch:SSE2")
|
2014-02-03 13:22:50 +00:00
|
|
|
endif()
|
|
|
|
|
2013-06-18 13:19:16 +00:00
|
|
|
# there is no /arch:SSE3, but intrinsics are available anyway
|
2013-08-31 03:18:55 +00:00
|
|
|
if(CMAKE_CL_64)
|
2014-03-31 17:44:02 +00:00
|
|
|
set(CYCLES_SSE2_KERNEL_FLAGS "/fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
|
|
|
set(CYCLES_SSE3_KERNEL_FLAGS "/fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
|
|
|
set(CYCLES_SSE41_KERNEL_FLAGS "/fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
|
|
|
set(CYCLES_AVX_KERNEL_FLAGS "${CYCLES_AVX_ARCH_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
2014-06-13 20:23:58 +00:00
|
|
|
set(CYCLES_AVX2_KERNEL_FLAGS "${CYCLES_AVX2_ARCH_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
2013-08-31 03:18:55 +00:00
|
|
|
else()
|
2014-03-31 17:44:02 +00:00
|
|
|
set(CYCLES_SSE2_KERNEL_FLAGS "/arch:SSE2 /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
|
|
|
set(CYCLES_SSE3_KERNEL_FLAGS "/arch:SSE2 /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
|
|
|
set(CYCLES_SSE41_KERNEL_FLAGS "/arch:SSE2 /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
|
|
|
set(CYCLES_AVX_KERNEL_FLAGS "${CYCLES_AVX_ARCH_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
2014-06-13 20:23:58 +00:00
|
|
|
set(CYCLES_AVX2_KERNEL_FLAGS "${CYCLES_AVX2_ARCH_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
2013-08-31 03:18:55 +00:00
|
|
|
endif()
|
2013-06-19 17:54:26 +00:00
|
|
|
|
2014-03-31 17:44:02 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast -D_CRT_SECURE_NO_WARNINGS /GS-")
|
2013-06-19 17:17:51 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox")
|
2013-08-05 12:02:43 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Ox")
|
|
|
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Ox")
|
2011-12-01 16:33:21 +00:00
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC)
|
2014-03-26 21:28:59 +00:00
|
|
|
check_cxx_compiler_flag(-msse CXX_HAS_SSE)
|
2014-12-07 10:22:05 +00:00
|
|
|
check_cxx_compiler_flag(-mavx CXX_HAS_AVX)
|
|
|
|
check_cxx_compiler_flag(-mavx2 CXX_HAS_AVX2)
|
2014-03-26 21:28:59 +00:00
|
|
|
if(CXX_HAS_SSE)
|
|
|
|
set(CYCLES_SSE2_KERNEL_FLAGS "-ffast-math -msse -msse2 -mfpmath=sse")
|
|
|
|
set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse")
|
|
|
|
set(CYCLES_SSE41_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mfpmath=sse")
|
2014-12-07 10:22:05 +00:00
|
|
|
endif()
|
|
|
|
if(CXX_HAS_AVX)
|
2014-03-26 21:28:59 +00:00
|
|
|
set(CYCLES_AVX_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mfpmath=sse")
|
2014-12-07 10:22:05 +00:00
|
|
|
endif()
|
|
|
|
if(CXX_HAS_AVX2)
|
2015-05-10 16:20:04 +00:00
|
|
|
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c -mfpmath=sse")
|
2014-03-26 21:28:59 +00:00
|
|
|
endif()
|
2011-12-01 16:33:21 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
|
2013-07-07 18:29:57 +00:00
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
2014-03-26 21:28:59 +00:00
|
|
|
check_cxx_compiler_flag(-msse CXX_HAS_SSE)
|
2014-12-07 10:22:05 +00:00
|
|
|
check_cxx_compiler_flag(-mavx CXX_HAS_AVX)
|
|
|
|
check_cxx_compiler_flag(-mavx2 CXX_HAS_AVX2)
|
2014-03-26 21:28:59 +00:00
|
|
|
if(CXX_HAS_SSE)
|
|
|
|
set(CYCLES_SSE2_KERNEL_FLAGS "-ffast-math -msse -msse2")
|
|
|
|
set(CYCLES_SSE3_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3")
|
|
|
|
set(CYCLES_SSE41_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1")
|
2014-12-07 10:22:05 +00:00
|
|
|
endif()
|
|
|
|
if(CXX_HAS_AVX)
|
2014-03-26 21:28:59 +00:00
|
|
|
set(CYCLES_AVX_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx")
|
2014-12-07 10:22:05 +00:00
|
|
|
endif()
|
|
|
|
if(CXX_HAS_AVX2)
|
2015-05-10 16:20:04 +00:00
|
|
|
set(CYCLES_AVX2_KERNEL_FLAGS "-ffast-math -msse -msse2 -msse3 -mssse3 -msse4.1 -mavx -mavx2 -mfma -mlzcnt -mbmi -mbmi2 -mf16c")
|
2014-03-26 21:28:59 +00:00
|
|
|
endif()
|
2013-07-07 18:29:57 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math")
|
2011-11-08 20:27:37 +00:00
|
|
|
endif()
|
2011-04-28 13:47:27 +00:00
|
|
|
|
2014-03-26 21:28:59 +00:00
|
|
|
if(CXX_HAS_SSE)
|
|
|
|
add_definitions(
|
|
|
|
-DWITH_KERNEL_SSE2
|
|
|
|
-DWITH_KERNEL_SSE3
|
|
|
|
-DWITH_KERNEL_SSE41
|
|
|
|
)
|
|
|
|
endif()
|
2014-01-28 21:56:12 +00:00
|
|
|
|
2014-12-07 10:22:05 +00:00
|
|
|
if(CXX_HAS_AVX)
|
|
|
|
add_definitions(-DWITH_KERNEL_AVX)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CXX_HAS_AVX2)
|
|
|
|
add_definitions(-DWITH_KERNEL_AVX2)
|
|
|
|
endif()
|
|
|
|
|
2014-06-17 06:00:16 +00:00
|
|
|
if(WITH_CYCLES_OSL)
|
|
|
|
if(WIN32 AND MSVC)
|
|
|
|
set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
|
|
|
|
elseif(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
|
|
|
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
|
|
|
|
endif()
|
2012-11-26 13:48:48 +00:00
|
|
|
endif()
|
2011-11-10 14:32:16 +00:00
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
# Definitions and Includes
|
|
|
|
|
2014-03-13 12:31:06 +00:00
|
|
|
add_definitions(
|
|
|
|
${BOOST_DEFINITIONS}
|
|
|
|
${OPENIMAGEIO_DEFINITIONS}
|
|
|
|
)
|
2011-08-16 16:15:34 +00:00
|
|
|
|
2014-03-13 12:31:06 +00:00
|
|
|
add_definitions(
|
|
|
|
-DCCL_NAMESPACE_BEGIN=namespace\ ccl\ {
|
|
|
|
-DCCL_NAMESPACE_END=}
|
|
|
|
)
|
2011-08-16 16:15:34 +00:00
|
|
|
|
2014-01-20 20:12:28 +00:00
|
|
|
if(WITH_CYCLES_STANDALONE_GUI)
|
|
|
|
add_definitions(-DWITH_CYCLES_STANDALONE_GUI)
|
|
|
|
endif()
|
|
|
|
|
2013-11-28 00:38:23 +00:00
|
|
|
if(WITH_CYCLES_PTEX)
|
|
|
|
add_definitions(-DWITH_PTEX)
|
|
|
|
endif()
|
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
if(WITH_CYCLES_OSL)
|
2011-12-29 01:46:58 +00:00
|
|
|
add_definitions(-DWITH_OSL)
|
2013-01-30 21:58:47 +00:00
|
|
|
add_definitions(-DOSL_STATIC_LIBRARY)
|
2014-06-28 17:59:54 +00:00
|
|
|
include_directories(
|
|
|
|
SYSTEM
|
2014-12-29 09:48:21 +00:00
|
|
|
${OSL_INCLUDE_DIR}
|
2014-06-28 17:59:54 +00:00
|
|
|
)
|
2011-08-16 16:15:34 +00:00
|
|
|
endif()
|
|
|
|
|
2016-07-17 02:57:06 +00:00
|
|
|
if(WITH_CYCLES_OPENSUBDIV)
|
|
|
|
add_definitions(-DWITH_OPENSUBDIV)
|
|
|
|
include_directories(
|
|
|
|
SYSTEM
|
|
|
|
${OPENSUBDIV_INCLUDE_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2016-01-12 15:50:43 +00:00
|
|
|
set(WITH_CYCLES_DEVICE_OPENCL TRUE)
|
|
|
|
set(WITH_CYCLES_DEVICE_CUDA TRUE)
|
|
|
|
set(WITH_CYCLES_DEVICE_MULTI TRUE)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2016-01-14 07:38:46 +00:00
|
|
|
if(CYCLES_STANDALONE_REPOSITORY)
|
|
|
|
TEST_UNORDERED_MAP_SUPPORT()
|
|
|
|
endif()
|
2016-05-16 18:03:59 +00:00
|
|
|
if(WITH_CXX11)
|
|
|
|
add_definitions(-DCYCLES_STD_UNORDERED_MAP)
|
|
|
|
elseif(HAVE_STD_UNORDERED_MAP_HEADER)
|
2015-07-18 08:21:17 +00:00
|
|
|
if(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
|
|
|
add_definitions(-DCYCLES_STD_UNORDERED_MAP)
|
|
|
|
else()
|
|
|
|
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
|
|
|
add_definitions(-DCYCLES_STD_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
|
|
|
else()
|
|
|
|
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
|
|
|
|
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-03-29 20:12:22 +00:00
|
|
|
else()
|
2015-07-18 08:21:17 +00:00
|
|
|
if(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
|
|
|
add_definitions(-DCYCLES_TR1_UNORDERED_MAP)
|
|
|
|
else()
|
|
|
|
add_definitions(-DCYCLES_NO_UNORDERED_MAP)
|
|
|
|
message(STATUS "Replacing unordered_map/set with map/set (warning: slower!)")
|
|
|
|
endif()
|
2015-03-29 20:12:22 +00:00
|
|
|
endif()
|
|
|
|
|
2014-10-04 13:00:26 +00:00
|
|
|
# Logging capabilities using GLog library.
|
2014-09-08 12:01:24 +00:00
|
|
|
if(WITH_CYCLES_LOGGING)
|
|
|
|
add_definitions(-DWITH_CYCLES_LOGGING)
|
|
|
|
add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
|
2014-12-12 11:01:30 +00:00
|
|
|
add_definitions(-DCYCLES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
2014-11-15 20:12:19 +00:00
|
|
|
include_directories(
|
|
|
|
SYSTEM
|
|
|
|
${GLOG_INCLUDE_DIRS}
|
|
|
|
${GFLAGS_INCLUDE_DIRS}
|
|
|
|
)
|
2014-09-08 12:01:24 +00:00
|
|
|
endif()
|
|
|
|
|
2014-10-04 13:00:26 +00:00
|
|
|
# Debugging capabilities (debug passes etc).
|
|
|
|
if(WITH_CYCLES_DEBUG)
|
|
|
|
add_definitions(-DWITH_CYCLES_DEBUG)
|
|
|
|
endif()
|
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
include_directories(
|
2012-09-20 09:04:43 +00:00
|
|
|
SYSTEM
|
2011-08-16 16:15:34 +00:00
|
|
|
${BOOST_INCLUDE_DIR}
|
2011-09-18 04:55:22 +00:00
|
|
|
${OPENIMAGEIO_INCLUDE_DIRS}
|
2012-09-24 19:06:28 +00:00
|
|
|
${OPENIMAGEIO_INCLUDE_DIRS}/OpenImageIO
|
2014-01-27 18:11:36 +00:00
|
|
|
${OPENEXR_INCLUDE_DIR}
|
2014-03-13 12:31:06 +00:00
|
|
|
${OPENEXR_INCLUDE_DIRS}
|
2014-11-15 17:56:22 +00:00
|
|
|
${PUGIXML_INCLUDE_DIR}
|
2014-03-13 12:31:06 +00:00
|
|
|
)
|
2011-04-27 11:58:34 +00:00
|
|
|
|
2014-12-31 20:01:31 +00:00
|
|
|
if(CYCLES_STANDALONE_REPOSITORY)
|
|
|
|
include_directories(../third_party/atomic)
|
|
|
|
else()
|
|
|
|
include_directories(../atomic)
|
|
|
|
endif()
|
2014-05-02 21:22:14 +00:00
|
|
|
|
|
|
|
# Warnings
|
2014-05-03 08:54:02 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_float_conversion "-Werror=float-conversion")
|
2014-10-08 08:58:40 +00:00
|
|
|
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_cxxflag_double_promotion "-Werror=double-promotion")
|
2016-02-17 11:40:56 +00:00
|
|
|
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS _has_no_error_unused_macros "-Wno-error=unused-macros")
|
2014-05-03 08:54:02 +00:00
|
|
|
unset(_has_cxxflag_float_conversion)
|
2014-10-08 08:58:40 +00:00
|
|
|
unset(_has_cxxflag_double_promotion)
|
2016-02-17 11:40:56 +00:00
|
|
|
unset(_has_no_error_unused_macros)
|
2014-05-02 21:22:14 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2011-04-27 11:58:34 +00:00
|
|
|
# Subdirectories
|
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
if(WITH_CYCLES_BLENDER)
|
2016-02-06 22:40:41 +00:00
|
|
|
add_definitions(-DWITH_BLENDER_GUARDEDALLOC)
|
2011-11-18 21:06:36 +00:00
|
|
|
add_subdirectory(blender)
|
2012-06-01 14:59:06 +00:00
|
|
|
endif()
|
2011-08-16 16:15:34 +00:00
|
|
|
|
2016-03-11 09:00:47 +00:00
|
|
|
if(WITH_CYCLES_NETWORK)
|
|
|
|
add_definitions(-DWITH_NETWORK)
|
|
|
|
endif()
|
|
|
|
|
2013-08-27 02:37:48 +00:00
|
|
|
if(WITH_CYCLES_STANDALONE OR WITH_CYCLES_NETWORK)
|
2012-11-09 18:31:04 +00:00
|
|
|
add_subdirectory(app)
|
|
|
|
endif()
|
|
|
|
|
2011-08-16 16:15:34 +00:00
|
|
|
add_subdirectory(bvh)
|
|
|
|
add_subdirectory(device)
|
|
|
|
add_subdirectory(doc)
|
2016-05-07 17:47:37 +00:00
|
|
|
add_subdirectory(graph)
|
2011-08-16 16:15:34 +00:00
|
|
|
add_subdirectory(kernel)
|
|
|
|
add_subdirectory(render)
|
|
|
|
add_subdirectory(subd)
|
|
|
|
add_subdirectory(util)
|
2011-11-10 12:52:17 +00:00
|
|
|
|
2016-02-06 18:09:44 +00:00
|
|
|
# TODO(sergey): Make this to work with standalone repository.
|
|
|
|
if(WITH_GTESTS)
|
|
|
|
add_subdirectory(test)
|
|
|
|
endif()
|
|
|
|
|
2014-01-20 19:41:54 +00:00
|
|
|
if(NOT WITH_BLENDER AND WITH_CYCLES_STANDALONE)
|
|
|
|
delayed_do_install(${CMAKE_BINARY_DIR}/bin)
|
|
|
|
endif()
|
|
|
|
|