build_environment: support for msvc2017 and newer cmake.
authorRay Molenkamp <github@lazydodo.com>
Sat, 2 Jun 2018 19:59:56 +0000 (13:59 -0600)
committerRay Molenkamp <github@lazydodo.com>
Sat, 2 Jun 2018 19:59:56 +0000 (13:59 -0600)
-expanded build_deps.cmd with 2017 support, it can't locate msvc2017 so needs to be run from developer prompt.
-Newer cmake was unhappy with openal's cmakelists.txt
-collada has warning as error on and errored out on new msvc2017 warnings.

build_files/build_environment/cmake/openal.cmake
build_files/build_environment/cmake/options.cmake
build_files/build_environment/patches/openal.diff [new file with mode: 0644]
build_files/build_environment/windows/build_deps.cmd

index 3331361bfbc97ae1b0d330c519a2c352f4623b1c..2af530069a5b05555ef319f82947b8d889d050cb 100644 (file)
@@ -39,5 +39,6 @@ if(BUILD_MODE STREQUAL Release)
                PREFIX ${BUILD_DIR}/openal
                CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openal ${DEFAULT_CMAKE_FLAGS} ${OPENAL_EXTRA_ARGS}
                INSTALL_DIR ${LIBDIR}/openal
+               PATCH_COMMAND ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/openal/src/external_openal < ${PATCH_DIR}/openal.diff 
        )
 endif()
index 2dcf653db43fba2108020f9a18898fdd2e6a1a42..2a89bd726c170acde25b4dd87ba59c0a4399a7f3 100644 (file)
@@ -56,24 +56,27 @@ if(WIN32)
        # For OIIO and OSL
        set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS)
 
-       # TODO FIXME highly MSVC specific
+       if(MSVC_VERSION GREATER 1909)
+               set(COMMON_MSVC_FLAGS "/Wv:18") #some deps with warnings as error aren't quite ready for dealing with the new 2017 warnings. 
+       endif()
+       
        if(WITH_OPTIMIZED_DEBUG)
-               set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+               set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
        else()
-               set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+               set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /D_DEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
        endif()
-       set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-       set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-       set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+       set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "/MT ${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+       set(BLENDER_CMAKE_C_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /DNDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+       set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
 
        if(WITH_OPTIMIZED_DEBUG)
-               set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+               set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
        else()
-               set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+               set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /D PLATFORM_WINDOWS /MTd  ${COMMON_MSVC_FLAGS} /Zi /Ob0 /Od /RTC1 /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
        endif()
-       set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG  /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-       set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
-       set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+       set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "/MT /${COMMON_MSVC_FLAGS} /O1 /Ob1 /D NDEBUG  /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+       set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "/MT ${COMMON_MSVC_FLAGS} /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
+       set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT ${COMMON_MSVC_FLAGS} /Zi /O2 /Ob1 /D NDEBUG /D PLATFORM_WINDOWS /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS")
 
        set(PLATFORM_FLAGS)
        set(PLATFORM_CXX_FLAGS)
diff --git a/build_files/build_environment/patches/openal.diff b/build_files/build_environment/patches/openal.diff
new file mode 100644 (file)
index 0000000..2c9862b
--- /dev/null
@@ -0,0 +1,13 @@
+diff -Naur external_openal_original/CMakeLists.txt external_openal/CMakeLists.txt
+--- external_openal_original/CMakeLists.txt    2016-01-24 20:12:39 -0700
++++ external_openal/CMakeLists.txt     2018-06-02 12:16:52 -0600
+@@ -885,7 +885,8 @@
+ OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF)
+ IF(HAVE_WINDOWS_H)
+     # Check MMSystem backend
+-    CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502)
++    set(CMAKE_REQUIRED_FLAGS "-D_WIN32_WINNT=0x0502")
++    CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H)
+     IF(HAVE_MMSYSTEM_H)
+         CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM)
+         IF(HAVE_LIBWINMM)
index 96280014df29365a4b5d0432cc550a5eda093ae8..500e689cdc865663ee354f4f354d28ad95a28aac 100644 (file)
@@ -14,10 +14,18 @@ if NOT "%1" == "" (
     set BuildDir=VS14
     goto par2
   )
+       if "%1" == "2017" (
+    echo "Building for VS2017"
+    set VSVER=15.0
+    set VSVER_SHORT=15
+    set BuildDir=VS15
+    goto par2
+  )
+  
 )
 :usage
 
-Echo Usage build_deps 2013/2015 x64/x86
+Echo Usage build_deps 2013/2015/2017 x64/x86
 goto exit
 :par2
 if NOT "%2" == "" (
@@ -31,6 +39,10 @@ if NOT "%2" == "" (
                if "%1" == "2015" (
                        set CMAKE_BUILDER=Visual Studio 14 2015
                )
+               if "%1" == "2017" (
+                       set CMAKE_BUILDER=Visual Studio 15 2017
+               )
+               
     goto start
   )
        if "%2" == "x64" (
@@ -43,6 +55,10 @@ if NOT "%2" == "" (
                if "%1" == "2015" (
                        set CMAKE_BUILDER=Visual Studio 14 2015 Win64
                )
+               if "%1" == "2017" (
+                       set CMAKE_BUILDER=Visual Studio 15 2017 Win64
+               )
+               
     goto start
   )
 )