diff --git a/CMakeLists.txt b/CMakeLists.txt index e4f8cbc3776..4b0376802d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1040,6 +1040,9 @@ Include the files needed for debugging python scripts with visual studio 2017+." option(WITH_WINDOWS_BUNDLE_CRT "Bundle the C runtime for install free distribution." ON) mark_as_advanced(WITH_WINDOWS_BUNDLE_CRT) + option(WITH_WINDOWS_EXTERNAL_MANIFEST "Use external manifest files" OFF) + mark_as_advanced(WITH_WINDOWS_EXTERNAL_MANIFEST) + option(WITH_WINDOWS_SCCACHE "Use sccache to speed up builds (Ninja builder only)" OFF) mark_as_advanced(WITH_WINDOWS_SCCACHE) diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake index 327c7bb655f..a7caef16913 100644 --- a/build_files/cmake/platform/platform_win32.cmake +++ b/build_files/cmake/platform/platform_win32.cmake @@ -12,6 +12,10 @@ endif() if(CMAKE_C_COMPILER_ID MATCHES "Clang") set(MSVC_CLANG ON) + if(NOT WITH_WINDOWS_EXTERNAL_MANIFEST AND CMAKE_GENERATOR MATCHES "Visual Studio") + message(WARNING "WITH_WINDOWS_EXTERNAL_MANIFEST is required for clang and the visual studio generator, turning ON") + set(WITH_WINDOWS_EXTERNAL_MANIFEST ON) + endif() set(VC_TOOLS_DIR $ENV{VCToolsRedistDir} CACHE STRING "Location of the msvc redistributables") set(MSVC_REDIST_DIR ${VC_TOOLS_DIR}) if(DEFINED MSVC_REDIST_DIR) @@ -87,6 +91,10 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099") string(APPEND CMAKE_SHARED_LINKER_FLAGS " /SAFESEH:NO /ignore:4099") string(APPEND CMAKE_MODULE_LINKER_FLAGS " /SAFESEH:NO /ignore:4099") +if(WITH_WINDOWS_EXTERNAL_MANIFEST) + string(APPEND CMAKE_EXE_LINKER_FLAGS " /manifest:no") +endif() + list(APPEND PLATFORM_LINKLIBS ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 Comctl32 version advapi32 shfolder shell32 ole32 oleaut32 uuid psapi Dbghelp Shlwapi diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 885ea2510ae..bd2b83081f3 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -167,11 +167,15 @@ if(WIN32 AND NOT UNIX) -DBLEN_VER_RC_4=0 ) - list(APPEND SRC ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.rc - ${CMAKE_BINARY_DIR}/blender.exe.manifest ) + + if(NOT WITH_WINDOWS_EXTERNAL_MANIFEST) + list(APPEND SRC + ${CMAKE_BINARY_DIR}/blender.exe.manifest + ) + endif() endif() if(WITH_BUILDINFO) @@ -342,8 +346,12 @@ else() add_executable(blender-launcher WIN32 blender_launcher_win32.c ${CMAKE_SOURCE_DIR}/release/windows/icons/winblender.rc - ${CMAKE_BINARY_DIR}/blender.exe.manifest ) + if(NOT WITH_WINDOWS_EXTERNAL_MANIFEST) + list(APPEND SRC + ${CMAKE_BINARY_DIR}/blender.exe.manifest + ) + endif() target_compile_definitions (blender-launcher PRIVATE -D_UNICODE -DUNICODE) target_link_libraries(blender-launcher Pathcch.lib) endif() @@ -978,6 +986,17 @@ file(REMOVE ${CMAKE_BINARY_DIR}/bin/lib/libglapi.so.0.0.0)\n ) endif() elseif(WIN32) + if(WITH_WINDOWS_EXTERNAL_MANIFEST) + install( + FILES ${CMAKE_BINARY_DIR}/blender.exe.manifest + DESTINATION "." + ) + install( + FILES ${CMAKE_BINARY_DIR}/blender.exe.manifest + DESTINATION "." + RENAME blender-launcher.exe.manifest + ) + endif() windows_install_shared_manifest( FILES ${LIBDIR}/epoxy/bin/epoxy-0.dll ALL