Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'build_files/cmake')
-rw-r--r--build_files/cmake/Modules/FindGflags.cmake603
-rw-r--r--build_files/cmake/Modules/FindGlog.cmake226
-rw-r--r--build_files/cmake/Modules/FindOpenCOLLADA.cmake1
-rw-r--r--build_files/cmake/Modules/GTestTesting.cmake8
-rwxr-xr-xbuild_files/cmake/cmake_netbeans_project.py2
-rw-r--r--build_files/cmake/config/blender_full.cmake14
-rw-r--r--build_files/cmake/config/blender_release.cmake14
-rw-r--r--build_files/cmake/macros.cmake46
-rw-r--r--build_files/cmake/platform/platform_apple.cmake5
-rw-r--r--build_files/cmake/platform/platform_apple_xcode.cmake135
-rw-r--r--build_files/cmake/platform/platform_win32.cmake6
-rw-r--r--build_files/cmake/platform/platform_win32_mingw.cmake302
-rw-r--r--build_files/cmake/platform/platform_win32_msvc.cmake52
-rwxr-xr-xbuild_files/cmake/project_info.py2
14 files changed, 1029 insertions, 387 deletions
diff --git a/build_files/cmake/Modules/FindGflags.cmake b/build_files/cmake/Modules/FindGflags.cmake
new file mode 100644
index 00000000000..0a138c02465
--- /dev/null
+++ b/build_files/cmake/Modules/FindGflags.cmake
@@ -0,0 +1,603 @@
+# Ceres Solver - A fast non-linear least squares minimizer
+# Copyright 2015 Google Inc. All rights reserved.
+# http://ceres-solver.org/
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: alexs.mac@gmail.com (Alex Stewart)
+#
+
+# FindGflags.cmake - Find Google gflags logging library.
+#
+# This module will attempt to find gflags, either via an exported CMake
+# configuration (generated by gflags >= 2.1 which are built with CMake), or
+# by performing a standard search for all gflags components. The order of
+# precedence for these two methods of finding gflags is controlled by:
+# GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION.
+#
+# This module defines the following variables:
+#
+# GFLAGS_FOUND: TRUE iff gflags is found.
+# GFLAGS_INCLUDE_DIRS: Include directories for gflags.
+# GFLAGS_LIBRARIES: Libraries required to link gflags.
+# GFLAGS_NAMESPACE: The namespace in which gflags is defined. In versions of
+# gflags < 2.1, this was google, for versions >= 2.1 it is
+# by default gflags, although can be configured when building
+# gflags to be something else (i.e. google for legacy
+# compatibility).
+#
+# The following variables control the behaviour of this module when an exported
+# gflags CMake configuration is not found.
+#
+# GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION: TRUE/FALSE, iff TRUE then
+# then prefer using an exported CMake configuration
+# generated by gflags >= 2.1 over searching for the
+# gflags components manually. Otherwise (FALSE)
+# ignore any exported gflags CMake configurations and
+# always perform a manual search for the components.
+# Default: TRUE iff user does not define this variable
+# before we are called, and does NOT specify either
+# GFLAGS_INCLUDE_DIR_HINTS or GFLAGS_LIBRARY_DIR_HINTS
+# otherwise FALSE.
+# GFLAGS_INCLUDE_DIR_HINTS: List of additional directories in which to
+# search for gflags includes, e.g: /timbuktu/include.
+# GFLAGS_LIBRARY_DIR_HINTS: List of additional directories in which to
+# search for gflags libraries, e.g: /timbuktu/lib.
+# GFLAGS_ROOT_DIR, The base directory to search for Gflags.
+# This can also be an environment variable.
+#
+# The following variables are also defined by this module, but in line with
+# CMake recommended FindPackage() module style should NOT be referenced directly
+# by callers (use the plural variables detailed above instead). These variables
+# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
+# are NOT re-called (i.e. search for library is not repeated) if these variables
+# are set with valid values _in the CMake cache_. This means that if these
+# variables are set directly in the cache, either by the user in the CMake GUI,
+# or by the user passing -DVAR=VALUE directives to CMake when called (which
+# explicitly defines a cache variable), then they will be used verbatim,
+# bypassing the HINTS variables and other hard-coded search locations.
+#
+# GFLAGS_INCLUDE_DIR: Include directory for gflags, not including the
+# include directory of any dependencies.
+# GFLAGS_LIBRARY: gflags library, not including the libraries of any
+# dependencies.
+
+# If GFLAGS_ROOT_DIR was defined in the environment, use it.
+if(NOT GFLAGS_ROOT_DIR AND NOT $ENV{GFLAGS_ROOT_DIR} STREQUAL "")
+ set(GFLAGS_ROOT_DIR $ENV{GFLAGS_ROOT_DIR})
+endif()
+
+if(DEFINED GFLAGS_ROOT_DIR)
+ set(GFLAGS_ROOT_DIR_INCLUDE "${GFLAGS_ROOT_DIR}/include")
+ set(GFLAGS_ROOT_DIR_LIB "${GFLAGS_ROOT_DIR}/lib")
+endif()
+
+# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when FindGflags was
+# invoked, necessary for MSVC.
+macro(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
+ if(MSVC)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
+ endif()
+endmacro()
+
+# Called if we failed to find gflags or any of it's required dependencies,
+# unsets all public (designed to be used externally) variables and reports
+# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
+macro(GFLAGS_REPORT_NOT_FOUND REASON_MSG)
+ unset(GFLAGS_FOUND)
+ unset(GFLAGS_INCLUDE_DIRS)
+ unset(GFLAGS_LIBRARIES)
+ # Do not use unset, as we want to keep GFLAGS_NAMESPACE in the cache,
+ # but simply clear its value.
+ set(GFLAGS_NAMESPACE "" CACHE STRING
+ "gflags namespace (google or gflags)" FORCE)
+
+ # Make results of search visible in the CMake GUI if gflags has not
+ # been found so that user does not have to toggle to advanced view.
+ mark_as_advanced(CLEAR GFLAGS_INCLUDE_DIR
+ GFLAGS_LIBRARY
+ GFLAGS_NAMESPACE)
+
+ gflags_reset_find_library_prefix()
+
+ # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
+ # use the camelcase library name, not uppercase.
+ if(Gflags_FIND_QUIETLY)
+ message(STATUS "Failed to find gflags - " ${REASON_MSG} ${ARGN})
+ elseif(Gflags_FIND_REQUIRED)
+ message(FATAL_ERROR "Failed to find gflags - " ${REASON_MSG} ${ARGN})
+ else()
+ # Neither QUIETLY nor REQUIRED, use no priority which emits a message
+ # but continues configuration and allows generation.
+ message("-- Failed to find gflags - " ${REASON_MSG} ${ARGN})
+ endif()
+ return()
+endmacro()
+
+# Verify that all variable names passed as arguments are defined (can be empty
+# but must be defined) or raise a fatal error.
+macro(GFLAGS_CHECK_VARS_DEFINED)
+ foreach(CHECK_VAR ${ARGN})
+ if(NOT DEFINED ${CHECK_VAR})
+ message(FATAL_ERROR "Ceres Bug: ${CHECK_VAR} is not defined.")
+ endif()
+ endforeach()
+endmacro()
+
+# Use check_cxx_source_compiles() to compile trivial test programs to determine
+# the gflags namespace. This works on all OSs except Windows. If using Visual
+# Studio, it fails because msbuild forces check_cxx_source_compiles() to use
+# CMAKE_BUILD_TYPE=Debug for the test project, which usually breaks detection
+# because MSVC requires that the test project use the same build type as gflags,
+# which would normally be built in Release.
+#
+# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
+# which is blank (empty string, will test FALSE is CMake conditionals)
+# if detection failed.
+function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
+ # Verify that all required variables are defined.
+ gflags_check_vars_defined(
+ GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
+ # Ensure that GFLAGS_NAMESPACE is always unset on completion unless
+ # we explicitly set if after having the correct namespace.
+ set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
+
+ include(CheckCXXSourceCompiles)
+ # Setup include path & link library for gflags for CHECK_CXX_SOURCE_COMPILES.
+ set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
+ # First try the (older) google namespace. Note that the output variable
+ # MUST be unique to the build type as otherwise the test is not repeated as
+ # it is assumed to have already been performed.
+ check_cxx_source_compiles(
+ "#include <gflags/gflags.h>
+ int main(int argc, char * argv[]) {
+ google::ParseCommandLineFlags(&argc, &argv, true);
+ return 0;
+ }"
+ GFLAGS_IN_GOOGLE_NAMESPACE)
+ if(GFLAGS_IN_GOOGLE_NAMESPACE)
+ set(GFLAGS_NAMESPACE google PARENT_SCOPE)
+ return()
+ endif()
+
+ # Try (newer) gflags namespace instead. Note that the output variable
+ # MUST be unique to the build type as otherwise the test is not repeated as
+ # it is assumed to have already been performed.
+ set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
+ set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
+ check_cxx_source_compiles(
+ "#include <gflags/gflags.h>
+ int main(int argc, char * argv[]) {
+ gflags::ParseCommandLineFlags(&argc, &argv, true);
+ return 0;
+ }"
+ GFLAGS_IN_GFLAGS_NAMESPACE)
+ if(GFLAGS_IN_GFLAGS_NAMESPACE)
+ set(GFLAGS_NAMESPACE gflags PARENT_SCOPE)
+ return()
+ endif()
+endfunction()
+
+# Use regex on the gflags headers to attempt to determine the gflags namespace.
+# Checks both gflags.h (contained namespace on versions < 2.1.2) and
+# gflags_declare.h, which contains the namespace on versions >= 2.1.2.
+# In general, this method should only be used when
+# GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE() cannot be used, or has
+# failed.
+#
+# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
+# which is blank (empty string, will test FALSE is CMake conditionals)
+# if detection failed.
+function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
+ # Verify that all required variables are defined.
+ gflags_check_vars_defined(GFLAGS_INCLUDE_DIR)
+ # Ensure that GFLAGS_NAMESPACE is always undefined on completion unless
+ # we explicitly set if after having the correct namespace.
+ set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
+
+ # Scan gflags.h to identify what namespace gflags was built with. On
+ # versions of gflags < 2.1.2, gflags.h was configured with the namespace
+ # directly, on >= 2.1.2, gflags.h uses the GFLAGS_NAMESPACE #define which
+ # is defined in gflags_declare.h, we try each location in turn.
+ set(GFLAGS_HEADER_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
+ if(NOT EXISTS ${GFLAGS_HEADER_FILE})
+ gflags_report_not_found(
+ "Could not find file: ${GFLAGS_HEADER_FILE} "
+ "containing namespace information in gflags install located at: "
+ "${GFLAGS_INCLUDE_DIR}.")
+ endif()
+ file(READ ${GFLAGS_HEADER_FILE} GFLAGS_HEADER_FILE_CONTENTS)
+
+ string(REGEX MATCH "namespace [A-Za-z]+"
+ GFLAGS_NAMESPACE "${GFLAGS_HEADER_FILE_CONTENTS}")
+ string(REGEX REPLACE "namespace ([A-Za-z]+)" "\\1"
+ GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
+
+ if(NOT GFLAGS_NAMESPACE)
+ gflags_report_not_found(
+ "Failed to extract gflags namespace from header file: "
+ "${GFLAGS_HEADER_FILE}.")
+ endif()
+
+ if(GFLAGS_NAMESPACE STREQUAL "google" OR
+ GFLAGS_NAMESPACE STREQUAL "gflags")
+ # Found valid gflags namespace from gflags.h.
+ set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
+ return()
+ endif()
+
+ # Failed to find gflags namespace from gflags.h, gflags is likely a new
+ # version, check gflags_declare.h, which in newer versions (>= 2.1.2) contains
+ # the GFLAGS_NAMESPACE #define, which is then referenced in gflags.h.
+ set(GFLAGS_DECLARE_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags_declare.h)
+ if(NOT EXISTS ${GFLAGS_DECLARE_FILE})
+ gflags_report_not_found(
+ "Could not find file: ${GFLAGS_DECLARE_FILE} "
+ "containing namespace information in gflags install located at: "
+ "${GFLAGS_INCLUDE_DIR}.")
+ endif()
+ file(READ ${GFLAGS_DECLARE_FILE} GFLAGS_DECLARE_FILE_CONTENTS)
+
+ string(REGEX MATCH "#define GFLAGS_NAMESPACE [A-Za-z]+"
+ GFLAGS_NAMESPACE "${GFLAGS_DECLARE_FILE_CONTENTS}")
+ string(REGEX REPLACE "#define GFLAGS_NAMESPACE ([A-Za-z]+)" "\\1"
+ GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
+
+ if(NOT GFLAGS_NAMESPACE)
+ gflags_report_not_found(
+ "Failed to extract gflags namespace from declare file: "
+ "${GFLAGS_DECLARE_FILE}.")
+ endif()
+
+ if(GFLAGS_NAMESPACE STREQUAL "google" OR
+ GFLAGS_NAMESPACE STREQUAL "gflags")
+ # Found valid gflags namespace from gflags.h.
+ set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
+ return()
+ endif()
+endfunction()
+
+# -----------------------------------------------------------------
+# By default, if the user has expressed no preference for using an exported
+# gflags CMake configuration over performing a search for the installed
+# components, and has not specified any hints for the search locations, then
+# prefer a gflags exported configuration if available.
+if(NOT DEFINED GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION
+ AND NOT GFLAGS_INCLUDE_DIR_HINTS
+ AND NOT GFLAGS_LIBRARY_DIR_HINTS)
+ message(STATUS "No preference for use of exported gflags CMake configuration "
+ "set, and no hints for include/library directories provided. "
+ "Defaulting to preferring an installed/exported gflags CMake configuration "
+ "if available.")
+ set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE)
+endif()
+
+if(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
+ # Try to find an exported CMake configuration for gflags, as generated by
+ # gflags versions >= 2.1.
+ #
+ # We search twice, s/t we can invert the ordering of precedence used by
+ # find_package() for exported package build directories, and installed
+ # packages (found via CMAKE_SYSTEM_PREFIX_PATH), listed as items 6) and 7)
+ # respectively in [1].
+ #
+ # By default, exported build directories are (in theory) detected first, and
+ # this is usually the case on Windows. However, on OS X & Linux, the install
+ # path (/usr/local) is typically present in the PATH environment variable
+ # which is checked in item 4) in [1] (i.e. before both of the above, unless
+ # NO_SYSTEM_ENVIRONMENT_PATH is passed). As such on those OSs installed
+ # packages are usually detected in preference to exported package build
+ # directories.
+ #
+ # To ensure a more consistent response across all OSs, and as users usually
+ # want to prefer an installed version of a package over a locally built one
+ # where both exist (esp. as the exported build directory might be removed
+ # after installation), we first search with NO_CMAKE_PACKAGE_REGISTRY which
+ # means any build directories exported by the user are ignored, and thus
+ # installed directories are preferred. If this fails to find the package
+ # we then research again, but without NO_CMAKE_PACKAGE_REGISTRY, so any
+ # exported build directories will now be detected.
+ #
+ # To prevent confusion on Windows, we also pass NO_CMAKE_BUILDS_PATH (which
+ # is item 5) in [1]), to not preferentially use projects that were built
+ # recently with the CMake GUI to ensure that we always prefer an installed
+ # version if available.
+ #
+ # [1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package
+ find_package(gflags QUIET
+ NO_MODULE
+ NO_CMAKE_PACKAGE_REGISTRY
+ NO_CMAKE_BUILDS_PATH)
+ if(gflags_FOUND)
+ message(STATUS "Found installed version of gflags: ${gflags_DIR}")
+ else()
+ # Failed to find an installed version of gflags, repeat search allowing
+ # exported build directories.
+ message(STATUS "Failed to find installed gflags CMake configuration, "
+ "searching for gflags build directories exported with CMake.")
+ # Again pass NO_CMAKE_BUILDS_PATH, as we know that gflags is exported and
+ # do not want to treat projects built with the CMake GUI preferentially.
+ find_package(gflags QUIET
+ NO_MODULE
+ NO_CMAKE_BUILDS_PATH)
+ if(gflags_FOUND)
+ message(STATUS "Found exported gflags build directory: ${gflags_DIR}")
+ endif()
+ endif()
+
+ set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION ${gflags_FOUND})
+
+ # gflags v2.1 - 2.1.2 shipped with a bug in their gflags-config.cmake [1]
+ # whereby gflags_LIBRARIES = "gflags", but there was no imported target
+ # called "gflags", they were called: gflags[_nothreads]-[static/shared].
+ # As this causes linker errors when gflags is not installed in a location
+ # on the current library paths, detect if this problem is present and
+ # fix it.
+ #
+ # [1] https://github.com/gflags/gflags/issues/110
+ if(gflags_FOUND)
+ # NOTE: This is not written as additional conditions in the outer
+ # if(gflags_FOUND) as the NOT TARGET "${gflags_LIBRARIES}"
+ # condition causes problems if gflags is not found.
+ if(${gflags_VERSION} VERSION_LESS 2.1.3 AND
+ NOT TARGET "${gflags_LIBRARIES}")
+ message(STATUS "Detected broken gflags install in: ${gflags_DIR}, "
+ "version: ${gflags_VERSION} <= 2.1.2 which defines gflags_LIBRARIES = "
+ "${gflags_LIBRARIES} which is not an imported CMake target, see: "
+ "https://github.com/gflags/gflags/issues/110. Attempting to fix by "
+ "detecting correct gflags target.")
+ # Ordering here expresses preference for detection, specifically we do not
+ # want to use the _nothreads variants if the full library is available.
+ list(APPEND CHECK_GFLAGS_IMPORTED_TARGET_NAMES
+ gflags-shared gflags-static
+ gflags_nothreads-shared gflags_nothreads-static)
+ foreach(CHECK_GFLAGS_TARGET ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES})
+ if(TARGET ${CHECK_GFLAGS_TARGET})
+ message(STATUS "Found valid gflags target: ${CHECK_GFLAGS_TARGET}, "
+ "updating gflags_LIBRARIES.")
+ set(gflags_LIBRARIES ${CHECK_GFLAGS_TARGET})
+ break()
+ endif()
+ endforeach()
+ if(NOT TARGET ${gflags_LIBRARIES})
+ message(STATUS "Failed to fix detected broken gflags install in: "
+ "${gflags_DIR}, version: ${gflags_VERSION} <= 2.1.2, none of the "
+ "imported targets for gflags: ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES} "
+ "are defined. Will continue with a manual search for gflags "
+ "components. We recommend you build/install a version of gflags > "
+ "2.1.2 (or master).")
+ set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION FALSE)
+ endif()
+ endif()
+ endif()
+
+ if(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
+ message(STATUS "Detected gflags version: ${gflags_VERSION}")
+ set(GFLAGS_FOUND ${gflags_FOUND})
+ set(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR})
+ set(GFLAGS_LIBRARY ${gflags_LIBRARIES})
+
+ # gflags does not export the namespace in their CMake configuration, so
+ # use our function to determine what it should be, as it can be either
+ # gflags or google dependent upon version & configuration.
+ #
+ # NOTE: We use the regex method to determine the namespace here, as
+ # check_cxx_source_compiles() will not use imported targets, which
+ # is what gflags will be in this case.
+ gflags_check_gflags_namespace_using_regex()
+
+ if(NOT GFLAGS_NAMESPACE)
+ gflags_report_not_found(
+ "Failed to determine gflags namespace using regex for gflags "
+ "version: ${gflags_VERSION} exported here: ${gflags_DIR} using CMake.")
+ endif()
+ else()
+ message(STATUS "Failed to find an installed/exported CMake configuration "
+ "for gflags, will perform search for installed gflags components.")
+ endif()
+endif()
+
+if(NOT GFLAGS_FOUND)
+ # Either failed to find an exported gflags CMake configuration, or user
+ # told us not to use one. Perform a manual search for all gflags components.
+
+ # Handle possible presence of lib prefix for libraries on MSVC, see
+ # also GFLAGS_RESET_FIND_LIBRARY_PREFIX().
+ if(MSVC)
+ # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
+ # s/t we can set it back before returning.
+ set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ # The empty string in this list is important, it represents the case when
+ # the libraries have no prefix (shared libraries / DLLs).
+ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ endif()
+
+ # Search user-installed locations first, so that we prefer user installs
+ # to system installs where both exist.
+ list(APPEND GFLAGS_CHECK_INCLUDE_DIRS
+ ${GFLAGS_ROOT_DIR_INCLUDE}
+ /usr/local/include
+ /usr/local/homebrew/include # Mac OS X
+ /opt/local/var/macports/software # Mac OS X.
+ /opt/local/include
+ /usr/include
+ /sw/include # Fink
+ /opt/csw/include # Blastwave
+ /opt/lib/gflags/include)
+
+ list(APPEND GFLAGS_CHECK_PATH_SUFFIXES
+ gflags/include # Windows (for C:/Program Files prefix).
+ gflags/Include) # Windows (for C:/Program Files prefix).
+
+ list(APPEND GFLAGS_CHECK_LIBRARY_DIRS
+ ${GFLAGS_ROOT_DIR_LIB}
+ /usr/local/lib
+ /usr/local/homebrew/lib # Mac OS X.
+ /opt/local/lib
+ /usr/lib
+ /sw/lib # Fink
+ /opt/csw/lib # Blastwave
+ /opt/lib/gflags/lib)
+ list(APPEND GFLAGS_CHECK_LIBRARY_SUFFIXES
+ gflags/lib # Windows (for C:/Program Files prefix).
+ gflags/Lib) # Windows (for C:/Program Files prefix).
+
+ # Search supplied hint directories first if supplied.
+ find_path(GFLAGS_INCLUDE_DIR
+ NAMES gflags/gflags.h
+ PATHS ${GFLAGS_INCLUDE_DIR_HINTS}
+ ${GFLAGS_CHECK_INCLUDE_DIRS}
+ PATH_SUFFIXES ${GFLAGS_CHECK_PATH_SUFFIXES})
+ if(NOT GFLAGS_INCLUDE_DIR OR
+ NOT EXISTS ${GFLAGS_INCLUDE_DIR})
+ gflags_report_not_found(
+ "Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
+ "to directory containing gflags/gflags.h")
+ endif(NOT GFLAGS_INCLUDE_DIR OR
+ NOT EXISTS ${GFLAGS_INCLUDE_DIR})
+
+ find_library(GFLAGS_LIBRARY NAMES gflags
+ PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
+ ${GFLAGS_CHECK_LIBRARY_DIRS}
+ PATH_SUFFIXES ${GFLAGS_CHECK_LIBRARY_SUFFIXES})
+ if(NOT GFLAGS_LIBRARY OR
+ NOT EXISTS ${GFLAGS_LIBRARY})
+ gflags_report_not_found(
+ "Could not find gflags library, set GFLAGS_LIBRARY "
+ "to full path to libgflags.")
+ endif(NOT GFLAGS_LIBRARY OR
+ NOT EXISTS ${GFLAGS_LIBRARY})
+
+ # gflags typically requires a threading library (which is OS dependent), note
+ # that this defines the CMAKE_THREAD_LIBS_INIT variable. If we are able to
+ # detect threads, we assume that gflags requires it.
+ find_package(Threads QUIET)
+ set(GFLAGS_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+ # On Windows (including MinGW), the Shlwapi library is used by gflags if
+ # available.
+ if(WIN32)
+ include(CheckIncludeFileCXX)
+ check_include_file_cxx("shlwapi.h" HAVE_SHLWAPI)
+ if(HAVE_SHLWAPI)
+ list(APPEND GFLAGS_LINK_LIBRARIES shlwapi.lib)
+ endif()
+ endif()
+
+ # Mark internally as found, then verify. GFLAGS_REPORT_NOT_FOUND() unsets
+ # if called.
+ set(GFLAGS_FOUND TRUE)
+
+ # Identify what namespace gflags was built with.
+ if(GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
+ # To handle Windows peculiarities / CMake bugs on MSVC we try two approaches
+ # to detect the gflags namespace:
+ #
+ # 1) Try to use check_cxx_source_compiles() to compile a trivial program
+ # with the two choices for the gflags namespace.
+ #
+ # 2) [In the event 1) fails] Use regex on the gflags headers to try to
+ # determine the gflags namespace. Whilst this is less robust than 1),
+ # it does avoid any interaction with msbuild.
+ gflags_check_gflags_namespace_using_try_compile()
+
+ if(NOT GFLAGS_NAMESPACE)
+ # Failed to determine gflags namespace using check_cxx_source_compiles()
+ # method, try and obtain it using regex on the gflags headers instead.
+ message(STATUS "Failed to find gflags namespace using using "
+ "check_cxx_source_compiles(), trying namespace regex instead, "
+ "this is expected on Windows.")
+ gflags_check_gflags_namespace_using_regex()
+
+ if(NOT GFLAGS_NAMESPACE)
+ gflags_report_not_found(
+ "Failed to determine gflags namespace either by "
+ "check_cxx_source_compiles(), or namespace regex.")
+ endif()
+ endif()
+ endif()
+
+ # Make the GFLAGS_NAMESPACE a cache variable s/t the user can view it, and could
+ # overwrite it in the CMake GUI.
+ set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" CACHE STRING
+ "gflags namespace (google or gflags)" FORCE)
+
+ # gflags does not seem to provide any record of the version in its
+ # source tree, thus cannot extract version.
+
+ # Catch case when caller has set GFLAGS_NAMESPACE in the cache / GUI
+ # with an invalid value.
+ if(GFLAGS_NAMESPACE AND
+ NOT GFLAGS_NAMESPACE STREQUAL "google" AND
+ NOT GFLAGS_NAMESPACE STREQUAL "gflags")
+ gflags_report_not_found(
+ "Caller defined GFLAGS_NAMESPACE:"
+ " ${GFLAGS_NAMESPACE} is not valid, not google or gflags.")
+ endif()
+ # Catch case when caller has set GFLAGS_INCLUDE_DIR in the cache / GUI and
+ # thus FIND_[PATH/LIBRARY] are not called, but specified locations are
+ # invalid, otherwise we would report the library as found.
+ if(GFLAGS_INCLUDE_DIR AND
+ NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
+ gflags_report_not_found(
+ "Caller defined GFLAGS_INCLUDE_DIR:"
+ " ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
+ endif(GFLAGS_INCLUDE_DIR AND
+ NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
+ # TODO: This regex for gflags library is pretty primitive, we use lowercase
+ # for comparison to handle Windows using CamelCase library names, could
+ # this check be better?
+ string(TOLOWER "${GFLAGS_LIBRARY}" LOWERCASE_GFLAGS_LIBRARY)
+ if(GFLAGS_LIBRARY AND
+ NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
+ gflags_report_not_found(
+ "Caller defined GFLAGS_LIBRARY: "
+ "${GFLAGS_LIBRARY} does not match gflags.")
+ endif(GFLAGS_LIBRARY AND
+ NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
+
+ gflags_reset_find_library_prefix()
+
+endif()
+
+# Set standard CMake FindPackage variables if found.
+if(GFLAGS_FOUND)
+ set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
+ set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
+endif()
+
+# Handle REQUIRED / QUIET optional arguments.
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GFLAGS DEFAULT_MSG
+ GFLAGS_INCLUDE_DIRS GFLAGS_LIBRARIES GFLAGS_NAMESPACE)
+
+# Only mark internal variables as advanced if we found gflags, otherwise
+# leave them visible in the standard GUI for the user to set manually.
+if(GFLAGS_FOUND)
+ mark_as_advanced(FORCE GFLAGS_INCLUDE_DIR
+ GFLAGS_LIBRARY
+ GFLAGS_NAMESPACE
+ gflags_DIR) # Autogenerated by find_package(gflags)
+endif()
diff --git a/build_files/cmake/Modules/FindGlog.cmake b/build_files/cmake/Modules/FindGlog.cmake
new file mode 100644
index 00000000000..66c2aab2762
--- /dev/null
+++ b/build_files/cmake/Modules/FindGlog.cmake
@@ -0,0 +1,226 @@
+# Ceres Solver - A fast non-linear least squares minimizer
+# Copyright 2015 Google Inc. All rights reserved.
+# http://ceres-solver.org/
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of Google Inc. nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Author: alexs.mac@gmail.com (Alex Stewart)
+#
+
+# FindGlog.cmake - Find Google glog logging library.
+#
+# This module defines the following variables:
+#
+# GLOG_FOUND: TRUE iff glog is found.
+# GLOG_INCLUDE_DIRS: Include directories for glog.
+# GLOG_LIBRARIES: Libraries required to link glog.
+#
+# The following variables control the behaviour of this module:
+#
+# GLOG_INCLUDE_DIR_HINTS: List of additional directories in which to
+# search for glog includes, e.g: /timbuktu/include.
+# GLOG_LIBRARY_DIR_HINTS: List of additional directories in which to
+# search for glog libraries, e.g: /timbuktu/lib.
+# GFLOG_ROOT_DIR, The base directory to search for Glog.
+# This can also be an environment variable.
+#
+# The following variables are also defined by this module, but in line with
+# CMake recommended FindPackage() module style should NOT be referenced directly
+# by callers (use the plural variables detailed above instead). These variables
+# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
+# are NOT re-called (i.e. search for library is not repeated) if these variables
+# are set with valid values _in the CMake cache_. This means that if these
+# variables are set directly in the cache, either by the user in the CMake GUI,
+# or by the user passing -DVAR=VALUE directives to CMake when called (which
+# explicitly defines a cache variable), then they will be used verbatim,
+# bypassing the HINTS variables and other hard-coded search locations.
+#
+# GLOG_INCLUDE_DIR: Include directory for glog, not including the
+# include directory of any dependencies.
+# GLOG_LIBRARY: glog library, not including the libraries of any
+# dependencies.
+
+# If GLOG_ROOT_DIR was defined in the environment, use it.
+if(NOT GLOG_ROOT_DIR AND NOT $ENV{GLOG_ROOT_DIR} STREQUAL "")
+ set(GLOG_ROOT_DIR $ENV{GLOG_ROOT_DIR})
+endif()
+
+if(DEFINED GLOG_ROOT_DIR)
+ set(GLOG_ROOT_DIR_INCLUDE "${GLOG_ROOT_DIR}/include")
+ set(GLOG_ROOT_DIR_LIB "${GLOG_ROOT_DIR}/lib")
+endif()
+
+# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
+# FindGlog was invoked.
+macro(GLOG_RESET_FIND_LIBRARY_PREFIX)
+ if(MSVC)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
+ endif()
+endmacro()
+
+# Called if we failed to find glog or any of it's required dependencies,
+# unsets all public (designed to be used externally) variables and reports
+# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
+macro(GLOG_REPORT_NOT_FOUND REASON_MSG)
+ unset(GLOG_FOUND)
+ unset(GLOG_INCLUDE_DIRS)
+ unset(GLOG_LIBRARIES)
+ # Make results of search visible in the CMake GUI if glog has not
+ # been found so that user does not have to toggle to advanced view.
+ mark_as_advanced(CLEAR GLOG_INCLUDE_DIR
+ GLOG_LIBRARY)
+
+ glog_reset_find_library_prefix()
+
+ # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
+ # use the camelcase library name, not uppercase.
+ if(Glog_FIND_QUIETLY)
+ message(STATUS "Failed to find glog - " ${REASON_MSG} ${ARGN})
+ elseif(Glog_FIND_REQUIRED)
+ message(FATAL_ERROR "Failed to find glog - " ${REASON_MSG} ${ARGN})
+ else()
+ # Neither QUIETLY nor REQUIRED, use no priority which emits a message
+ # but continues configuration and allows generation.
+ message("-- Failed to find glog - " ${REASON_MSG} ${ARGN})
+ endif()
+ return()
+endmacro()
+
+# Handle possible presence of lib prefix for libraries on MSVC, see
+# also GLOG_RESET_FIND_LIBRARY_PREFIX().
+if(MSVC)
+ # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
+ # s/t we can set it back before returning.
+ set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
+ # The empty string in this list is important, it represents the case when
+ # the libraries have no prefix (shared libraries / DLLs).
+ set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
+endif()
+
+# Search user-installed locations first, so that we prefer user installs
+# to system installs where both exist.
+list(APPEND GLOG_CHECK_INCLUDE_DIRS
+ ${GLOG_ROOT_DIR_INCLUDE}
+ /usr/local/include
+ /usr/local/homebrew/include # Mac OS X
+ /opt/local/var/macports/software # Mac OS X.
+ /opt/local/include
+ /usr/include
+ /sw/include # Fink
+ /opt/csw/include # Blastwave
+ /opt/lib/glog/include)
+# Windows (for C:/Program Files prefix).
+list(APPEND GLOG_CHECK_PATH_SUFFIXES
+ glog/include
+ glog/Include
+ Glog/include
+ Glog/Include)
+
+list(APPEND GLOG_CHECK_LIBRARY_DIRS
+ ${GLOG_ROOT_DIR_LIB}
+ /usr/local/lib
+ /usr/local/homebrew/lib # Mac OS X.
+ /opt/local/lib
+ /usr/lib
+ /sw/lib # Fink
+ /opt/csw/lib # Blastwave
+ /opt/lib/gflags/lib)
+# Windows (for C:/Program Files prefix).
+list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES
+ glog/lib
+ glog/Lib
+ Glog/lib
+ Glog/Lib)
+
+# Search supplied hint directories first if supplied.
+find_path(GLOG_INCLUDE_DIR
+ NAMES glog/logging.h
+ PATHS ${GLOG_INCLUDE_DIR_HINTS}
+ ${GLOG_CHECK_INCLUDE_DIRS}
+ PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES})
+if(NOT GLOG_INCLUDE_DIR OR
+ NOT EXISTS ${GLOG_INCLUDE_DIR})
+ glog_report_not_found(
+ "Could not find glog include directory, set GLOG_INCLUDE_DIR "
+ "to directory containing glog/logging.h")
+endif()
+
+find_library(GLOG_LIBRARY NAMES glog
+ PATHS ${GLOG_LIBRARY_DIR_HINTS}
+ ${GLOG_CHECK_LIBRARY_DIRS}
+ PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES})
+if(NOT GLOG_LIBRARY OR
+ NOT EXISTS ${GLOG_LIBRARY})
+ glog_report_not_found(
+ "Could not find glog library, set GLOG_LIBRARY "
+ "to full path to libglog.")
+endif()
+
+# Mark internally as found, then verify. GLOG_REPORT_NOT_FOUND() unsets
+# if called.
+set(GLOG_FOUND TRUE)
+
+# Glog does not seem to provide any record of the version in its
+# source tree, thus cannot extract version.
+
+# Catch case when caller has set GLOG_INCLUDE_DIR in the cache / GUI and
+# thus FIND_[PATH/LIBRARY] are not called, but specified locations are
+# invalid, otherwise we would report the library as found.
+if(GLOG_INCLUDE_DIR AND
+ NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h)
+ glog_report_not_found(
+ "Caller defined GLOG_INCLUDE_DIR:"
+ " ${GLOG_INCLUDE_DIR} does not contain glog/logging.h header.")
+endif()
+# TODO: This regex for glog library is pretty primitive, we use lowercase
+# for comparison to handle Windows using CamelCase library names, could
+# this check be better?
+string(TOLOWER "${GLOG_LIBRARY}" LOWERCASE_GLOG_LIBRARY)
+if(GLOG_LIBRARY AND
+ NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
+ glog_report_not_found(
+ "Caller defined GLOG_LIBRARY: "
+ "${GLOG_LIBRARY} does not match glog.")
+endif()
+
+# Set standard CMake FindPackage variables if found.
+if(GLOG_FOUND)
+ set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
+ set(GLOG_LIBRARIES ${GLOG_LIBRARY})
+endif()
+
+glog_reset_find_library_prefix()
+
+# Handle REQUIRED / QUIET optional arguments.
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLOG DEFAULT_MSG
+ GLOG_INCLUDE_DIRS GLOG_LIBRARIES)
+
+# Only mark internal variables as advanced if we found glog, otherwise
+# leave them visible in the standard GUI for the user to set manually.
+if(GLOG_FOUND)
+ mark_as_advanced(FORCE GLOG_INCLUDE_DIR
+ GLOG_LIBRARY)
+endif()
diff --git a/build_files/cmake/Modules/FindOpenCOLLADA.cmake b/build_files/cmake/Modules/FindOpenCOLLADA.cmake
index 1c10d5a71de..63bc520ea15 100644
--- a/build_files/cmake/Modules/FindOpenCOLLADA.cmake
+++ b/build_files/cmake/Modules/FindOpenCOLLADA.cmake
@@ -83,6 +83,7 @@ FOREACH(COMPONENT ${_opencollada_FIND_INCLUDES})
# but this is less trouble, just looks strange.
include/opencollada/${COMPONENT}
include/${COMPONENT}/include
+ include/${COMPONENT}
HINTS
${_opencollada_SEARCH_DIRS}
)
diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake
index e688db35ef1..ba1334d750e 100644
--- a/build_files/cmake/Modules/GTestTesting.cmake
+++ b/build_files/cmake/Modules/GTestTesting.cmake
@@ -20,8 +20,8 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
set(TEST_INC
${_current_include_directories}
${CMAKE_SOURCE_DIR}/tests/gtests
- ${CMAKE_SOURCE_DIR}/extern/glog/src
- ${CMAKE_SOURCE_DIR}/extern/gflags/src
+ ${GLOG_INCLUDE_DIRS}
+ ${GFLAGS_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/extern/gtest/include
${CMAKE_SOURCE_DIR}/extern/gmock/include
)
@@ -37,8 +37,8 @@ macro(BLENDER_SRC_GTEST_EX NAME SRC EXTRA_LIBS DO_ADD_TEST)
extern_gmock
# needed for glog
${PTHREADS_LIBRARIES}
- extern_glog
- extern_gflags)
+ ${GLOG_LIBRARIES}
+ ${GFLAGS_LIBRARIES})
if(WITH_OPENMP_STATIC)
target_link_libraries(${NAME}_test ${OpenMP_LIBRARIES})
endif()
diff --git a/build_files/cmake/cmake_netbeans_project.py b/build_files/cmake/cmake_netbeans_project.py
index 5b074b6975a..97eb6b245f5 100755
--- a/build_files/cmake/cmake_netbeans_project.py
+++ b/build_files/cmake/cmake_netbeans_project.py
@@ -84,7 +84,7 @@ def create_nb_project_main():
make_exe = cmake_cache_var("CMAKE_MAKE_PROGRAM")
make_exe_basename = os.path.basename(make_exe)
- # --------------- NB spesific
+ # --------------- NB specific
defines = [("%s=%s" % cdef) if cdef[1] else cdef[0] for cdef in defines]
defines += [cdef.replace("#define", "").strip() for cdef in cmake_compiler_defines()]
diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake
index cb18500c7ca..62e2ce1636d 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -63,16 +63,12 @@ if(UNIX AND NOT APPLE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(WIN32)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
- if(NOT CMAKE_COMPILER_IS_GNUCC)
- set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
- else()
- # MinGW exceptions
- set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
- set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
- set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
- endif()
+ set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
- set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
+ set(WITH_CODEC_QUICKTIME OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
+
+# include("${CMAKE_CURRENT_SOURCE_DIR}/../platform/platform_apple_xcode.cmake")
+# apple_check_quicktime()
endif()
diff --git a/build_files/cmake/config/blender_release.cmake b/build_files/cmake/config/blender_release.cmake
index 050db91e75e..3e2e26e6a44 100644
--- a/build_files/cmake/config/blender_release.cmake
+++ b/build_files/cmake/config/blender_release.cmake
@@ -64,16 +64,12 @@ if(UNIX AND NOT APPLE)
set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(WIN32)
set(WITH_JACK OFF CACHE BOOL "" FORCE)
- if(NOT CMAKE_COMPILER_IS_GNUCC)
- set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
- else()
- # MinGW exceptions
- set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
- set(WITH_CODEC_SNDFILE OFF CACHE BOOL "" FORCE)
- set(WITH_CYCLES_OSL OFF CACHE BOOL "" FORCE)
- endif()
+ set(WITH_OPENSUBDIV ON CACHE BOOL "" FORCE)
elseif(APPLE)
set(WITH_JACK ON CACHE BOOL "" FORCE)
- set(WITH_CODEC_QUICKTIME ON CACHE BOOL "" FORCE)
+ set(WITH_CODEC_QUICKTIME OFF CACHE BOOL "" FORCE)
set(WITH_OPENSUBDIV OFF CACHE BOOL "" FORCE)
+
+# include("${CMAKE_CURRENT_SOURCE_DIR}/../platform/platform_apple_xcode.cmake")
+# apple_check_quicktime()
endif()
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index b7f6649e507..6303119773d 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -491,6 +491,12 @@ function(setup_liblinks
target_link_libraries(${target} ${NDOF_LIBRARIES})
endif()
endif()
+ if(WITH_SYSTEM_GLOG)
+ target_link_libraries(${target} ${GLOG_LIBRARIES})
+ endif()
+ if(WITH_SYSTEM_GFLAGS)
+ target_link_libraries(${target} ${GFLAGS_LIBRARIES})
+ endif()
# We put CLEW and CUEW here because OPENSUBDIV_LIBRARIES dpeends on them..
if(WITH_CYCLES OR WITH_COMPOSITOR OR WITH_OPENSUBDIV)
@@ -658,13 +664,19 @@ function(SETUP_BLENDER_SORTED_LIBS)
extern_rangetree
extern_wcwidth
bf_intern_libmv
- extern_glog
- extern_gflags
extern_sdlew
bf_intern_glew_mx
)
+ if(NOT WITH_SYSTEM_GLOG)
+ list(APPEND BLENDER_SORTED_LIBS extern_glog)
+ endif()
+
+ if(NOT WITH_SYSTEM_GFLAGS)
+ list(APPEND BLENDER_SORTED_LIBS extern_gflags)
+ endif()
+
if(WITH_COMPOSITOR)
# added for opencl compositor
list_insert_before(BLENDER_SORTED_LIBS "bf_blenkernel" "bf_compositor")
@@ -1235,17 +1247,6 @@ endfunction()
# hacks to override initial project settings
# these macros must be called directly before/after project(Blender)
macro(blender_project_hack_pre)
- # ----------------
- # MINGW HACK START
- # ignore system set flag, use our own
- # must be before project(...)
- # if the user wants to add their own its ok after first run.
- if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
- set(_reset_standard_libraries OFF)
- else()
- set(_reset_standard_libraries ON)
- endif()
-
# ------------------
# GCC -O3 HACK START
# needed because O3 can cause problems but
@@ -1264,25 +1265,6 @@ endmacro()
macro(blender_project_hack_post)
- # --------------
- # MINGW HACK END
- if(_reset_standard_libraries)
- # Must come after projecINCt(...)
- #
- # MINGW workaround for -ladvapi32 being included which surprisingly causes
- # string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
- # with a meaningless stack trace. by overriding this flag we ensure we only
- # have libs we define.
- set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
- set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
- mark_as_advanced(
- CMAKE_C_STANDARD_LIBRARIES
- CMAKE_CXX_STANDARD_LIBRARIES
- )
- endif()
- unset(_reset_standard_libraries)
-
-
# ----------------
# GCC -O3 HACK END
if(_reset_standard_cflags_rel)
diff --git a/build_files/cmake/platform/platform_apple.cmake b/build_files/cmake/platform/platform_apple.cmake
index 04485e31d98..6105f2e04de 100644
--- a/build_files/cmake/platform/platform_apple.cmake
+++ b/build_files/cmake/platform/platform_apple.cmake
@@ -23,6 +23,10 @@
# Libraries configuration for Apple.
+macro(find_package_wrapper)
+# do nothing, just satisfy the macro
+endmacro()
+
if(NOT DEFINED LIBDIR)
if(WITH_CXX11)
set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/darwin)
@@ -52,6 +56,7 @@ if(WITH_ALEMBIC)
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
set(ALEMBIC_LIBRARIES Alembic)
+ set(ALEMBIC_FOUND ON)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
diff --git a/build_files/cmake/platform/platform_apple_xcode.cmake b/build_files/cmake/platform/platform_apple_xcode.cmake
new file mode 100644
index 00000000000..e76a7783939
--- /dev/null
+++ b/build_files/cmake/platform/platform_apple_xcode.cmake
@@ -0,0 +1,135 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2016, Blender Foundation
+# All rights reserved.
+#
+# Contributor(s): Jacques Beaurain.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+# Xcode and system configuration for Apple.
+
+# require newer cmake on osx because of version handling,
+# older cmake cannot handle 2 digit subversion!
+cmake_minimum_required(VERSION 3.0.0)
+
+if(NOT CMAKE_OSX_ARCHITECTURES)
+ set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
+ "Choose the architecture you want to build Blender for: i386, x86_64 or ppc"
+ FORCE)
+endif()
+
+if(NOT DEFINED OSX_SYSTEM)
+ execute_process(
+ COMMAND xcodebuild -version -sdk macosx SDKVersion
+ OUTPUT_VARIABLE OSX_SYSTEM
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif()
+
+# workaround for incorrect cmake xcode lookup for developer previews - XCODE_VERSION does not
+# take xcode-select path into account but would always look into /Applications/Xcode.app
+# while dev versions are named Xcode<version>-DP<preview_number>
+execute_process(
+ COMMAND xcode-select --print-path
+ OUTPUT_VARIABLE XCODE_CHECK OUTPUT_STRIP_TRAILING_WHITESPACE)
+string(REPLACE "/Contents/Developer" "" XCODE_BUNDLE ${XCODE_CHECK}) # truncate to bundlepath in any case
+
+if(${CMAKE_GENERATOR} MATCHES "Xcode")
+
+ # earlier xcode has no bundled developer dir, no sense in getting xcode path from
+ if(${XCODE_VERSION} VERSION_GREATER 4.2)
+ # reduce to XCode name without dp extension
+ string(SUBSTRING "${XCODE_CHECK}" 14 6 DP_NAME)
+ if(${DP_NAME} MATCHES Xcode5)
+ set(XCODE_VERSION 5)
+ endif()
+ endif()
+
+ ##### cmake incompatibility with xcode 4.3 and higher #####
+ if(${XCODE_VERSION} MATCHES '') # cmake fails due looking for xcode in the wrong path, thus will be empty var
+ message(FATAL_ERROR "Xcode 4.3 and higher must be used with cmake 2.8-8 or higher")
+ endif()
+ ### end cmake incompatibility with xcode 4.3 and higher ###
+
+ if(${XCODE_VERSION} VERSION_EQUAL 4 OR ${XCODE_VERSION} VERSION_GREATER 4 AND ${XCODE_VERSION} VERSION_LESS 4.3)
+ # Xcode 4 defaults to the Apple LLVM Compiler.
+ # Override the default compiler selection because Blender only compiles with gcc up to xcode 4.2
+ set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvmgcc42")
+ message(STATUS "Setting compiler to: " ${CMAKE_XCODE_ATTRIBUTE_GCC_VERSION})
+ endif()
+else() # unix makefile generator does not fill XCODE_VERSION var, so we get it with a command
+ execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE XCODE_VERS_BUILD_NR)
+ string(SUBSTRING "${XCODE_VERS_BUILD_NR}" 6 3 XCODE_VERSION) # truncate away build-nr
+ unset(XCODE_VERS_BUILD_NR)
+endif()
+
+message(STATUS "Detected OS X ${OSX_SYSTEM} and Xcode ${XCODE_VERSION} at ${XCODE_BUNDLE}")
+
+if(${XCODE_VERSION} VERSION_LESS 4.3)
+ # use guaranteed existing sdk
+ set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk CACHE PATH "" FORCE)
+else()
+ # note: xcode-select path could be ambigous,
+ # cause /Applications/Xcode.app/Contents/Developer or /Applications/Xcode.app would be allowed
+ # so i use a selfcomposed bundlepath here
+ set(OSX_SYSROOT_PREFIX ${XCODE_BUNDLE}/Contents/Developer/Platforms/MacOSX.platform)
+ message(STATUS "OSX_SYSROOT_PREFIX: " ${OSX_SYSROOT_PREFIX})
+ set(OSX_DEVELOPER_PREFIX /Developer/SDKs/MacOSX${OSX_SYSTEM}.sdk) # use guaranteed existing sdk
+ set(CMAKE_OSX_SYSROOT ${OSX_SYSROOT_PREFIX}/${OSX_DEVELOPER_PREFIX} CACHE PATH "" FORCE)
+ if(${CMAKE_GENERATOR} MATCHES "Xcode")
+ # to silence sdk not found warning, just overrides CMAKE_OSX_SYSROOT
+ set(CMAKE_XCODE_ATTRIBUTE_SDKROOT macosx${OSX_SYSTEM})
+ endif()
+endif()
+
+if(OSX_SYSTEM MATCHES 10.9)
+ # make sure syslibs and headers are looked up in sdk ( expecially for 10.9 openGL atm. )
+ set(CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT})
+endif()
+
+if(WITH_CXX11)
+ # 10.9 is our min. target, if you use higher sdk, weak linking happens
+ if(CMAKE_OSX_DEPLOYMENT_TARGET)
+ if(${CMAKE_OSX_DEPLOYMENT_TARGET} VERSION_LESS 10.9)
+ message(STATUS "Setting deployment target to 10.9, lower versions are incompatible with WITH_CXX11")
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE)
+ endif()
+ else()
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "" FORCE)
+ endif()
+else()
+ if(NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+ # 10.6 is our min. target, if you use higher sdk, weak linking happens
+ set(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING "" FORCE)
+ endif()
+endif()
+
+if(NOT ${CMAKE_GENERATOR} MATCHES "Xcode")
+ # force CMAKE_OSX_DEPLOYMENT_TARGET for makefiles, will not work else ( cmake bug ? )
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}")
+ add_definitions("-DMACOSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET}")
+endif()
+
+macro(apple_check_quicktime)
+ # QuickTime framework is no longer available in SDK 10.12+
+ if(WITH_CODEC_QUICKTIME AND ${OSX_SYSTEM} VERSION_GREATER 10.11)
+ set(WITH_CODEC_QUICKTIME OFF CACHE BOOL "" FORCE)
+ message(STATUS "QuickTime not supported by SDK ${OSX_SYSTEM}, disabling WITH_CODEC_QUICKTIME")
+ endif()
+endmacro()
+
diff --git a/build_files/cmake/platform/platform_win32.cmake b/build_files/cmake/platform/platform_win32.cmake
index 631973b758b..2f5d41dac32 100644
--- a/build_files/cmake/platform/platform_win32.cmake
+++ b/build_files/cmake/platform/platform_win32.cmake
@@ -27,12 +27,10 @@ add_definitions(-DWIN32)
if(MSVC)
include(platform_win32_msvc)
-elseif(CMAKE_COMPILER_IS_GNUCC)
- include(platform_win32_mingw)
+else()
+ message(FATAL_ERROR "Compiler is unsupported")
endif()
-# Things common to both mingw and MSVC should go here
-
set(WINTAB_INC ${LIBDIR}/wintab/include)
if(WITH_OPENAL)
diff --git a/build_files/cmake/platform/platform_win32_mingw.cmake b/build_files/cmake/platform/platform_win32_mingw.cmake
deleted file mode 100644
index 216568bd069..00000000000
--- a/build_files/cmake/platform/platform_win32_mingw.cmake
+++ /dev/null
@@ -1,302 +0,0 @@
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# The Original Code is Copyright (C) 2016, Blender Foundation
-# All rights reserved.
-#
-# Contributor(s): Sergey Sharybin.
-#
-# ***** END GPL LICENSE BLOCK *****
-
-# Libraries configuration for Windows when compiling with MinGW.
-
-# keep GCC specific stuff here
-include(CheckCSourceCompiles)
-# Setup 64bit and 64bit windows systems
-CHECK_C_SOURCE_COMPILES("
- #ifndef __MINGW64__
- #error
- #endif
- int main(void) { return 0; }
- "
- WITH_MINGW64
-)
-
-if(NOT DEFINED LIBDIR)
- if(WITH_MINGW64)
- message(STATUS "Compiling for 64 bit with MinGW-w64.")
- set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw64)
- else()
- message(STATUS "Compiling for 32 bit with MinGW-w32.")
- set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/mingw32)
-
- if(WITH_RAYOPTIMIZATION)
- message(WARNING "MinGW-w32 is known to be unstable with 'WITH_RAYOPTIMIZATION' option enabled.")
- endif()
- endif()
-else()
- message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}")
-endif()
-if(NOT EXISTS "${LIBDIR}/")
- message(FATAL_ERROR "Windows requires pre-compiled libs at: '${LIBDIR}'")
-endif()
-
-list(APPEND PLATFORM_LINKLIBS
- -lshell32 -lshfolder -lgdi32 -lmsvcrt -lwinmm -lmingw32 -lm -lws2_32
- -lz -lstdc++ -lole32 -luuid -lwsock32 -lpsapi -ldbghelp
-)
-
-if(WITH_INPUT_IME)
- list(APPEND PLATFORM_LINKLIBS -limm32)
-endif()
-
-set(PLATFORM_CFLAGS "-pipe -funsigned-char -fno-strict-aliasing")
-
-if(WITH_MINGW64)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
- list(APPEND PLATFORM_LINKLIBS -lpthread)
-
- add_definitions(-DFREE_WINDOWS64 -DMS_WIN64)
-endif()
-
-add_definitions(-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
-
-add_definitions(-DFREE_WINDOWS)
-
-set(PNG "${LIBDIR}/png")
-set(PNG_INCLUDE_DIRS "${PNG}/include")
-set(PNG_LIBPATH ${PNG}/lib) # not cmake defined
-
-if(WITH_MINGW64)
- set(JPEG_LIBRARIES jpeg)
-else()
- set(JPEG_LIBRARIES libjpeg)
-endif()
-set(PNG_LIBRARIES png)
-
-set(ZLIB ${LIBDIR}/zlib)
-set(ZLIB_INCLUDE_DIRS ${ZLIB}/include)
-set(ZLIB_LIBPATH ${ZLIB}/lib)
-set(ZLIB_LIBRARIES z)
-
-set(JPEG "${LIBDIR}/jpeg")
-set(JPEG_INCLUDE_DIR "${JPEG}/include")
-set(JPEG_LIBPATH ${JPEG}/lib) # not cmake defined
-
-# comes with own pthread library
-if(NOT WITH_MINGW64)
- set(PTHREADS ${LIBDIR}/pthreads)
- #set(PTHREADS_INCLUDE_DIRS ${PTHREADS}/include)
- set(PTHREADS_LIBPATH ${PTHREADS}/lib)
- set(PTHREADS_LIBRARIES pthreadGC2)
-endif()
-
-set(FREETYPE ${LIBDIR}/freetype)
-set(FREETYPE_INCLUDE_DIRS ${FREETYPE}/include ${FREETYPE}/include/freetype2)
-set(FREETYPE_LIBPATH ${FREETYPE}/lib)
-set(FREETYPE_LIBRARY freetype)
-
-if(WITH_FFTW3)
- set(FFTW3 ${LIBDIR}/fftw3)
- set(FFTW3_LIBRARIES fftw3)
- set(FFTW3_INCLUDE_DIRS ${FFTW3}/include)
- set(FFTW3_LIBPATH ${FFTW3}/lib)
-endif()
-
-if(WITH_OPENCOLLADA)
- set(OPENCOLLADA ${LIBDIR}/opencollada)
- set(OPENCOLLADA_INCLUDE_DIRS
- ${OPENCOLLADA}/include/opencollada/COLLADAStreamWriter
- ${OPENCOLLADA}/include/opencollada/COLLADABaseUtils
- ${OPENCOLLADA}/include/opencollada/COLLADAFramework
- ${OPENCOLLADA}/include/opencollada/COLLADASaxFrameworkLoader
- ${OPENCOLLADA}/include/opencollada/GeneratedSaxParser
- )
- set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib/opencollada)
- set(OPENCOLLADA_LIBRARIES
- OpenCOLLADAStreamWriter
- OpenCOLLADASaxFrameworkLoader
- OpenCOLLADAFramework
- OpenCOLLADABaseUtils
- GeneratedSaxParser
- UTF MathMLSolver buffer ftoa xml
- )
- set(PCRE_LIBRARIES pcre)
-endif()
-
-if(WITH_CODEC_FFMPEG)
- set(FFMPEG ${LIBDIR}/ffmpeg)
- set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
- if(WITH_MINGW64)
- set(FFMPEG_LIBRARIES avcodec.dll avformat.dll avdevice.dll avutil.dll swscale.dll swresample.dll)
- else()
- set(FFMPEG_LIBRARIES avcodec-55 avformat-55 avdevice-55 avutil-52 swscale-2)
- endif()
- set(FFMPEG_LIBPATH ${FFMPEG}/lib)
-endif()
-
-if(WITH_IMAGE_OPENEXR)
- set(OPENEXR ${LIBDIR}/openexr)
- set(OPENEXR_INCLUDE_DIR ${OPENEXR}/include)
- set(OPENEXR_INCLUDE_DIRS ${OPENEXR}/include/OpenEXR)
- set(OPENEXR_LIBRARIES Half IlmImf Imath IlmThread Iex)
- set(OPENEXR_LIBPATH ${OPENEXR}/lib)
-endif()
-
-if(WITH_IMAGE_TIFF)
- set(TIFF ${LIBDIR}/tiff)
- set(TIFF_LIBRARY tiff)
- set(TIFF_INCLUDE_DIR ${TIFF}/include)
- set(TIFF_LIBPATH ${TIFF}/lib)
-endif()
-
-if(WITH_JACK)
- set(JACK ${LIBDIR}/jack)
- set(JACK_INCLUDE_DIRS ${JACK}/include/jack ${JACK}/include)
- set(JACK_LIBRARIES jack)
- set(JACK_LIBPATH ${JACK}/lib)
-
- # TODO, gives linking errors, force off
- set(WITH_JACK OFF)
-endif()
-
-if(WITH_PYTHON)
- # normally cached but not since we include them with blender
- set(PYTHON_VERSION 3.5) # CACHE STRING)
- string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
- set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}") # CACHE PATH)
- set(PYTHON_LIBRARY "${LIBDIR}/python/lib/python${_PYTHON_VERSION_NO_DOTS}mw.lib") # CACHE FILEPATH)
- unset(_PYTHON_VERSION_NO_DOTS)
-
- # uncached vars
- set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
- set(PYTHON_LIBRARIES "${PYTHON_LIBRARY}")
-endif()
-
-if(WITH_BOOST)
- set(BOOST ${LIBDIR}/boost)
- set(BOOST_INCLUDE_DIR ${BOOST}/include)
- if(WITH_MINGW64)
- set(BOOST_POSTFIX "mgw47-mt-s-1_49")
- set(BOOST_DEBUG_POSTFIX "mgw47-mt-sd-1_49")
- else()
- set(BOOST_POSTFIX "mgw46-mt-s-1_49")
- set(BOOST_DEBUG_POSTFIX "mgw46-mt-sd-1_49")
- endif()
- set(BOOST_LIBRARIES
- optimized boost_date_time-${BOOST_POSTFIX} boost_filesystem-${BOOST_POSTFIX}
- boost_regex-${BOOST_POSTFIX}
- boost_system-${BOOST_POSTFIX} boost_thread-${BOOST_POSTFIX}
- debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
- boost_regex-${BOOST_DEBUG_POSTFIX}
- boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
- if(WITH_INTERNATIONAL)
- set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
- optimized boost_locale-${BOOST_POSTFIX}
- debug boost_locale-${BOOST_DEBUG_POSTFIX}
- )
- endif()
- if(WITH_CYCLES_OSL)
- set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
- optimized boost_wave-${BOOST_POSTFIX}
- debug boost_wave-${BOOST_DEBUG_POSTFIX}
- )
- endif()
- set(BOOST_LIBPATH ${BOOST}/lib)
- set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
-endif()
-
-if(WITH_OPENIMAGEIO)
- set(OPENIMAGEIO ${LIBDIR}/openimageio)
- set(OPENIMAGEIO_INCLUDE_DIRS ${OPENIMAGEIO}/include)
- set(OPENIMAGEIO_LIBRARIES OpenImageIO)
- set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
- set(OPENIMAGEIO_DEFINITIONS "")
- set(OPENIMAGEIO_IDIFF "${OPENIMAGEIO}/bin/idiff.exe")
-endif()
-
-if(WITH_LLVM)
- set(LLVM_ROOT_DIR ${LIBDIR}/llvm CACHE PATH "Path to the LLVM installation")
- set(LLVM_LIBPATH ${LLVM_ROOT_DIR}/lib)
- # Explicitly set llvm lib order.
- #---- WARNING ON GCC ORDER OF LIBS IS IMPORTANT, DO NOT CHANGE! ---------
- set(LLVM_LIBRARY LLVMSelectionDAG LLVMCodeGen LLVMScalarOpts LLVMAnalysis LLVMArchive
- LLVMAsmParser LLVMAsmPrinter
- LLVMBitReader LLVMBitWriter
- LLVMDebugInfo LLVMExecutionEngine
- LLVMInstCombine LLVMInstrumentation
- LLVMInterpreter LLVMJIT
- LLVMLinker LLVMMC
- LLVMMCDisassembler LLVMMCJIT
- LLVMMCParser LLVMObject
- LLVMRuntimeDyld
- LLVMSupport
- LLVMTableGen LLVMTarget
- LLVMTransformUtils LLVMVectorize
- LLVMX86AsmParser LLVMX86AsmPrinter
- LLVMX86CodeGen LLVMX86Desc
- LLVMX86Disassembler LLVMX86Info
- LLVMX86Utils LLVMipa
- LLVMipo LLVMCore)
- # imagehelp is needed by LLVM 3.1 on MinGW, check lib\Support\Windows\Signals.inc
- list(APPEND PLATFORM_LINKLIBS -limagehlp)
-endif()
-
-if(WITH_OPENCOLORIO)
- set(OPENCOLORIO ${LIBDIR}/opencolorio)
- set(OPENCOLORIO_INCLUDE_DIRS ${OPENCOLORIO}/include)
- set(OPENCOLORIO_LIBRARIES OpenColorIO)
- set(OPENCOLORIO_LIBPATH ${OPENCOLORIO}/lib)
- set(OPENCOLORIO_DEFINITIONS)
-endif()
-
-if(WITH_SDL)
- set(SDL ${LIBDIR}/sdl)
- set(SDL_INCLUDE_DIR ${SDL}/include)
- set(SDL_LIBRARY SDL)
- set(SDL_LIBPATH ${SDL}/lib)
-endif()
-
-if(WITH_OPENVDB)
- set(OPENVDB ${LIBDIR}/openvdb)
- set(OPENVDB_INCLUDE_DIRS ${OPENVDB}/include)
- set(OPENVDB_LIBRARIES openvdb ${TBB_LIBRARIES})
- set(OPENVDB_LIBPATH ${LIBDIR}/openvdb/lib)
- set(OPENVDB_DEFINITIONS)
-endif()
-
-if(WITH_ALEMBIC)
- # TODO(sergey): For until someone drops by and compiles libraries for
- # MinGW we allow users to compile their own Alembic library and use
- # that via find_package(),
- #
- # Once precompiled libraries are there we'll use hardcoded locations.
- find_package_wrapper(Alembic)
- if(WITH_ALEMBIC_HDF5)
- set(HDF5_ROOT_DIR ${LIBDIR}/hdf5)
- find_package_wrapper(HDF5)
- endif()
- if(NOT ALEMBIC_FOUND OR (WITH_ALEMBIC_HDF5 AND NOT HDF5_FOUND))
- set(WITH_ALEMBIC OFF)
- set(WITH_ALEMBIC_HDF5 OFF)
- endif()
-endif()
-
-set(PLATFORM_LINKFLAGS "-Xlinker --stack=2097152")
-
-## DISABLE - causes linking errors
-## for re-distribution, so users dont need mingw installed
-# set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} -static-libgcc -static-libstdc++")
diff --git a/build_files/cmake/platform/platform_win32_msvc.cmake b/build_files/cmake/platform/platform_win32_msvc.cmake
index 3ea93a96290..3b417f79cbe 100644
--- a/build_files/cmake/platform/platform_win32_msvc.cmake
+++ b/build_files/cmake/platform/platform_win32_msvc.cmake
@@ -37,6 +37,12 @@ macro(windows_find_package package_name
endif(WITH_WINDOWS_FIND_MODULES)
endmacro()
+macro(find_package_wrapper)
+ if(WITH_WINDOWS_FIND_MODULES)
+ find_package(${ARGV})
+ endif()
+endmacro()
+
add_definitions(-DWIN32)
# Minimum MSVC Version
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
@@ -110,7 +116,6 @@ set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /NODEFAULTLIB:msvcrt.lib /NODEFAUL
set(PLATFORM_LINKFLAGS "${PLATFORM_LINKFLAGS} /ignore:4049 /ignore:4217 /ignore:4221")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221")
-# MSVC only, Mingw doesnt need
if(CMAKE_CL_64)
set(PLATFORM_LINKFLAGS "/MACHINE:X64 ${PLATFORM_LINKFLAGS}")
else()
@@ -432,6 +437,7 @@ if(WITH_ALEMBIC)
set(ALEMBIC_INCLUDE_DIRS ${ALEMBIC_INCLUDE_DIR})
set(ALEMBIC_LIBPATH ${ALEMBIC}/lib)
set(ALEMBIC_LIBRARIES optimized alembic debug alembic_d)
+ set(ALEMBIC_FOUND 1)
endif()
if(WITH_MOD_CLOTH_ELTOPO)
@@ -446,32 +452,28 @@ if(WITH_MOD_CLOTH_ELTOPO)
endif()
if(WITH_OPENSUBDIV OR WITH_CYCLES_OPENSUBDIV)
- set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
- set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
- set(OPENSUBDIV_LIBRARIES optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
- optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib
- debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib
- debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib
- )
- set(OPENSUBDIV_HAS_OPENMP TRUE)
+ set(OPENSUBDIV_INCLUDE_DIR ${LIBDIR}/opensubdiv/include)
+ set(OPENSUBDIV_LIBPATH ${LIBDIR}/opensubdiv/lib)
+ set(OPENSUBDIV_LIBRARIES
+ optimized ${OPENSUBDIV_LIBPATH}/osdCPU.lib
+ optimized ${OPENSUBDIV_LIBPATH}/osdGPU.lib
+ debug ${OPENSUBDIV_LIBPATH}/osdCPU_d.lib
+ debug ${OPENSUBDIV_LIBPATH}/osdGPU_d.lib
+ )
+ set(OPENSUBDIV_HAS_OPENMP TRUE)
set(OPENSUBDIV_HAS_TBB FALSE)
set(OPENSUBDIV_HAS_OPENCL TRUE)
set(OPENSUBDIV_HAS_CUDA FALSE)
set(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK TRUE)
set(OPENSUBDIV_HAS_GLSL_COMPUTE TRUE)
- windows_find_package(OpenSubdiv)
+ windows_find_package(OpenSubdiv)
endif()
if(WITH_SDL)
set(SDL ${LIBDIR}/sdl)
set(SDL_INCLUDE_DIR ${SDL}/include)
set(SDL_LIBPATH ${SDL}/lib)
- # MinGW TODO: Update MinGW to SDL2
- if(NOT CMAKE_COMPILER_IS_GNUCC)
- set(SDL_LIBRARY SDL2)
- else()
- set(SDL_LIBRARY SDL)
- endif()
+ set(SDL_LIBRARY SDL2)
endif()
# Audio IO
@@ -487,14 +489,14 @@ endif()
# used in many places so include globally, like OpenGL
blender_include_dirs_sys("${PTHREADS_INCLUDE_DIRS}")
-#find signtool
-SET(ProgramFilesX86_NAME "ProgramFiles(x86)") #env dislikes the ( )
+#find signtool
+set(ProgramFilesX86_NAME "ProgramFiles(x86)") #env dislikes the ( )
find_program(SIGNTOOL_EXE signtool
-HINTS
- "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/bin/x86/"
- "$ENV{ProgramFiles}/Windows Kits/10/bin/x86/"
- "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.1/bin/x86/"
- "$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86/"
- "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.0/bin/x86/"
- "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86/"
+ HINTS
+ "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/10/bin/x86/"
+ "$ENV{ProgramFiles}/Windows Kits/10/bin/x86/"
+ "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.1/bin/x86/"
+ "$ENV{ProgramFiles}/Windows Kits/8.1/bin/x86/"
+ "$ENV{${ProgramFilesX86_NAME}}/Windows Kits/8.0/bin/x86/"
+ "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86/"
)
diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py
index deea844034c..3ac4c4c9480 100755
--- a/build_files/cmake/project_info.py
+++ b/build_files/cmake/project_info.py
@@ -145,7 +145,7 @@ def cmake_advanced_info():
def create_eclipse_project():
print("CMAKE_DIR %r" % CMAKE_DIR)
if sys.platform == "win32":
- cmd = 'cmake "%s" -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
+ raise Exception("Error: win32 is not supported")
else:
if make_exe_basename.startswith(("make", "gmake")):
cmd = 'cmake "%s" -G"Eclipse CDT4 - Unix Makefiles"' % CMAKE_DIR