diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-09 06:36:45 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-09 06:37:29 +0300 |
commit | dfbba7c0ebfb84eb5ddb86f6eb98b45c11a83436 (patch) | |
tree | 9b9f03127711ed7dde6e70389d1a2a4a3a6323f7 | |
parent | 19b5524d1c0c1c2ee78a8a75b8703b7cc72a8671 (diff) |
Cleanup: CMake file indentation
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | build_files/build_environment/cmake/harvest.cmake | 6 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 6 | ||||
-rw-r--r-- | build_files/cmake/platform/platform_win32.cmake | 40 | ||||
-rw-r--r-- | source/creator/CMakeLists.txt | 116 |
5 files changed, 99 insertions, 84 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 80b8bfdbb3d..6abb430d523 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,7 +223,7 @@ if(UNIX AND NOT (APPLE OR HAIKU)) option(WITH_GHOST_WAYLAND "Enable building Blender against Wayland for windowing (under development)" OFF) mark_as_advanced(WITH_GHOST_WAYLAND) - if (WITH_GHOST_WAYLAND) + if(WITH_GHOST_WAYLAND) option(WITH_GHOST_WAYLAND_LIBDECOR "Optionally build with LibDecor window decorations" OFF) mark_as_advanced(WITH_GHOST_WAYLAND_LIBDECOR) @@ -464,8 +464,8 @@ if(NOT APPLE) option(WITH_CYCLES_ONEAPI_SYCL_HOST_ENABLED "Enable use of SYCL host (CPU) device execution by oneAPI implementation. This option is for debugging purposes and impacts GPU execution." OFF) # https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compilation/ahead-of-time-compilation.html - SET (CYCLES_ONEAPI_SPIR64_GEN_DEVICES "dg2" CACHE STRING "oneAPI Intel GPU architectures to build binaries for") - SET (CYCLES_ONEAPI_SYCL_TARGETS spir64 spir64_gen CACHE STRING "oneAPI targets to build AOT binaries for") + set(CYCLES_ONEAPI_SPIR64_GEN_DEVICES "dg2" CACHE STRING "oneAPI Intel GPU architectures to build binaries for") + set(CYCLES_ONEAPI_SYCL_TARGETS spir64 spir64_gen CACHE STRING "oneAPI targets to build AOT binaries for") mark_as_advanced(WITH_CYCLES_ONEAPI_SYCL_HOST_ENABLED) mark_as_advanced(CYCLES_ONEAPI_SPIR64_GEN_DEVICES) @@ -580,14 +580,14 @@ endif() # Metal -if (APPLE) +if(APPLE) option(WITH_METAL_BACKEND "Use Metal for graphics instead of (or as well as) OpenGL on macOS." OFF) mark_as_advanced(WITH_METAL_BACKEND) else() set(WITH_METAL_BACKEND OFF) endif() -if (WITH_METAL_BACKEND) +if(WITH_METAL_BACKEND) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) endif() @@ -1196,7 +1196,8 @@ if(WITH_OPENVDB) list(APPEND OPENVDB_INCLUDE_DIRS ${BOOST_INCLUDE_DIR} ${TBB_INCLUDE_DIRS} - ${OPENEXR_INCLUDE_DIRS}) + ${OPENEXR_INCLUDE_DIRS} + ) list(APPEND OPENVDB_LIBRARIES ${OPENEXR_LIBRARIES} ${ZLIB_LIBRARIES}) @@ -1346,7 +1347,7 @@ endif() #----------------------------------------------------------------------------- # Configure Metal. -if (WITH_METAL_BACKEND) +if(WITH_METAL_BACKEND) add_definitions(-DWITH_METAL_BACKEND) # No need to add frameworks here, all the ones we need for Metal and diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index bc456858d2a..7ebad7a3da2 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -43,7 +43,8 @@ function(harvest from to) install( FILES ${LIBDIR}/${from} DESTINATION ${HARVEST_TARGET}/${dirpath} - RENAME ${filename}) + RENAME ${filename} + ) else() install( DIRECTORY ${LIBDIR}/${from}/ @@ -53,7 +54,8 @@ function(harvest from to) PATTERN "pkgconfig" EXCLUDE PATTERN "cmake" EXCLUDE PATTERN "__pycache__" EXCLUDE - PATTERN "tests" EXCLUDE) + PATTERN "tests" EXCLUDE + ) endif() endfunction() diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 406748b7ff0..0d7ed9d618c 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -803,7 +803,8 @@ if(CMAKE_COMPILER_IS_GNUCC) "The mold linker could not find the directory containing the linker command " "(typically " "\"${MOLD_PREFIX}/libexec/mold/ld\") or " - "\"${MOLD_PREFIX}/lib/mold/ld\") using system linker.") + "\"${MOLD_PREFIX}/lib/mold/ld\") using system linker." + ) set(WITH_LINKER_MOLD OFF) endif() unset(MOLD_PREFIX) @@ -942,7 +943,8 @@ function(CONFIGURE_ATOMIC_LIB_IF_NEEDED) int main(int argc, char **argv) { std::atomic<uint64_t> uint64; uint64++; return 0; - }") + }" + ) include(CheckCXXSourceCompiles) check_cxx_source_compiles("${_source}" ATOMIC_OPS_WITHOUT_LIBATOMIC) diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 7e272ea26b0..e81582f0460 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -146,7 +146,7 @@ endif() if(WITH_COMPILER_ASAN AND MSVC AND NOT MSVC_CLANG) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.28.29828) #set a flag so we don't have to do this comparison all the time - SET(MSVC_ASAN ON) + set(MSVC_ASAN ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fsanitize=address") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address") string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /INCREMENTAL:NO") @@ -185,20 +185,20 @@ endif() if(WITH_WINDOWS_SCCACHE) - set(CMAKE_C_COMPILER_LAUNCHER sccache) - set(CMAKE_CXX_COMPILER_LAUNCHER sccache) + set(CMAKE_C_COMPILER_LAUNCHER sccache) + set(CMAKE_CXX_COMPILER_LAUNCHER sccache) + set(SYMBOL_FORMAT /Z7) + set(SYMBOL_FORMAT_RELEASE /Z7) +else() + unset(CMAKE_C_COMPILER_LAUNCHER) + unset(CMAKE_CXX_COMPILER_LAUNCHER) + if(MSVC_ASAN) set(SYMBOL_FORMAT /Z7) set(SYMBOL_FORMAT_RELEASE /Z7) -else() - unset(CMAKE_C_COMPILER_LAUNCHER) - unset(CMAKE_CXX_COMPILER_LAUNCHER) - if(MSVC_ASAN) - set(SYMBOL_FORMAT /Z7) - set(SYMBOL_FORMAT_RELEASE /Z7) - else() - set(SYMBOL_FORMAT /ZI) - set(SYMBOL_FORMAT_RELEASE /Zi) - endif() + else() + set(SYMBOL_FORMAT /ZI) + set(SYMBOL_FORMAT_RELEASE /Zi) + endif() endif() if(WITH_WINDOWS_PDB) @@ -416,7 +416,7 @@ if(WITH_CODEC_FFMPEG) ${LIBDIR}/ffmpeg/lib/avdevice.lib ${LIBDIR}/ffmpeg/lib/avutil.lib ${LIBDIR}/ffmpeg/lib/swscale.lib - ) + ) endif() endif() @@ -565,12 +565,14 @@ if(WITH_BOOST) if(WITH_CYCLES AND WITH_CYCLES_OSL) set(BOOST_LIBRARIES ${BOOST_LIBRARIES} optimized ${BOOST_LIBPATH}/libboost_wave-${BOOST_POSTFIX} - debug ${BOOST_LIBPATH}/libboost_wave-${BOOST_DEBUG_POSTFIX}) + debug ${BOOST_LIBPATH}/libboost_wave-${BOOST_DEBUG_POSTFIX} + ) endif() if(WITH_INTERNATIONAL) set(BOOST_LIBRARIES ${BOOST_LIBRARIES} optimized ${BOOST_LIBPATH}/libboost_locale-${BOOST_POSTFIX} - debug ${BOOST_LIBPATH}/libboost_locale-${BOOST_DEBUG_POSTFIX}) + debug ${BOOST_LIBPATH}/libboost_locale-${BOOST_DEBUG_POSTFIX} + ) endif() else() # we found boost using find_package set(BOOST_INCLUDE_DIR ${Boost_INCLUDE_DIRS}) @@ -677,7 +679,8 @@ if(WITH_OPENIMAGEDENOISE) optimized ${OPENIMAGEDENOISE_LIBPATH}/dnnl.lib debug ${OPENIMAGEDENOISE_LIBPATH}/OpenImageDenoise_d.lib debug ${OPENIMAGEDENOISE_LIBPATH}/common_d.lib - debug ${OPENIMAGEDENOISE_LIBPATH}/dnnl_d.lib) + debug ${OPENIMAGEDENOISE_LIBPATH}/dnnl_d.lib + ) set(OPENIMAGEDENOISE_DEFINITIONS) endif() @@ -832,7 +835,8 @@ if(WITH_CYCLES AND WITH_CYCLES_EMBREE) debug ${LIBDIR}/embree/lib/math_d.lib debug ${LIBDIR}/embree/lib/simd_d.lib debug ${LIBDIR}/embree/lib/sys_d.lib - debug ${LIBDIR}/embree/lib/tasking_d.lib) + debug ${LIBDIR}/embree/lib/tasking_d.lib + ) endif() endif() diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 11f48a72908..b9912929a54 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -200,8 +200,10 @@ if(WITH_BUILDINFO) SET_SOURCE_FILES_PROPERTIES(${buildinfo_h_fake} PROPERTIES SYMBOLIC TRUE) # a custom target that is always built - add_custom_target(buildinfo ALL - DEPENDS ${buildinfo_h_fake}) + add_custom_target( + buildinfo ALL + DEPENDS ${buildinfo_h_fake} + ) # creates buildinfo.h using cmake script add_custom_command( @@ -272,13 +274,13 @@ if(WITH_PYTHON_MODULE) else() add_executable(blender ${EXETYPE} ${SRC}) if(WIN32) - add_executable(blender-launcher WIN32 - blender_launcher_win32.c - ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.rc - ${CMAKE_BINARY_DIR}/blender.exe.manifest - ) - target_compile_definitions (blender-launcher PRIVATE -D_UNICODE -DUNICODE) - target_link_libraries(blender-launcher Pathcch.lib) + add_executable(blender-launcher WIN32 + blender_launcher_win32.c + ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.rc + ${CMAKE_BINARY_DIR}/blender.exe.manifest + ) + target_compile_definitions (blender-launcher PRIVATE -D_UNICODE -DUNICODE) + target_link_libraries(blender-launcher Pathcch.lib) endif() endif() @@ -405,8 +407,8 @@ if(WITH_INTERNATIONAL) # Create a custom target which will compile all po to mo add_custom_target( locales - DEPENDS ${_all_mo_files}) - + DEPENDS ${_all_mo_files} + ) add_dependencies(blender locales) # Generate INSTALL rules @@ -464,7 +466,8 @@ if(UNIX AND NOT APPLE) blender_man_page ALL COMMAND ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1.py --blender ${EXECUTABLE_OUTPUT_PATH}/blender - --output ${CMAKE_CURRENT_BINARY_DIR}/blender.1) + --output ${CMAKE_CURRENT_BINARY_DIR}/blender.1 + ) add_dependencies(blender_man_page blender) endif() endif() @@ -719,15 +722,15 @@ elseif(WIN32) if(WITH_OPENMP AND MSVC_CLANG) install( - FILES ${CLANG_OPENMP_DLL} - DESTINATION "." + FILES ${CLANG_OPENMP_DLL} + DESTINATION "." ) endif() if(WITH_FFTW3) install( - FILES ${LIBDIR}/fftw3/lib/libfftw3-3.dll - DESTINATION "." + FILES ${LIBDIR}/fftw3/lib/libfftw3-3.dll + DESTINATION "." ) endif() if(MSVC_ASAN) @@ -738,14 +741,14 @@ elseif(WIN32) message(FATAL_ERROR "Asan is enabled, but the ASAN runtime is not detected, this is an optional component during the MSVC install, please install it") endif() install( - FILES ${ASAN_DLL} - DESTINATION "." - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + FILES ${ASAN_DLL} + DESTINATION "." + CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel ) install( - FILES ${ASAN_DEBUG_DLL} - DESTINATION "." - CONFIGURATIONS Debug + FILES ${ASAN_DEBUG_DLL} + DESTINATION "." + CONFIGURATIONS Debug ) unset(ASAN_DLL) unset(ASAN_DEBUG_DLL) @@ -753,18 +756,18 @@ elseif(WIN32) if(WITH_GMP) install( - FILES ${LIBDIR}/gmp/lib/libgmp-10.dll - DESTINATION "." + FILES ${LIBDIR}/gmp/lib/libgmp-10.dll + DESTINATION "." ) install( - FILES ${LIBDIR}/gmp/lib/libgmpxx.dll - DESTINATION "." - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + FILES ${LIBDIR}/gmp/lib/libgmpxx.dll + DESTINATION "." + CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel ) install( - FILES ${LIBDIR}/gmp/lib/libgmpxx_d.dll - DESTINATION "." - CONFIGURATIONS Debug + FILES ${LIBDIR}/gmp/lib/libgmpxx_d.dll + DESTINATION "." + CONFIGURATIONS Debug ) endif() @@ -780,16 +783,16 @@ elseif(WIN32) endif() if(WITH_OPENVDB) - install( - FILES ${LIBDIR}/openvdb/bin/openvdb.dll - DESTINATION "." - CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel - ) - install( - FILES ${LIBDIR}/openvdb/bin/openvdb_d.dll - DESTINATION "." - CONFIGURATIONS Debug - ) + install( + FILES ${LIBDIR}/openvdb/bin/openvdb.dll + DESTINATION "." + CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel + ) + install( + FILES ${LIBDIR}/openvdb/bin/openvdb_d.dll + DESTINATION "." + CONFIGURATIONS Debug + ) endif() if(WITH_PYTHON) @@ -1054,7 +1057,8 @@ elseif(APPLE) set_target_properties(blender PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${OSX_APP_SOURCEDIR}/Contents/Info.plist MACOSX_BUNDLE_SHORT_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH}" - MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH} ${BLENDER_DATE}") + MACOSX_BUNDLE_LONG_VERSION_STRING "${BLENDER_VERSION}.${BLENDER_VERSION_PATCH} ${BLENDER_DATE}" + ) # Gather the date in finder-style execute_process(COMMAND date "+%m/%d/%Y/%H:%M" @@ -1151,9 +1155,10 @@ endif() if(DEFINED BLENDER_TEXT_FILES_DESTINATION) - configure_file(${CMAKE_SOURCE_DIR}/release/text/readme.html - ${CMAKE_BINARY_DIR}/release/text/readme.html - @ONLY + configure_file( + ${CMAKE_SOURCE_DIR}/release/text/readme.html + ${CMAKE_BINARY_DIR}/release/text/readme.html + @ONLY ) list(APPEND BLENDER_TEXT_FILES ${CMAKE_BINARY_DIR}/release/text/readme.html @@ -1240,17 +1245,18 @@ if(WIN32) set_target_properties(blender PROPERTIES VS_GLOBAL_VcpkgEnabled "false") set_target_properties(blender PROPERTIES PDB_NAME "blender_private" - PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>") - if(WITH_WINDOWS_PDB AND WITH_WINDOWS_STRIPPED_PDB) - # This is slightly messy, but single target generators like ninja will not have the - # CMAKE_CFG_INTDIR variable and multitarget generators like msbuild will not have - # CMAKE_BUILD_TYPE. This can be simplified by target_link_options and the $<CONFIG> - # generator expression in newer cmake (2.13+) but until that time this fill have suffice. - if(CMAKE_BUILD_TYPE) - set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/blender_public.pdb") - else() - set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/blender_public.pdb") - endif() + PDB_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>" + ) + if(WITH_WINDOWS_PDB AND WITH_WINDOWS_STRIPPED_PDB) + # This is slightly messy, but single target generators like ninja will not have the + # `CMAKE_CFG_INTDIR` variable and multi-target generators like `msbuild` will not have + # `CMAKE_BUILD_TYPE`. This can be simplified by target_link_options and the `$<CONFIG>` + # generator expression in newer CMAKE (2.13+) but until that time this fill have suffice. + if(CMAKE_BUILD_TYPE) + set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/blender_public.pdb") + else() + set_property(TARGET blender APPEND_STRING PROPERTY LINK_FLAGS " /PDBSTRIPPED:${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/blender_public.pdb") + endif() endif() endif() |