diff --git a/.gitignore b/.gitignore index 3418afebb58..814b7661bc6 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ Desktop.ini /doc/python_api/sphinx-in/ /doc/python_api/sphinx-out/ /doc/python_api/rst/bmesh.ops.rst + +# in-source lib downloads +/build_files/build_environment/downloads diff --git a/GNUmakefile b/GNUmakefile index ba7f89c3097..9661f292699 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -43,6 +43,11 @@ ifndef BUILD_DIR BUILD_DIR:=$(shell dirname "$(BLENDER_DIR)")/build_$(OS_NCASE) endif +# Dependencies DIR's +DEPS_SOURCE_DIR:=$(BLENDER_DIR)/build_files/build_environment +DEPS_BUILD_DIR:=$(BUILD_DIR)/deps +DEPS_INSTALL_DIR:=$(shell dirname "$(BLENDER_DIR)")/lib/$(OS_NCASE) + # Allow to use alternative binary (pypy3, etc) ifndef PYTHON PYTHON:=python3 @@ -146,6 +151,27 @@ cycles: all headless: all bpy: all +# ----------------------------------------------------------------------------- +# Build dependencies +DEPS_TARGET = install +ifneq "$(findstring clean, $(MAKECMDGOALS))" "" + DEPS_TARGET = clean +endif + +deps: .FORCE + @echo + @echo Configuring dependencies in \"$(DEPS_BUILD_DIR)\" + + @cmake -H"$(DEPS_SOURCE_DIR)" \ + -B"$(DEPS_BUILD_DIR)" \ + -DHARVEST_TARGET=$(DEPS_INSTALL_DIR) + + @echo + @echo Building dependencies ... + $(MAKE) -C "$(DEPS_BUILD_DIR)" -s -j $(NPROCS) $(DEPS_TARGET) + @echo + @echo Dependencies successfully built and installed to $(DEPS_INSTALL_DIR). + @echo # ----------------------------------------------------------------------------- # Configuration (save some cd'ing around) @@ -164,6 +190,7 @@ help: .FORCE @echo " * headless - build without an interface (renderfarm or server automation)" @echo " * cycles - build Cycles standalone only, without Blender" @echo " * bpy - build as a python module which can be loaded from python directly" + @echo " * deps - build library dependencies (intended only for platform maintainers)" @echo "" @echo " * config - run cmake configuration tool to set build options" @echo "" diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt new file mode 100644 index 00000000000..5bcfd477d71 --- /dev/null +++ b/build_files/build_environment/CMakeLists.txt @@ -0,0 +1,130 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +#################################################################################################### +# +# This is a build system used by platform maintainers to build library dependencies on +# Windows and macOS. There is some support for Linux as well, but not ready for releases. +# +# Windows and macOS users should download the precompiled libraries in lib/, Linux users +# should run install_deps.sh for building dependencies. +# +# WINDOWS USAGE: +# Don't call this cmake file your self, use build_deps.cmd +# build_deps 2013 x64 / build_deps 2013 x86 +# build_deps 2015 x64 / build_deps 2015 x86 +# +# MAC OS X USAGE: +# Install with homebrew: brew install autoconf automake libtool yasm openssl xz +# Run "make deps" from main Blender directory +# +# LINUX USAGE: +# Install compiler, cmake, autoconf, automake, libtool, yasm +# Run "make deps" from main Blender directory +# +#################################################################################################### + +project("BlenderDependencies") +cmake_minimum_required(VERSION 3.5) + +include(ExternalProject) +include(cmake/options.cmake) +include(cmake/versions.cmake) +include(cmake/zlib.cmake) +include(cmake/blendthumb.cmake) +include(cmake/openal.cmake) +include(cmake/png.cmake) +include(cmake/jpeg.cmake) +include(cmake/boost.cmake) +include(cmake/blosc.cmake) +include(cmake/pthreads.cmake) +include(cmake/ilmbase.cmake) +include(cmake/openexr.cmake) +include(cmake/freetype.cmake) +include(cmake/freeglut.cmake) +include(cmake/glew.cmake) +include(cmake/hdf5.cmake) +include(cmake/alembic.cmake) +include(cmake/glfw.cmake) +include(cmake/clew.cmake) +include(cmake/cuew.cmake) +include(cmake/opensubdiv.cmake) +include(cmake/sdl.cmake) +include(cmake/opencollada.cmake) +include(cmake/opencolorio.cmake) +include(cmake/llvm.cmake) +include(cmake/clang.cmake) +include(cmake/openimageio.cmake) +include(cmake/tiff.cmake) +include(cmake/flexbison.cmake) +include(cmake/osl.cmake) +include(cmake/tbb.cmake) +include(cmake/openvdb.cmake) +include(cmake/python.cmake) +include(cmake/requests.cmake) +include(cmake/numpy.cmake) +include(cmake/webp.cmake) +if(WIN32) + include(cmake/hidapi.cmake) +endif() + +if(ENABLE_MINGW64) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + include(cmake/setup_mingw64.cmake) + else() + include(cmake/setup_mingw32.cmake) + endif() +else() + set(mingw_LIBDIR ${LIBDIR}) +endif() + +if(NOT WIN32 OR ENABLE_MINGW64) + if(BUILD_MODE STREQUAL Release) + if(WIN32) + include(cmake/zlib_mingw.cmake) + endif() + include(cmake/lame.cmake) + include(cmake/ogg.cmake) + include(cmake/vorbis.cmake) + include(cmake/theora.cmake) + include(cmake/vpx.cmake) + include(cmake/orc.cmake) + include(cmake/schroedinger.cmake) + include(cmake/x264.cmake) + include(cmake/xvidcore.cmake) + include(cmake/openjpeg.cmake) + include(cmake/faad.cmake) + include(cmake/ffmpeg.cmake) + include(cmake/fftw.cmake) + include(cmake/sndfile.cmake) + if(WIN32) + include(cmake/iconv.cmake) + include(cmake/lapack.cmake) + endif() + if(UNIX) + include(cmake/flac.cmake) + if(NOT APPLE) + include(cmake/spnav.cmake) + include(cmake/jemalloc.cmake) + include(cmake/xml2.cmake) + endif() + endif() + endif() +endif() + +include(cmake/harvest.cmake) diff --git a/build_files/build_environment/cmake/alembic.cmake b/build_files/build_environment/cmake/alembic.cmake new file mode 100644 index 00000000000..a49047ec102 --- /dev/null +++ b/build_files/build_environment/cmake/alembic.cmake @@ -0,0 +1,75 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(ALEMBIC_HDF5) + set(ALEMBIC_HDF5_HL) + # in debug mode we do not build HDF5_hdf5_hl_LIBRARY which makes cmake really + # unhappy, stub it with the debug mode lib. it's not linking it in at this + # point in time anyhow + if(BUILD_MODE STREQUAL Debug) + set(ALEMBIC_HDF5_HL -DHDF5_hdf5_hl_LIBRARY=${LIBDIR}/hdf5/lib/libhdf5_hl_D.${LIBEXT}) + endif() +endif() + +set(ALEMBIC_EXTRA_ARGS + -DBUILDSTATIC=ON + -DLINKSTATIC=ON + -DALEMBIC_LIB_USES_BOOST=ON + -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING} + -DBoost_USE_MULTITHREADED=ON + -DUSE_STATIC_BOOST=On + -DBoost_USE_STATIC_LIBS=ON + -DBoost_USE_STATIC_RUNTIME=ON + -DBoost_DEBUG=ON + -DBOOST_ROOT=${LIBDIR}/boost + -DBoost_NO_SYSTEM_PATHS=ON + -DILMBASE_ROOT=${LIBDIR}/ilmbase + -DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${LIBDIR}/ilmbase/include/OpenEXR + -DALEMBIC_ILMBASE_HALF_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Half${LIBEXT} + -DALEMBIC_ILMBASE_IMATH_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Imath-2_2${LIBEXT} + -DALEMBIC_ILMBASE_ILMTHREAD_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IlmThread-2_2${LIBEXT} + -DALEMBIC_ILMBASE_IEX_LIB=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Iex-2_2${LIBEXT} + -DUSE_PYILMBASE=0 + -DUSE_PYALEMBIC=0 + -DUSE_ARNOLD=0 + -DUSE_MAYA=0 + -DUSE_PRMAN=0 + -DUSE_HDF5=Off + -DUSE_STATIC_HDF5=Off + -DHDF5_ROOT=${LIBDIR}/hdf5 + -DUSE_TESTS=Off + -DALEMBIC_NO_OPENGL=1 + -DUSE_BINARIES=ON + -DALEMBIC_ILMBASE_LINK_STATIC=On + -DALEMBIC_SHARED_LIBS=OFF + -DGLUT_INCLUDE_DIR="" + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ + ${ALEMBIC_HDF5_HL} +) + +ExternalProject_Add(external_alembic + URL ${ALEMBIC_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${ALEMBIC_MD5} + PREFIX ${BUILD_DIR}/alembic + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/alembic -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${ALEMBIC_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/alembic +) + +add_dependencies(external_alembic external_boost external_zlib external_ilmbase) diff --git a/build_files/build_environment/cmake/blendthumb.cmake b/build_files/build_environment/cmake/blendthumb.cmake new file mode 100644 index 00000000000..624869971c6 --- /dev/null +++ b/build_files/build_environment/cmake/blendthumb.cmake @@ -0,0 +1,61 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(BUILD_MODE STREQUAL Release) + if(WIN32) + set(THUMB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../release/windows/blendthumb) + + ExternalProject_Add(external_zlib_32 + URL ${ZLIB_URI} + CMAKE_GENERATOR ${GENERATOR_32} + URL_HASH MD5=${ZLIB_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PREFIX ${BUILD_DIR}/zlib32 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zlib32 ${DEFAULT_CMAKE_FLAGS} + INSTALL_DIR ${LIBDIR}/zlib32 + ) + + ExternalProject_Add(external_zlib_64 + URL ${ZLIB_URI} + CMAKE_GENERATOR ${GENERATOR_64} + URL_HASH MD5=${ZLIB_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PREFIX ${BUILD_DIR}/zlib64 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zlib64 ${DEFAULT_CMAKE_FLAGS} + INSTALL_DIR ${LIBDIR}/zlib64 + ) + + ExternalProject_Add(external_blendthumb_32 + CMAKE_GENERATOR ${GENERATOR_32} + SOURCE_DIR ${THUMB_DIR} + PREFIX ${BUILD_DIR}/blendthumb32 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blendThumb32 ${DEFAULT_CMAKE_FLAGS} -DZLIB_INCLUDE=${LIBDIR}/zlib32/include -DZLIB_LIBS=${LIBDIR}/zlib32/lib/zlibstatic.lib + INSTALL_DIR ${LIBDIR}/blendthumb32 + ) + add_dependencies(external_blendthumb_32 external_zlib_32) + + ExternalProject_Add(external_blendthumb_64 + CMAKE_GENERATOR ${GENERATOR_64} + SOURCE_DIR ${THUMB_DIR} + PREFIX ${BUILD_DIR}/blendthumb64 + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blendThumb64 ${DEFAULT_CMAKE_FLAGS} -DZLIB_INCLUDE=${LIBDIR}/zlib64/include -DZLIB_LIBS=${LIBDIR}/zlib64/lib/zlibstatic.lib + INSTALL_DIR ${LIBDIR}/blendthumb64 + ) + add_dependencies(external_blendthumb_64 external_zlib_64) + endif() +endif() diff --git a/build_files/build_environment/cmake/blosc.cmake b/build_files/build_environment/cmake/blosc.cmake new file mode 100644 index 00000000000..68df525b802 --- /dev/null +++ b/build_files/build_environment/cmake/blosc.cmake @@ -0,0 +1,43 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(BLOSC_EXTRA_ARGS + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DBUILD_TESTS=OFF + -DBUILD_BENCHMARKS=OFF + -DCMAKE_DEBUG_POSTFIX=_d + -DThreads_FOUND=1 + -DPTHREAD_LIBS=${LIBDIR}/pthreads/lib/pthreadVC2.lib + -DPTHREAD_INCLUDE_DIR=${LIBDIR}/pthreads/inc +) + +ExternalProject_Add(external_blosc + URL ${BLOSC_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${BLOSC_HASH} + PREFIX ${BUILD_DIR}/blosc + PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/blosc/src/external_blosc < ${PATCH_DIR}/blosc.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blosc ${DEFAULT_CMAKE_FLAGS} ${BLOSC_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/blosc +) + +add_dependencies(external_blosc external_zlib) +if(WIN32) + add_dependencies(external_blosc external_pthreads) +endif() diff --git a/build_files/build_environment/cmake/boost.cmake b/build_files/build_environment/cmake/boost.cmake new file mode 100644 index 00000000000..554db6583b7 --- /dev/null +++ b/build_files/build_environment/cmake/boost.cmake @@ -0,0 +1,99 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(PYTHON_ARCH x64) + set(PYTHON_ARCH2 win-AMD64) + set(PYTHON_OUTPUTDIR ${BUILD_DIR}/python/src/external_python/pcbuild/amd64/) + else() + set(PYTHON_ARCH x86) + set(PYTHON_ARCH2 win32) + set(PYTHON_OUTPUTDIR ${BUILD_DIR}/python/src/external_python/pcbuild/win32/) + endif() + if(MSVC12) + set(BOOST_TOOLSET toolset=msvc-12.0) + set(BOOST_COMPILER_STRING -vc120) + set(PYTHON_COMPILER_STRING v120) + endif() + if(MSVC14) + set(BOOST_TOOLSET toolset=msvc-14.0) + set(BOOST_COMPILER_STRING -vc140) + set(PYTHON_COMPILER_STRING v140) + endif() + set(JAM_FILE ${BUILD_DIR}/boost/src/external_boost/user-config.jam) + set(semi_path "${PATCH_DIR}/semi.txt") + FILE(TO_NATIVE_PATH ${semi_path} semi_path) + set(BOOST_CONFIGURE_COMMAND bootstrap.bat && + echo using python : 3.5 : ${PYTHON_OUTPUTDIR}\\python.exe > "${JAM_FILE}" && + echo. : ${BUILD_DIR}/python/src/external_python/include ${BUILD_DIR}/python/src/external_python/pc >> "${JAM_FILE}" && + echo. : ${BUILD_DIR}/python/src/external_python/pcbuild >> "${JAM_FILE}" && + type ${semi_path} >> "${JAM_FILE}" + ) + set(BOOST_BUILD_COMMAND bjam) + set(BOOST_BUILD_OPTIONS runtime-link=static --user-config=user-config.jam) + set(BOOST_WITH_PYTHON --with-python) +elseif(APPLE) + set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh) + set(BOOST_BUILD_COMMAND ./bjam) + set(BOOST_BUILD_OPTIONS toolset=clang cxxflags=${PLATFORM_CXXFLAGS} linkflags=${PLATFORM_LDFLAGS} --disable-icu boost.locale.icu=off) +else() + set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh) + set(BOOST_BUILD_COMMAND ./bjam) + set(BOOST_BUILD_OPTIONS cxxflags=${PLATFORM_CXXFLAGS} --disable-icu boost.locale.icu=off) +endif() + +set(BOOST_OPTIONS + --with-filesystem + --with-locale + --with-thread + --with-regex + --with-system + --with-date_time + --with-wave + --with-atomic + --with-serialization + --with-program_options + --with-iostreams + ${BOOST_WITH_PYTHON} + ${BOOST_TOOLSET} +) + +if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(BOOST_ADDRESS_MODEL 64) +else() + set(BOOST_ADDRESS_MODEL 32) +endif() + +string(TOLOWER ${BUILD_MODE} BOOST_BUILD_TYPE) + +ExternalProject_Add(external_boost + URL ${BOOST_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${BOOST_MD5} + PREFIX ${BUILD_DIR}/boost + UPDATE_COMMAND "" + CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND} + BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=x86 address-model=${BOOST_ADDRESS_MODEL} variant=${BOOST_BUILD_TYPE} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install + BUILD_IN_SOURCE 1 + INSTALL_COMMAND "" +) + +if(WIN32) + add_dependencies(external_boost Make_Python_Environment) +endif() diff --git a/build_files/build_environment/cmake/clang.cmake b/build_files/build_environment/cmake/clang.cmake new file mode 100644 index 00000000000..8d57c4dfc6f --- /dev/null +++ b/build_files/build_environment/cmake/clang.cmake @@ -0,0 +1,35 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(CLANG_EXTRA_ARGS + -DCLANG_PATH_TO_LLVM_SOURCE=${BUILD_DIR}/ll/src/ll + -DCLANG_PATH_TO_LLVM_BUILD=${LIBDIR}/llvm + -DLLVM_USE_CRT_RELEASE=MT + -DLLVM_USE_CRT_DEBUG=MTd +) +ExternalProject_Add(external_clang + URL ${CLANG_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${CLANG_HASH} + PATCH_COMMAND ${PATCH_CMD} -p 2 -N -R -d ${BUILD_DIR}/clang/src/external_clang < ${PATCH_DIR}/clang.diff + PREFIX ${BUILD_DIR}/clang + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${CLANG_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/llvm +) + +add_dependencies(external_clang ll) diff --git a/build_files/build_environment/cmake/clew.cmake b/build_files/build_environment/cmake/clew.cmake new file mode 100644 index 00000000000..0dcc1f24db7 --- /dev/null +++ b/build_files/build_environment/cmake/clew.cmake @@ -0,0 +1,28 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(CLEW_EXTRA_ARGS) + +ExternalProject_Add(external_clew + URL ${CLEW_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${CLEW_HASH} + PREFIX ${BUILD_DIR}/clew + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/clew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CLEW_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/clew +) diff --git a/build_files/build_environment/cmake/cuew.cmake b/build_files/build_environment/cmake/cuew.cmake new file mode 100644 index 00000000000..99b7bb5c06d --- /dev/null +++ b/build_files/build_environment/cmake/cuew.cmake @@ -0,0 +1,29 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(CUEW_EXTRA_ARGS) + +ExternalProject_Add(external_cuew + URL ${CUEW_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${CUEW_HASH} + PREFIX ${BUILD_DIR}/cuew + PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/cuew/src/external_cuew < ${PATCH_DIR}/cuew.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/cuew -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${CUEW_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/cuew +) diff --git a/build_files/build_environment/cmake/faad.cmake b/build_files/build_environment/cmake/faad.cmake new file mode 100644 index 00000000000..3dd90971b84 --- /dev/null +++ b/build_files/build_environment/cmake/faad.cmake @@ -0,0 +1,35 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(FAAD_EXTRA_ARGS) + +ExternalProject_Add(external_faad + URL ${FAAD_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${FAAD_HASH} + PREFIX ${BUILD_DIR}/faad + PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/faad/src/external_faad < ${PATCH_DIR}/libfaad.diff + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/faad/src/external_faad/ && ${CONFIGURE_COMMAND} --disable-shared --enable-static --prefix=${LIBDIR}/faad + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/faad/src/external_faad/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/faad/src/external_faad/ && make install + INSTALL_DIR ${LIBDIR}/faad +) + +if(MSVC) + set_target_properties(external_faad PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/ffmpeg.cmake b/build_files/build_environment/cmake/ffmpeg.cmake new file mode 100644 index 00000000000..3f9091b5ee3 --- /dev/null +++ b/build_files/build_environment/cmake/ffmpeg.cmake @@ -0,0 +1,112 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(FFMPEG_CFLAGS "-I${mingw_LIBDIR}/lame/include -I${mingw_LIBDIR}/openjpeg/include/ -I${mingw_LIBDIR}/ogg/include -I${mingw_LIBDIR}/vorbis/include -I${mingw_LIBDIR}/theora/include -I${mingw_LIBDIR}/vpx/include -I${mingw_LIBDIR}/x264/include -I${mingw_LIBDIR}/xvidcore/include -I${mingw_LIBDIR}/dirac/include/dirac -I${mingw_LIBDIR}/schroedinger/include/schroedinger-1.0 -I${mingw_LIBDIR}/zlib/include") +set(FFMPEG_LDFLAGS "-L${mingw_LIBDIR}/lame/lib -L${mingw_LIBDIR}/openjpeg/lib -L${mingw_LIBDIR}/ogg/lib -L${mingw_LIBDIR}/vorbis/lib -L${mingw_LIBDIR}/theora/lib -L${mingw_LIBDIR}/vpx/lib -L${mingw_LIBDIR}/x264/lib -L${mingw_LIBDIR}/xvidcore/lib -L${mingw_LIBDIR}/dirac/lib -L${mingw_LIBDIR}/schroedinger/lib -L${mingw_LIBDIR}/orc/lib -L${mingw_LIBDIR}/zlib/lib") +set(FFMPEG_EXTRA_FLAGS --extra-cflags=${FFMPEG_CFLAGS} --extra-ldflags=${FFMPEG_LDFLAGS}) +set(FFMPEG_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/schroedinger/lib/pkgconfig:${mingw_LIBDIR}/orc/lib/pkgconfig:${mingw_LIBDIR}/x264/lib/pkgconfig:${mingw_LIBDIR}) + +if(WIN32) + set(FFMPEG_ENV set ${FFMPEG_ENV} &&) + set(FFMPEG_EXTRA_FLAGS + ${FFMPEG_EXTRA_FLAGS} + --disable-static + --enable-shared + --enable-w32threads + --disable-pthreads + --enable-libopenjpeg + ) +else() + set(FFMPEG_EXTRA_FLAGS + ${FFMPEG_EXTRA_FLAGS} + --enable-static + --disable-shared + --enable-libopenjpeg) +endif() + +ExternalProject_Add(external_ffmpeg + URL ${FFMPEG_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${FFMPEG_HASH} + PREFIX ${BUILD_DIR}/ffmpeg + CONFIGURE_COMMAND ${CONFIGURE_ENV_NO_PERL} && + cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && + ${FFMPEG_ENV} ${CONFIGURE_COMMAND} ${FFMPEG_EXTRA_FLAGS} + --disable-lzma + --disable-avfilter + --disable-vdpau + --disable-bzlib + --disable-libgsm + --disable-libspeex + --enable-libvpx + --prefix=${LIBDIR}/ffmpeg + --enable-libschroedinger + --enable-libtheora + --enable-libvorbis + --enable-zlib + --enable-stripping + --enable-runtime-cpudetect + --disable-vaapi + --disable-nonfree + --enable-gpl + --disable-postproc + --disable-x11grab + --enable-libmp3lame + --disable-librtmp + --enable-libx264 + --enable-libxvid + --disable-libopencore-amrnb + --disable-libopencore-amrwb + --disable-libdc1394 + --disable-version3 + --disable-debug + --enable-optimizations + --disable-sse + --disable-ssse3 + --enable-ffplay + --disable-openssl + --disable-securetransport + --disable-indev=avfoundation + --disable-indev=qtkit + --disable-sdl + --disable-gnutls + --disable-vda + --disable-videotoolbox + --disable-libxcb + --disable-xlib + --disable-audiotoolbox + --disable-cuvid + --disable-nvenc + --disable-indev=jack + --disable-indev=alsa + --disable-outdev=alsa + PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/ffmpeg/src/external_ffmpeg < ${PATCH_DIR}/ffmpeg.diff + BUILD_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV_NO_PERL} && cd ${BUILD_DIR}/ffmpeg/src/external_ffmpeg/ && make install + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/ffmpeg ${DEFAULT_CMAKE_FLAGS} + INSTALL_DIR ${LIBDIR}/ffmpeg +) + +if(MSVC) + set_target_properties(external_ffmpeg PROPERTIES FOLDER Mingw) +endif(MSVC) + +add_dependencies(external_ffmpeg external_zlib external_faad external_openjpeg external_xvidcore external_x264 external_schroedinger external_vpx external_theora external_vorbis external_ogg external_lame) +if(WIN32) + add_dependencies(external_ffmpeg external_zlib_mingw) +endif() diff --git a/build_files/build_environment/cmake/fftw.cmake b/build_files/build_environment/cmake/fftw.cmake new file mode 100644 index 00000000000..e6e6165199c --- /dev/null +++ b/build_files/build_environment/cmake/fftw.cmake @@ -0,0 +1,40 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(FFTW_EXTRA_ARGS) + +if(WIN32) + set(FFTW3_ENV set CFLAGS=-fno-stack-check -fno-stack-protector -mno-stack-arg-probe -fno-lto &&) + set(FFTW3_PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/fftw3/src/external_fftw3 < ${PATCH_DIR}/fftw3.diff) +endif() + +ExternalProject_Add(external_fftw3 + URL ${FFTW_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${FFTW_HASH} + PREFIX ${BUILD_DIR}/fftw3 + CONFIGURE_COMMAND ${CONFIGURE_ENV} && ${FFTW3_ENV} cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && ${CONFIGURE_COMMAND} --enable-static --prefix=${mingw_LIBDIR}/fftw3 + PATCH_COMMAND ${FFTW3_PATCH_COMMAND} + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/fftw3/src/external_fftw3/ && make install + INSTALL_DIR ${LIBDIR}/fftw3 +) + +if(MSVC) + set_target_properties(external_fftw3 PROPERTIES FOLDER Mingw) +endif(MSVC) diff --git a/build_files/build_environment/cmake/flac.cmake b/build_files/build_environment/cmake/flac.cmake new file mode 100644 index 00000000000..74d222632d0 --- /dev/null +++ b/build_files/build_environment/cmake/flac.cmake @@ -0,0 +1,32 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_flac + URL ${FLAC_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${FLAC_HASH} + PREFIX ${BUILD_DIR}/flac + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/flac --disable-shared --enable-static + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/flac/src/external_flac/ && make install + INSTALL_DIR ${LIBDIR}/flac +) + +if(MSVC) + set_target_properties(external_flac PROPERTIES FOLDER Mingw) +endif(MSVC) diff --git a/build_files/build_environment/cmake/flexbison.cmake b/build_files/build_environment/cmake/flexbison.cmake new file mode 100644 index 00000000000..f2908e1ce2c --- /dev/null +++ b/build_files/build_environment/cmake/flexbison.cmake @@ -0,0 +1,31 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(FLEXBISON_EXTRA_ARGS) + +ExternalProject_Add(external_flexbison + URL ${FLEXBISON_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${FLEXBISON_HASH} + PREFIX ${BUILD_DIR}/flexbison + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/flexbison ${DEFAULT_CMAKE_FLAGS} ${FLEXBISON_EXTRA_ARGS} + CONFIGURE_COMMAND echo . + BUILD_COMMAND echo . + INSTALL_COMMAND COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILD_DIR}/flexbison/src/external_flexbison/ ${LIBDIR}/flexbison/ + INSTALL_DIR ${LIBDIR}/flexbison +) diff --git a/build_files/build_environment/cmake/freeglut.cmake b/build_files/build_environment/cmake/freeglut.cmake new file mode 100644 index 00000000000..043b382e8fd --- /dev/null +++ b/build_files/build_environment/cmake/freeglut.cmake @@ -0,0 +1,35 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + if(BUILD_MODE STREQUAL Release) + set(FREEGLUT_EXTRA_ARGS + -DFREEGLUT_BUILD_SHARED_LIBS=Off + -DFREEGLUT_BUILD_STATIC_LIBS=On + ) + + ExternalProject_Add(external_freeglut + URL ${FREEGLUT_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${FREEGLUT_HASH} + PREFIX ${BUILD_DIR}/freeglut + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/freeglut ${DEFAULT_C_FLAGS} ${DEFAULT_CXX_FLAGS} ${FREEGLUT_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/freeglut + ) + endif() +endif() diff --git a/build_files/build_environment/cmake/freetype.cmake b/build_files/build_environment/cmake/freetype.cmake new file mode 100644 index 00000000000..751b2b1f383 --- /dev/null +++ b/build_files/build_environment/cmake/freetype.cmake @@ -0,0 +1,28 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(FREETYPE_EXTRA_ARGS -DCMAKE_RELEASE_POSTFIX:STRING=2ST -DCMAKE_DEBUG_POSTFIX:STRING=2ST_d -DWITH_BZip2=OFF -DWITH_HarfBuzz=OFF) + +ExternalProject_Add(external_freetype + URL ${FREETYPE_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${FREETYPE_HASH} + PREFIX ${BUILD_DIR}/freetype + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/freetype ${DEFAULT_CMAKE_FLAGS} ${FREETYPE_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/freetype +) diff --git a/build_files/build_environment/cmake/glew.cmake b/build_files/build_environment/cmake/glew.cmake new file mode 100644 index 00000000000..b5d9e4d3310 --- /dev/null +++ b/build_files/build_environment/cmake/glew.cmake @@ -0,0 +1,32 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(GLEW_EXTRA_ARGS + -DBUILD_UTILS=Off + -DBUILD_SHARED_LIBS=Off +) + +ExternalProject_Add(external_glew + URL ${GLEW_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${GLEW_HASH} + PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_glew.txt ${BUILD_DIR}/glew/src/external_glew/CMakeLists.txt + PREFIX ${BUILD_DIR}/glew + CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glew ${DEFAULT_CMAKE_FLAGS} ${GLEW_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/glew +) diff --git a/build_files/build_environment/cmake/glfw.cmake b/build_files/build_environment/cmake/glfw.cmake new file mode 100644 index 00000000000..ae80080525c --- /dev/null +++ b/build_files/build_environment/cmake/glfw.cmake @@ -0,0 +1,28 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(GLFW_EXTRA_ARGS) + +ExternalProject_Add(external_glfw + URL ${GLFW_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${GLFW_HASH} + PREFIX ${BUILD_DIR}/glfw + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/glfw -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${GLFW_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/glfw +) diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake new file mode 100644 index 00000000000..367bc7b45db --- /dev/null +++ b/build_files/build_environment/cmake/harvest.cmake @@ -0,0 +1,296 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +######################################################################## +# Copy all generated files to the proper strucure as blender prefers +######################################################################## + +if(NOT DEFINED HARVEST_TARGET) + set(HARVEST_TARGET ${CMAKE_CURRENT_SOURCE_DIR}/Harvest) +endif() +message("HARVEST_TARGET = ${HARVEST_TARGET}") + +if(WIN32) + +if(BUILD_MODE STREQUAL Release) + add_custom_target(Harvest_Release_Results + # Zlib Rename the lib file and copy the include/bin folders + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zlib/lib/zlibstatic.lib ${HARVEST_TARGET}/zlib/lib/libz_st.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zlib/include/ ${HARVEST_TARGET}/zlib/include/ && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zlib/bin/ ${HARVEST_TARGET}/zlib/bin/ && + # Boost copy lib + rename boost_1_60 to boost + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/ && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-1_60/ ${HARVEST_TARGET}/boost/include/ && + # jpeg rename libfile + copy include + ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpeg-static.lib ${HARVEST_TARGET}/jpeg/lib/libjpeg.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/jpg/include/ ${HARVEST_TARGET}/jpeg/include/ && + # FreeType, straight up copy + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freetype ${HARVEST_TARGET}/freetype && + # pthreads, rename include dir + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pthreads/inc/ ${HARVEST_TARGET}/pthreads/include/ && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/pthreads/lib/ ${HARVEST_TARGET}/pthreads/lib && + # ffmpeg copy include+bin + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/ffmpeg/include ${HARVEST_TARGET}/ffmpeg/include && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/ffmpeg/bin ${HARVEST_TARGET}/ffmpeg/lib && + # sdl merge bin/lib folder, copy include + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/sdl/include/sdl2 ${HARVEST_TARGET}/sdl/include && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/sdl/lib ${HARVEST_TARGET}/sdl/lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/sdl/bin ${HARVEST_TARGET}/sdl/lib && + # openal + ${CMAKE_COMMAND} -E copy ${LIBDIR}/openal/lib/openal32.lib ${HARVEST_TARGET}/openal/lib/openal32.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/openal/bin/openal32.dll ${HARVEST_TARGET}/openal/lib/openal32.dll && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openal/include/ ${HARVEST_TARGET}/openal/include/ && + # OpenImageIO + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/include ${HARVEST_TARGET}/OpenImageIO/include && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenImageIO/lib ${HARVEST_TARGET}/OpenImageIO/lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenImageIO/bin/idiff.exe ${HARVEST_TARGET}/OpenImageIO/bin/idiff.exe && + # openEXR + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/ilmbase ${HARVEST_TARGET}/openexr && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openexr/lib ${HARVEST_TARGET}/openexr/lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openexr/include ${HARVEST_TARGET}/openexr/include && + # png + ${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_static.lib ${HARVEST_TARGET}/png/lib/libpng.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/png/include/ ${HARVEST_TARGET}/png/include/ && + # fftw3 + ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/lib/libfftw3.a ${HARVEST_TARGET}/fftw3/lib/libfftw.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/fftw3/include/fftw3.h ${HARVEST_TARGET}/fftw3/include/fftw3.h && + # freeglut-> opengl + ${CMAKE_COMMAND} -E copy ${LIBDIR}/freeglut/lib/freeglut_static.lib ${HARVEST_TARGET}/opengl/lib/freeglut_static.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/freeglut/include/ ${HARVEST_TARGET}/opengl/include/ && + # glew-> opengl + ${CMAKE_COMMAND} -E copy ${LIBDIR}/glew/lib/libglew32.lib ${HARVEST_TARGET}/opengl/lib/glew.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/glew/include/ ${HARVEST_TARGET}/opengl/include/ && + # sndfile + ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/lib/libsndfile.dll.a ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/bin/libsndfile-1.dll ${HARVEST_TARGET}/sndfile/lib/libsndfile-1.dll && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/sndfile/include/sndfile.h ${HARVEST_TARGET}/sndfile/include/sndfile.h && + # tiff + ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiff.lib ${HARVEST_TARGET}/tiff/lib/libtiff.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tiff/include/ ${HARVEST_TARGET}/tiff/include/ && + # iconv + ${CMAKE_COMMAND} -E copy ${LIBDIR}/iconv/lib/libiconv.a ${HARVEST_TARGET}/iconv/lib/iconv.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/iconv/include/iconv.h ${HARVEST_TARGET}/iconv/include/iconv.h && + # opencolorIO + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/OpenColorIO/ ${HARVEST_TARGET}/opencolorio && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/OpenColorIO/lib/OpenColorIO.dll ${HARVEST_TARGET}/opencolorio/bin/OpenColorIO.dll && + # Osl + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/osl/ ${HARVEST_TARGET}/osl && + # OpenVDB + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/openVDB/ ${HARVEST_TARGET}/openVDB && + # blosc + ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc.lib ${HARVEST_TARGET}/blosc/lib/libblosc.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/blosc/include/ ${HARVEST_TARGET}/blosc/include/ && + # tbb + ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb.lib && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/tbb/include/ ${HARVEST_TARGET}/tbb/include/ && + # llvm + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/ ${HARVEST_TARGET}/llvm/ && + # opencollada + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opencollada/ ${HARVEST_TARGET}/opencollada/ && + # opensubdiv + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/opensubdiv ${HARVEST_TARGET}/opensubdiv && + # python + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/python/ ${HARVEST_TARGET}/python/ && + # alembic + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/alembic ${HARVEST_TARGET}/alembic && + # hdf5 + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hdf5 ${HARVEST_TARGET}/hdf5 && + # BlendThumb + ${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb64/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb64.dll && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/BlendThumb32/bin/blendthumb.dll ${HARVEST_TARGET}/ThumbHandler/lib/BlendThumb.dll && + # python + ${CMAKE_COMMAND} -E copy ${LIBDIR}/python35.tar.gz ${HARVEST_TARGET}/Release/python35.tar.gz && + # requests + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/requests ${HARVEST_TARGET}/Release/site-packages/requests && + # numpy + ${CMAKE_COMMAND} -E copy ${LIBDIR}/python35_numpy${PYTHON_POSTFIX}_1.10.tar.gz ${HARVEST_TARGET}/Release/python35_numpy_1.10.tar.gz && + # hidapi + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hidapi/ ${HARVEST_TARGET}/hidapi/ && + # webp, straight up copy + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/webp ${HARVEST_TARGET}/webp + DEPENDS +) +endif(BUILD_MODE STREQUAL Release) + +if(BUILD_MODE STREQUAL Debug) + add_custom_target(Harvest_Debug_Results + # OpenImageIO + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/openimageio/lib/OpenImageIO_Util.lib ${HARVEST_TARGET}/openimageio/lib/OpenImageIO_Util_d.lib && + # ilmbase+openexr + ${CMAKE_COMMAND} -E copy ${LIBDIR}/ilmbase/lib/Half.lib ${HARVEST_TARGET}/openexr/lib/Half_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/ilmbase/lib/Iex-2_2.lib ${HARVEST_TARGET}/openexr/lib/Iex-2_2_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/ilmbase/lib/IexMath-2_2.lib ${HARVEST_TARGET}/openexr/lib/IexMath-2_2_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/ilmbase/lib/IlmThread-2_2.lib ${HARVEST_TARGET}/openexr/lib/IlmThread-2_2_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/ilmbase/lib/Imath-2_2.lib ${HARVEST_TARGET}/openexr/lib/Imath-2_2_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/lib/IlmImf-2_2.lib ${HARVEST_TARGET}/openexr/lib/IlmImf-2_2_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/openexr/lib/IlmImfUtil-2_2.lib ${HARVEST_TARGET}/openexr/lib/IlmImfUtil-2_2_d.lib && + # opencollada + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/buffer.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/buffer_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/ftoa.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/ftoa_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/GeneratedSaxParser.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/GeneratedSaxParser_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/MathMLSolver.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/MathMLSolver_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADABaseUtils.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADABaseUtils_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADAFramework.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADAFramework_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADASaxFrameworkLoader.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADASaxFrameworkLoader_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/OpenCOLLADAStreamWriter.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/OpenCOLLADAStreamWriter_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/pcre.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/pcre_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/UTF.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/UTF_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opencollada/lib/opencollada/xml.lib ${HARVEST_TARGET}/opencollada/lib/opencollada/xml_d.lib && + # blosc + ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc_d.lib ${HARVEST_TARGET}/blosc/lib/libblosc_d.lib && + # boost + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/lib/ ${HARVEST_TARGET}/boost/lib/ && + # llvm + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/lib/ ${HARVEST_TARGET}/llvm/debug/lib/ && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/bin/ ${HARVEST_TARGET}/llvm/debug/bin/ && + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/llvm/include/ ${HARVEST_TARGET}/llvm/debug/include/ && + # osl + ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslcomp.lib ${HARVEST_TARGET}/osl/lib/oslcomp_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslexec.lib ${HARVEST_TARGET}/osl/lib/oslexec_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/osl/lib/oslquery.lib ${HARVEST_TARGET}/osl/lib/oslquery_d.lib && + # opensubdiv + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opensubdiv/lib/osdCPU.lib ${HARVEST_TARGET}/opensubdiv/lib/osdCPU_d.lib && + ${CMAKE_COMMAND} -E copy ${LIBDIR}/opensubdiv/lib/osdGPU.lib ${HARVEST_TARGET}/opensubdiv/lib/osdGPU_d.lib && + # tbb + ${CMAKE_COMMAND} -E copy ${LIBDIR}/tbb/lib/tbb_static.lib ${HARVEST_TARGET}/tbb/lib/tbb_debug.lib && + # openvdb + ${CMAKE_COMMAND} -E copy ${LIBDIR}/openvdb/lib/openvdb.lib ${HARVEST_TARGET}/openvdb/lib/openvdb_d.lib && + # python + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/python/ ${HARVEST_TARGET}/python/ && + # alembic + ${CMAKE_COMMAND} -E copy ${LIBDIR}/alembic/lib/alembic.lib ${HARVEST_TARGET}/alembic/lib/alembic_d.lib && + # hdf5 + ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/hdf5/lib ${HARVEST_TARGET}/hdf5/lib && + # numpy + ${CMAKE_COMMAND} -E copy ${LIBDIR}/python35_numpy_1.10d.tar.gz ${HARVEST_TARGET}/Release/python35_numpy_1.10d.tar.gz && + # python + ${CMAKE_COMMAND} -E copy ${LIBDIR}/python35_d.tar.gz ${HARVEST_TARGET}/Release/python35_d.tar.gz + DEPENDS Package_Python +) +endif(BUILD_MODE STREQUAL Debug) + +else(WIN32) + +function(harvest from to) + set(pattern "") + foreach(f ${ARGN}) + set(pattern ${f}) + endforeach() + + if(pattern STREQUAL "") + get_filename_component(dirpath ${to} DIRECTORY) + get_filename_component(filename ${to} NAME) + install( + FILES ${LIBDIR}/${from} + DESTINATION ${HARVEST_TARGET}/${dirpath} + RENAME ${filename}) + else() + install( + DIRECTORY ${LIBDIR}/${from}/ + DESTINATION ${HARVEST_TARGET}/${to} + USE_SOURCE_PERMISSIONS + FILES_MATCHING PATTERN ${pattern} + PATTERN "pkgconfig" EXCLUDE + PATTERN "cmake" EXCLUDE + PATTERN "clang" EXCLUDE) + endif() +endfunction() + +harvest(alembic/include alembic/include "*.h") +harvest(alembic/lib/libAlembic.a alembic/lib/libAlembic.a) +harvest(alembic/bin alembic/bin "*") +harvest(blosc/lib openvdb/lib "*.a") +harvest(boost/include boost/include "*") +harvest(boost/lib boost/lib "*.a") +harvest(ffmpeg/include ffmpeg/include "*.h") +harvest(ffmpeg/lib ffmpeg/lib "*.a") +harvest(fftw3/include fftw3/include "*.h") +harvest(fftw3/lib fftw3/lib "*.a") +harvest(flac/lib sndfile/lib "libFLAC.a") +harvest(freetype/include freetype/include "*.h") +harvest(freetype/lib/libfreetype2ST.a freetype/lib/libfreetype.a) +harvest(glew/include glew/include "*.h") +harvest(glew/lib glew/lib "*.a") +harvest(ilmbase openexr "*") +harvest(jemalloc/include jemalloc/include "*.h") +harvest(jemalloc/lib jemalloc/lib "*.a") +harvest(jpg/include jpeg/include "*.h") +harvest(jpg/lib jpeg/lib "libjpeg.a") +harvest(lame/lib ffmpeg/lib "*.a") +harvest(llvm/bin llvm/bin "llvm-config") +harvest(llvm/lib llvm/lib "libLLVM*.a") +harvest(ogg/lib ffmpeg/lib "*.a") +harvest(openal/include openal/include "*.h") +if(UNIX AND NOT APPLE) + harvest(openal/lib openal/lib "*.a") +endif() +harvest(opencollada/include/opencollada opencollada/include "*.h") +harvest(opencollada/lib/opencollada opencollada/lib "*.a") +harvest(opencolorio/include opencolorio/include "*.h") +harvest(opencolorio/lib opencolorio/lib "*.a") +harvest(openexr/include openexr/include "*.h") +harvest(openexr/lib openexr/lib "*.a") +harvest(openimageio/bin openimageio/bin "idiff") +harvest(openimageio/bin openimageio/bin "maketx") +harvest(openimageio/bin openimageio/bin "oiiotool") +harvest(openimageio/include openimageio/include "*") +harvest(openimageio/lib openimageio/lib "*.a") +harvest(openjpeg/include/openjpeg-1.5 openjpeg/include "*.h") +harvest(openjpeg/lib openjpeg/lib "*.a") +harvest(opensubdiv/include opensubdiv/include "*.h") +harvest(opensubdiv/lib opensubdiv/lib "*.a") +harvest(openvdb/include/openvdb/openvdb openvdb/include/openvdb "*.h") +harvest(openvdb/lib openvdb/lib "*.a") +harvest(orc/lib/liborc-0.4.a ffmpeg/lib/liborc.a) +harvest(osl/bin osl/bin "oslc") +harvest(osl/include osl/include "*.h") +harvest(osl/lib osl/lib "*.a") +harvest(osl/shaders osl/shaders "*.h") +harvest(png/include png/include "*.h") +harvest(png/lib png/lib "*.a") +harvest(python/bin python/bin "python${PYTHON_SHORT_VERSION}m") +harvest(python/include python/include "*h") +harvest(python/lib/libpython${PYTHON_SHORT_VERSION}m.a python/lib/python${PYTHON_SHORT_VERSION}/libpython${PYTHON_SHORT_VERSION}m.a) +if(UNIX AND NOT APPLE) + harvest(python/lib/python${PYTHON_SHORT_VERSION} python/lib/python${PYTHON_SHORT_VERSION} "*") +else() + harvest(python/release release "*") +endif() +harvest(requests release/site-packages/requests "*") +harvest(numpy release/site-packages/numpy "*") +harvest(schroedinger/lib/libschroedinger-1.0.a ffmpeg/lib/libschroedinger.a) +harvest(sdl/include/SDL2 sdl/include "*.h") +harvest(sdl/lib sdl/lib "libSDL2.a") +harvest(sndfile/include sndfile/include "*.h") +harvest(sndfile/lib sndfile/lib "*.a") +harvest(spnav/include spnav/include "*.h") +harvest(spnav/lib spnav/lib "*.a") +harvest(tbb/include tbb/include "*.h") +harvest(tbb/lib/libtbb_static.a tbb/lib/libtbb.a) +harvest(theora/lib ffmpeg/lib "*.a") +harvest(tiff/include tiff/include "*.h") +harvest(tiff/lib tiff/lib "*.a") +harvest(vorbis/lib ffmpeg/lib "*.a") +harvest(vpx/lib ffmpeg/lib "*.a") +harvest(webp/lib ffmpeg/lib "*.a") +harvest(x264/lib ffmpeg/lib "*.a") +harvest(xml2/lib opencollada/lib "*.a") +harvest(xvidcore/lib ffmpeg/lib "*.a") + +endif(WIN32) diff --git a/build_files/build_environment/cmake/hdf5.cmake b/build_files/build_environment/cmake/hdf5.cmake new file mode 100644 index 00000000000..09d40d0605f --- /dev/null +++ b/build_files/build_environment/cmake/hdf5.cmake @@ -0,0 +1,42 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(HDF5_EXTRA_ARGS + -DHDF5_ENABLE_THREADSAFE=Off + -DHDF5_BUILD_CPP_LIB=Off + -DBUILD_TESTING=Off + -DHDF5_BUILD_TOOLS=Off + -DHDF5_BUILD_EXAMPLES=Off + -DHDF5_BUILD_HL_LIB=On + -DBUILD_STATIC_CRT_LIBS=On + -DBUILD_SHARED_LIBS=On +) + +if(WIN32) + set(HDF5_PATCH ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/hdf5/src/external_hdf5 < ${PATCH_DIR}/hdf5.diff) +endif() + +ExternalProject_Add(external_hdf5 + URL ${HDF5_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${HDF5_HASH} + PREFIX ${BUILD_DIR}/hdf5 + PATCH_COMMAND ${HDF5_PATCH} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/hdf5 ${HDF5_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/hdf5 +) diff --git a/build_files/build_environment/cmake/hidapi.cmake b/build_files/build_environment/cmake/hidapi.cmake new file mode 100644 index 00000000000..cfa4cc53d2d --- /dev/null +++ b/build_files/build_environment/cmake/hidapi.cmake @@ -0,0 +1,29 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(HIDAPI_EXTRA_ARGS) + +ExternalProject_Add(external_hidapi + URL ${HIDAPI_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${HIDAPI_HASH} + PREFIX ${BUILD_DIR}/hidapi + PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_hidapi.txt ${BUILD_DIR}/hidapi/src/external_hidapi/cmakelists.txt && ${PATCH_CMD} -p 0 -d ${BUILD_DIR}/hidapi/src/external_hidapi < ${PATCH_DIR}/hidapi.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/hidapi -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${HIDAPI_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/hidapi +) diff --git a/build_files/build_environment/cmake/iconv.cmake b/build_files/build_environment/cmake/iconv.cmake new file mode 100644 index 00000000000..cd6cf9547df --- /dev/null +++ b/build_files/build_environment/cmake/iconv.cmake @@ -0,0 +1,34 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(ICONV_EXTRA_ARGS) + +ExternalProject_Add(external_iconv + URL ${ICONV_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${ICONV_HASH} + PREFIX ${BUILD_DIR}/iconv + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/iconv/src/external_iconv/ && ${CONFIGURE_COMMAND} --enable-static --prefix=${mingw_LIBDIR}/iconv + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/iconv/src/external_iconv/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/iconv/src/external_iconv/ && make install + INSTALL_DIR ${LIBDIR}/iconv +) + +if(MSVC) + set_target_properties(external_iconv PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/ilmbase.cmake b/build_files/build_environment/cmake/ilmbase.cmake new file mode 100644 index 00000000000..0639848346f --- /dev/null +++ b/build_files/build_environment/cmake/ilmbase.cmake @@ -0,0 +1,35 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(ILMBASE_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}") +endif() + +set(ILMBASE_EXTRA_ARGS + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_CXX_STANDARD_LIBRARIES=${ILMBASE_CMAKE_CXX_STANDARD_LIBRARIES} +) + +ExternalProject_Add(external_ilmbase + URL ${ILMBASE_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${ILMBASE_HASH} + PREFIX ${BUILD_DIR}/ilmbase + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/ilmbase ${DEFAULT_CMAKE_FLAGS} ${ILMBASE_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/openexr +) diff --git a/build_files/build_environment/cmake/jemalloc.cmake b/build_files/build_environment/cmake/jemalloc.cmake new file mode 100644 index 00000000000..c39ba448917 --- /dev/null +++ b/build_files/build_environment/cmake/jemalloc.cmake @@ -0,0 +1,28 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_jemalloc + URL ${JEMALLOC_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${JEMALLOC_HASH} + PREFIX ${BUILD_DIR}/jemalloc + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/jemalloc/src/external_jemalloc/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/jemalloc --disable-shared --enable-static --with-pic + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/jemalloc/src/external_jemalloc/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/jemalloc/src/external_jemalloc/ && make install + INSTALL_DIR ${LIBDIR}/jemalloc +) diff --git a/build_files/build_environment/cmake/jpeg.cmake b/build_files/build_environment/cmake/jpeg.cmake new file mode 100644 index 00000000000..1f2b04387f0 --- /dev/null +++ b/build_files/build_environment/cmake/jpeg.cmake @@ -0,0 +1,65 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + # cmake for windows + set(JPEG_EXTRA_ARGS -DWITH_JPEG8=ON -DCMAKE_DEBUG_POSTFIX=d) + + ExternalProject_Add(external_jpeg + URL ${JPEG_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${JPEG_HASH} + PREFIX ${BUILD_DIR}/jpg + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/jpg + ) + + if(BUILD_MODE STREQUAL Debug) + ExternalProject_Add_Step(external_jpeg after_install + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpegd${LIBEXT} ${LIBDIR}/jpg/lib/jpeg${LIBEXT} + DEPENDEES install + ) + endif() + + if(BUILD_MODE STREQUAL Release) + set(JPEG_LIBRARY jpeg-static${LIBEXT}) + else() + set(JPEG_LIBRARY jpeg-staticd${LIBEXT}) + endif() +else(WIN32) + # autoconf for unix + if(APPLE) + set(JPEG_EXTRA_ARGS --host x86_64-apple-darwin --with-jpeg8) + else() + set(JPEG_EXTRA_ARGS --with-jpeg8) + endif() + + ExternalProject_Add(external_jpeg + URL ${JPEG_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${JPEG_HASH} + CONFIGURE_COMMAND ${CONFIGURE_ENV} && autoreconf -fiv && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/jpg NASM=yasm ${JPEG_EXTRA_ARGS} + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${CONFIGURE_ENV} && make install + PREFIX ${BUILD_DIR}/jpg + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/jpg + ) + + set(JPEG_LIBRARY libjpeg${LIBEXT}) +endif(WIN32) diff --git a/build_files/build_environment/cmake/lame.cmake b/build_files/build_environment/cmake/lame.cmake new file mode 100644 index 00000000000..a489b2302ce --- /dev/null +++ b/build_files/build_environment/cmake/lame.cmake @@ -0,0 +1,47 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(LAME_EXTRA_ARGS) +if(MSVC) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") + set(LAME_EXTRA_ARGS CFLAGS=-msse) + endif() +endif() + +ExternalProject_Add(external_lame + URL ${LAME_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${LAME_HASH} + PREFIX ${BUILD_DIR}/lame + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/lame/src/external_lame/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/lame --disable-shared --enable-static ${LAME_EXTRA_ARGS} + --enable-export=full + --with-fileio=sndfile + --without-vorbis + --with-pic + --disable-mp3x + --disable-mp3rtp + --disable-gtktest + --enable-export=full + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/lame/src/external_lame/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/lame/src/external_lame/ && make install + INSTALL_DIR ${LIBDIR}/lame +) + +if(MSVC) + set_target_properties(external_lame PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/lapack.cmake b/build_files/build_environment/cmake/lapack.cmake new file mode 100644 index 00000000000..3110503db52 --- /dev/null +++ b/build_files/build_environment/cmake/lapack.cmake @@ -0,0 +1,43 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(LAPACK_EXTRA_ARGS) + +if(WIN32) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(LAPACK_EXTRA_ARGS -G "MSYS Makefiles" -DCMAKE_Fortran_COMPILER=${DOWNLOAD_DIR}/mingw/mingw64/bin/gfortran.exe) + else() + set(LAPACK_EXTRA_ARGS -G "MSYS Makefiles" -DCMAKE_Fortran_COMPILER=${DOWNLOAD_DIR}/mingw/mingw32/bin/gfortran.exe) + endif() +endif() + +ExternalProject_Add(external_lapack + URL ${LAPACK_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${LAPACK_HASH} + PREFIX ${BUILD_DIR}/lapack + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/lapack/src/external_lapack/ && ${CMAKE_COMMAND} ${LAPACK_EXTRA_ARGS} -DBUILD_TESTING=Off -DCMAKE_INSTALL_PREFIX=${LIBDIR}/lapack . + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/lapack/src/external_lapack/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/lapack/src/external_lapack/ && make install + + INSTALL_DIR ${LIBDIR}/lapack +) + +if(MSVC) + set_target_properties(external_lapack PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/llvm.cmake b/build_files/build_environment/cmake/llvm.cmake new file mode 100644 index 00000000000..b9afa4d1b7b --- /dev/null +++ b/build_files/build_environment/cmake/llvm.cmake @@ -0,0 +1,44 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(LLVM_EXTRA_ARGS + -DLLVM_USE_CRT_RELEASE=MT + -DLLVM_USE_CRT_DEBUG=MTd + -DLLVM_INCLUDE_TESTS=OFF + -DLLVM_TARGETS_TO_BUILD=X86 + -DLLVM_INCLUDE_EXAMPLES=OFF + -DLLVM_ENABLE_TERMINFO=OFF +) + +if(WIN32) + set(LLVM_GENERATOR "NMake Makefiles") +else() + set(LLVM_GENERATOR "Unix Makefiles") +endif() + +# short project name due to long filename issues on windows +ExternalProject_Add(ll + URL ${LLVM_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${LLVM_HASH} + CMAKE_GENERATOR ${LLVM_GENERATOR} + PREFIX ${BUILD_DIR}/ll + PATCH_COMMAND ${PATCH_CMD} -p 0 -d ${BUILD_DIR}/ll/src/ll < ${PATCH_DIR}/llvm-alloca-fix.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/llvm ${DEFAULT_CMAKE_FLAGS} ${LLVM_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/llvm +) diff --git a/build_files/build_environment/cmake/mingw.cmake b/build_files/build_environment/cmake/mingw.cmake new file mode 100644 index 00000000000..d8b87d8bd4e --- /dev/null +++ b/build_files/build_environment/cmake/mingw.cmake @@ -0,0 +1,40 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(MSVC) + if(BUILD_MODE STREQUAL Release) + set(NUMPY_POSTFIX) + message("Python_binary = ${PYTHON_BINARY}") + message("Python_post = ${PYTHON_POSTFIX}") + + ExternalProject_Add(external_numpy + URL ${NUMPY_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${NUMPY_HASH} + PREFIX ${BUILD_DIR}/numpy + PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff + CONFIGURE_COMMAND "" + LOG_BUILD 1 + BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build + INSTALL_COMMAND ${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-3.5" + ${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python35_numpy${PYTHON_POSTFIX}_1.11.tar.gz" "." + ) + + add_dependencies(external_numpy Make_Python_Environment) + endif() +endif() diff --git a/build_files/build_environment/cmake/numpy.cmake b/build_files/build_environment/cmake/numpy.cmake new file mode 100644 index 00000000000..51cb30799a7 --- /dev/null +++ b/build_files/build_environment/cmake/numpy.cmake @@ -0,0 +1,56 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(MSVC) + if(BUILD_MODE STREQUAL Debug) + set(NUMPY_DIR_POSTFIX -pydebug) + set(NUMPY_ARCHIVE_POSTFIX d) + set(NUMPY_BUILD_OPTION --debug) + else() + set(NUMPY_DIR_POSTFIX) + set(NUMPY_ARCHIVE_POSTFIX) + set(NUMPY_BUILD_OPTION) + endif(BUILD_MODE STREQUAL Debug) +endif() + +set(NUMPY_POSTFIX) + +if(WIN32) + set(NUMPY_INSTALL + ${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-3.5${NUMPY_DIR_POSTFIX}" + ${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python35_numpy_${NUMPY_SHORT_VERSION}${NUMPY_ARCHIVE_POSTFIX}.tar.gz" "." + ) +else() + set(NUMPY_INSTALL + ${CMAKE_COMMAND} -E copy_directory "${BUILD_DIR}/numpy/src/external_numpy/build/lib.${PYTHON_ARCH2}-3.5/numpy/" "${LIBDIR}/numpy/" + ) +endif() + +ExternalProject_Add(external_numpy + URL ${NUMPY_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${NUMPY_HASH} + PREFIX ${BUILD_DIR}/numpy + PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/numpy/src/external_numpy < ${PATCH_DIR}/numpy.diff + CONFIGURE_COMMAND "" + LOG_BUILD 1 + BUILD_COMMAND ${PYTHON_BINARY} ${BUILD_DIR}/numpy/src/external_numpy/setup.py build ${NUMPY_BUILD_OPTION} + INSTALL_COMMAND ${NUMPY_INSTALL} +) + +add_dependencies(external_numpy Make_Python_Environment) diff --git a/build_files/build_environment/cmake/ogg.cmake b/build_files/build_environment/cmake/ogg.cmake new file mode 100644 index 00000000000..1f69cee0996 --- /dev/null +++ b/build_files/build_environment/cmake/ogg.cmake @@ -0,0 +1,32 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_ogg + URL ${OGG_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${OGG_HASH} + PREFIX ${BUILD_DIR}/ogg + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/ogg --disable-shared --enable-static + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/ogg/src/external_ogg/ && make install + INSTALL_DIR ${LIBDIR}/ogg +) + +if(MSVC) + set_target_properties(external_ogg PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/openal.cmake b/build_files/build_environment/cmake/openal.cmake new file mode 100644 index 00000000000..d63c4443ca0 --- /dev/null +++ b/build_files/build_environment/cmake/openal.cmake @@ -0,0 +1,42 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(BUILD_MODE STREQUAL Release) + set(OPENAL_EXTRA_ARGS + -DALSOFT_UTILS=Off + -DALSOFT_NO_CONFIG_UTIL=On + -DALSOFT_EXAMPLES=Off + -DALSOFT_TESTS=Off + -DALSOFT_CONFIG=Off + -DALSOFT_HRTF_DEFS=Off + -DALSOFT_INSTALL=On + ) + + if(UNIX) + set(OPENAL_EXTRA_ARGS ${OPENAL_EXTRA_ARGS} -DLIBTYPE=STATIC) + endif() + + ExternalProject_Add(external_openal + URL ${OPENAL_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${OPENAL_HASH} + PREFIX ${BUILD_DIR}/openal + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openal ${DEFAULT_CMAKE_FLAGS} ${OPENAL_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/openal + ) +endif() diff --git a/build_files/build_environment/cmake/opencollada.cmake b/build_files/build_environment/cmake/opencollada.cmake new file mode 100644 index 00000000000..9b2a2d9dc4d --- /dev/null +++ b/build_files/build_environment/cmake/opencollada.cmake @@ -0,0 +1,37 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(UNIX AND NOT APPLE) + set(OPENCOLLADA_EXTRA_ARGS + -DLIBXML2_INCLUDE_DIR=${LIBDIR}/xml2/include/libxml2 + -DLIBXML2_LIBRARIES=${LIBDIR}/xml2/lib/libxml2.a) +endif() + +ExternalProject_Add(external_opencollada + URL ${OPENCOLLADA_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${OPENCOLLADA_HASH} + PREFIX ${BUILD_DIR}/opencollada + PATCH_COMMAND ${PATCH_CMD} -p 1 -N -d ${BUILD_DIR}/opencollada/src/external_opencollada < ${PATCH_DIR}/opencollada.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencollada ${DEFAULT_CMAKE_FLAGS} ${OPENCOLLADA_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/opencollada +) + +if(UNIX AND NOT APPLE) + add_dependencies(external_opencollada external_xml2) +endif() diff --git a/build_files/build_environment/cmake/opencolorio.cmake b/build_files/build_environment/cmake/opencolorio.cmake new file mode 100644 index 00000000000..14fb62af672 --- /dev/null +++ b/build_files/build_environment/cmake/opencolorio.cmake @@ -0,0 +1,70 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(OPENCOLORIO_EXTRA_ARGS + -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING} + -DBoost_USE_MULTITHREADED=ON + -DBoost_USE_STATIC_LIBS=ON + -DBoost_USE_STATIC_RUNTIME=ON + -DBOOST_ROOT=${LIBDIR}/boost + -DBOOST_INCLUDEDIR=${LIBDIR}/boost/include/boost_1_60/boost + -DBoost_NO_SYSTEM_PATHS=ON + -DBoost_DEBUG=ON + -DBoost_MAJOR_VERSION=1 + -DBoost_MINOR_VERSION=60 + -DOCIO_BUILD_APPS=OFF + -DOCIO_BUILD_PYGLUE=OFF + -DOCIO_BUILD_NUKE=OFF +) + +if(WIN32) + set(OPENCOLORIO_EXTRA_ARGS + ${OPENCOLORIO_EXTRA_ARGS} + -DOCIO_USE_BOOST_PTR=ON + -DOCIO_BUILD_STATIC=OFF + -DOCIO_BUILD_SHARED=ON + ) +else() + set(OPENCOLORIO_EXTRA_ARGS + ${OPENCOLORIO_EXTRA_ARGS} + -DOCIO_USE_BOOST_PTR=OFF + -DOCIO_BUILD_STATIC=ON + -DOCIO_BUILD_SHARED=OFF + ) +endif() + +ExternalProject_Add(external_opencolorio + URL ${OPENCOLORIO_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${OPENCOLORIO_HASH} + PREFIX ${BUILD_DIR}/opencolorio + PATCH_COMMAND ${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/opencolorio/src/external_opencolorio < ${PATCH_DIR}/opencolorio.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opencolorio ${DEFAULT_CMAKE_FLAGS} ${OPENCOLORIO_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/opencolorio +) + +if(NOT WIN32) + add_custom_command( + OUTPUT ${LIBDIR}/opencolorio/lib/libtinyxml.a + COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libtinyxml.a ${LIBDIR}/opencolorio/lib/libtinyxml.a + COMMAND cp ${BUILD_DIR}/opencolorio/src/external_opencolorio-build/ext/dist/lib/libyaml-cpp.a ${LIBDIR}/opencolorio/lib/libyaml-cpp.a + ) + add_custom_target(external_opencolorio_extra ALL DEPENDS external_opencolorio ${LIBDIR}/opencolorio/lib/libtinyxml.a) +endif() + +add_dependencies(external_opencolorio external_boost) diff --git a/build_files/build_environment/cmake/openexr.cmake b/build_files/build_environment/cmake/openexr.cmake new file mode 100644 index 00000000000..53a1bc4c146 --- /dev/null +++ b/build_files/build_environment/cmake/openexr.cmake @@ -0,0 +1,41 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(OPENEXR_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}") +endif() + +set(OPENEXR_EXTRA_ARGS + -DBUILD_SHARED_LIBS=OFF + -DCMAKE_CXX_STANDARD_LIBRARIES=${OPENEXR_CMAKE_CXX_STANDARD_LIBRARIES} + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ + -DILMBASE_PACKAGE_PREFIX=${LIBDIR}/ilmbase +) + +ExternalProject_Add(external_openexr + URL ${OPENEXR_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${OPENEXR_HASH} + PREFIX ${BUILD_DIR}/openexr + PATCH_COMMAND ${PATCH_CMD} -p 0 -d ${BUILD_DIR}/openexr/src/external_openexr < ${PATCH_DIR}/openexr.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openexr ${DEFAULT_CMAKE_FLAGS} ${OPENEXR_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/openexr +) + +add_dependencies(external_openexr external_zlib external_ilmbase) diff --git a/build_files/build_environment/cmake/openimageio.cmake b/build_files/build_environment/cmake/openimageio.cmake new file mode 100644 index 00000000000..f323161d5f2 --- /dev/null +++ b/build_files/build_environment/cmake/openimageio.cmake @@ -0,0 +1,113 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(BUILD_MODE STREQUAL Release) + set(OIIO_TOOLS ON) +else() + set(OIIO_TOOLS OFF) +endif() + +if(UNIX AND NOT APPLE) + # This causes linking to static pthread libraries which gives link errors. + # Since we manually specify library paths it should static link other libs. + set(OPENIMAGEIO_LINKSTATIC -DLINKSTATIC=OFF) +else() + set(OPENIMAGEIO_LINKSTATIC -DLINKSTATIC=ON) +endif() + +if(WIN32) + set(PNG_LIBNAME libpng16_static${LIBEXT}) + set(OIIO_SIMD_FLAGS -DUSE_SIMD=sse2) +else() + set(PNG_LIBNAME libpng${LIBEXT}) + set(OIIO_SIMD_FLAGS) +endif() + +set(OPENIMAGEIO_EXTRA_ARGS + -DBUILDSTATIC=ON + ${OPENIMAGEIO_LINKSTATIC} + -DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/openexr/ + -DOPENEXR_ILMIMF_LIBRARIES=${LIBDIR}/openexr/lib/IlmImf-2_2${LIBEXT} + -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING} + -DBoost_USE_MULTITHREADED=ON + -DBoost_USE_STATIC_LIBS=ON + -DBoost_USE_STATIC_RUNTIME=ON + -DBOOST_ROOT=${LIBDIR}/boost + -DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/ + -DBoost_NO_SYSTEM_PATHS=ON + -OIIO_BUILD_CPP11=ON + -DUSE_OPENGL=OFF + -DUSE_TBB=OFF + -DUSE_FIELD3D=OFF + -DUSE_QT=OFF + -DUSE_PYTHON=OFF + -DUSE_GIF=OFF + -DUSE_OPENCV=OFF + -DUSE_OPENSSL=OFF + -DUSE_OPENJPEG=OFF + -DUSE_FFMPEG=OFF + -DUSE_PTEX=OFF + -DUSE_FREETYPE=OFF + -DUSE_LIBRAW=OFF + -DUSE_PYTHON=OFF + -DUSE_PYTHON3=OFF + -DUSE_OCIO=OFF + -DOIIO_BUILD_TOOLS=${OIIO_TOOLS} + -DOIIO_BUILD_TESTS=OFF + -DBUILD_TESTING=OFF + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include + -DPNG_LIBRARY=${LIBDIR}/png/lib/${PNG_LIBNAME} + -DPNG_PNG_INCLUDE_DIR=${LIBDIR}/png/include + -DTIFF_LIBRARY=${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT} + -DTIFF_INCLUDE_DIR=${LIBDIR}/tiff/include + -DJPEG_LIBRARY=${LIBDIR}/jpg/lib/${JPEG_LIBRARY} + -DJPEG_INCLUDE_DIR=${LIBDIR}/jpg/include + -DOCIO_PATH=${LIBDIR}/opencolorio/ + -DOpenEXR_USE_STATIC_LIBS=On + -DOPENEXR_HOME=${LIBDIR}/openexr/ + -DILMBASE_INCLUDE_PATH=${LIBDIR}/ilmbase/ + -DILMBASE_PACKAGE_PREFIX=${LIBDIR}/ilmbase/ + -DILMBASE_INCLUDE_DIR=${LIBDIR}/ilmbase/include/ + -DOPENEXR_HALF_LIBRARY=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Half${LIBEXT} + -DOPENEXR_IMATH_LIBRARY=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Imath-2_2${LIBEXT} + -DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IlmThread-2_2${LIBEXT} + -DOPENEXR_IEX_LIBRARY=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Iex-2_2${LIBEXT} + -DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/ + -DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf-2_2${LIBEXT} + -DSTOP_ON_WARNING=OFF + -DWEBP_INCLUDE_DIR=${LIBDIR}/webp/include + -DWEBP_LIBRARY=${LIBDIR}/webp/lib/${LIBPREFIX}webp${LIBEXT} + ${OIIO_SIMD_FLAGS} +) + +ExternalProject_Add(external_openimageio + URL ${OPENIMAGEIO_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${OPENIMAGEIO_HASH} + PREFIX ${BUILD_DIR}/openimageio + PATCH_COMMAND ${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/src/include < ${PATCH_DIR}/openimageio_gdi.diff && + ${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/openimageio/src/external_openimageio/ < ${PATCH_DIR}/openimageio_staticexr.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openimageio ${DEFAULT_CMAKE_FLAGS} ${OPENIMAGEIO_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/openimageio +) + +add_dependencies(external_openimageio external_png external_zlib external_ilmbase external_openexr external_jpeg external_boost external_tiff external_webp external_opencolorio) +if(NOT WIN32) + add_dependencies(external_openimageio external_opencolorio_extra) +endif() diff --git a/build_files/build_environment/cmake/openjpeg.cmake b/build_files/build_environment/cmake/openjpeg.cmake new file mode 100644 index 00000000000..66f815034eb --- /dev/null +++ b/build_files/build_environment/cmake/openjpeg.cmake @@ -0,0 +1,43 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +# Note the encoder/decoder may use png/tiff/lcms system libraries, but the +# library itself does not depend on them, so should give no problems. + +set(OPENJPEG_EXTRA_ARGS -DBUILD_SHARED_LIBS=OFF) + +if(WIN32) + set(OPENJPEG_EXTRA_ARGS -G "MSYS Makefiles") +else() + set(OPENJPEG_EXTRA_ARGS ${DEFAULT_CMAKE_FLAGS}) +endif() + +ExternalProject_Add(external_openjpeg + URL ${OPENJPEG_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${OPENJPEG_HASH} + PREFIX ${BUILD_DIR}/openjpeg + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build && ${CMAKE_COMMAND} ${OPENJPEG_EXTRA_ARGS} -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openjpeg -DBUILD_SHARED_LIBS=Off -DBUILD_THIRDPARTY=OFF ${BUILD_DIR}/openjpeg/src/external_openjpeg + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/openjpeg/src/external_openjpeg-build/ && make install + INSTALL_DIR ${LIBDIR}/openjpeg +) + +if(MSVC) + set_target_properties(external_openjpeg PROPERTIES FOLDER Mingw) +endif(MSVC) diff --git a/build_files/build_environment/cmake/opensubdiv.cmake b/build_files/build_environment/cmake/opensubdiv.cmake new file mode 100644 index 00000000000..5a3a4d142fa --- /dev/null +++ b/build_files/build_environment/cmake/opensubdiv.cmake @@ -0,0 +1,71 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(OPENSUBDIV_EXTRA_ARGS + -DNO_EXAMPLES=ON + -DNO_REGRESSION=ON + -DNO_PYTHON=ON + -DNO_MAYA=ON + -DNO_PTEX=ON + -DNO_DOC=ON + -DNO_CLEW=OFF + -DNO_OPENCL=OFF + -DNO_TUTORIALS=ON + -DGLEW_INCLUDE_DIR=${LIBDIR}/glew/include + -DGLEW_LIBRARY=${LIBDIR}/glew/lib/libGLEW${LIBEXT} + -DGLFW_INCLUDE_DIR=${LIBDIR}/glfw/include + -DGLFW_LIBRARIES=${LIBDIR}/glfw/lib/glfw3${LIBEXT} +) + +if(WIN32) + #no cuda support for vc15 yet + if(msvc15) + set(OPENSUBDIV_CUDA ON) + else() + set(OPENSUBDIV_CUDA ON) + endif() + + set(OPENSUBDIV_EXTRA_ARGS + ${OPENSUBDIV_EXTRA_ARGS} + -DNO_CUDA=${OPENSUBDIV_CUDA} + -DCLEW_INCLUDE_DIR=${LIBDIR}/clew/include/cl + -DCLEW_LIBRARY=${LIBDIR}/clew/lib/clew${LIBEXT} + -DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include + -DCUEW_LIBRARY=${LIBDIR}/cuew/lib/cuew${LIBEXT} + -DCMAKE_EXE_LINKER_FLAGS_RELEASE=libcmt.lib + ) +else() + set(OPENSUBDIV_EXTRA_ARGS + ${OPENSUBDIV_EXTRA_ARGS} + -DNO_CUDA=ON + -DCUEW_INCLUDE_DIR=${LIBDIR}/cuew/include + -DCLEW_LIBRARY=${LIBDIR}/clew/lib/static/${LIBPREFIX}clew${LIBEXT} + ) +endif() + +ExternalProject_Add(external_opensubdiv + URL ${OPENSUBDIV_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${OPENSUBDIV_Hash} + PREFIX ${BUILD_DIR}/opensubdiv + PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/opensubdiv/src/external_opensubdiv < ${PATCH_DIR}/opensubdiv.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/opensubdiv -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${OPENSUBDIV_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/opensubdiv +) + +add_dependencies(external_opensubdiv external_glew external_glfw external_clew external_cuew) diff --git a/build_files/build_environment/cmake/openvdb.cmake b/build_files/build_environment/cmake/openvdb.cmake new file mode 100644 index 00000000000..bf9ad9ca410 --- /dev/null +++ b/build_files/build_environment/cmake/openvdb.cmake @@ -0,0 +1,70 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(BUILD_MODE STREQUAL Debug) + set(BLOSC_POST _d) +endif() + +set(OPENVDB_EXTRA_ARGS + -DILMBASE_HOME=${LIBDIR}/ilmbase/ + -DILMBASE_CUSTOM=ON + -DILMBASE_CUSTOM_LIBRARIES=Half;Imath-2_2;IlmThread-2_2;Iex-2_2 + -DILMBASE_INCLUDE_DIR=${LIBDIR}/ilmbase/include/ + -DILMBASE_HALF_LIBRARIES=${LIBDIR}/ilmbase/lib/Half${LIBEXT} + -DILMBASE_IMATH_LIBRARIES=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Imath-2_2${LIBEXT} + -DILMBASE_ILMTHREAD_LIBRARIES=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IlmThread-2_2${LIBEXT} + -DILMBASE_IEX_LIBRARIES=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Iex-2_2${LIBEXT} + -DOPENEXR_HOME=${LIBDIR}/openexr/ + -DOPENEXR_USE_STATIC_LIBS=ON + -DOPENEXR_CUSTOM=ON + -DOPENEXR_CUSTOM_LIBRARY=IlmImf-2_2 + -DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/ + -DOPENEXR_ILMIMF_LIBRARIES=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf-2_2${LIBEXT} + -DTBB_ROOT_DIR=${LIBDIR}/tbb/ + -DTBB_LIBRARY=${LIBDIR}/tbb/lib/tbb_static${LIBEXT} + -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING} + -DBoost_USE_MULTITHREADED=ON + -DBoost_USE_STATIC_LIBS=ON + -DBoost_USE_STATIC_RUNTIME=ON + -DBOOST_ROOT=${LIBDIR}/boost + -DBoost_NO_SYSTEM_PATHS=ON + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ + -DWITH_BLOSC=ON + -DBLOSC_INCLUDE_DIR=${LIBDIR}/blosc/include/ + -DBLOSC_LIBRARY=${LIBDIR}/blosc/lib/libblosc${BLOSC_POST}${LIBEXT} +) + +set(OPENVDB_EXTRA_ARGS ${OPENVDB_EXTRA_ARGS}) + +# CMake script for OpenVDB based on https://raw.githubusercontent.com/diekev/openvdb-cmake/master/CMakeLists.txt +# can't be in external_openvdb because of how the includes are setup. + +ExternalProject_Add(openvdb + URL ${OPENVDB_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${OPENVDB_HASH} + PREFIX ${BUILD_DIR}/openvdb + PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_openvdb.txt ${BUILD_DIR}/openvdb/src/openvdb/CMakeLists.txt && + ${CMAKE_COMMAND} -E copy_directory ${PATCH_DIR}/cmake/ ${BUILD_DIR}/openvdb/src/openvdb/cmake/ && + ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/openvdb/src/openvdb < ${PATCH_DIR}/openvdb_vc2013.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/openvdb ${DEFAULT_CMAKE_FLAGS} ${OPENVDB_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/openvdb +) + +add_dependencies(openvdb external_tbb external_boost external_ilmbase external_openexr external_zlib external_blosc) diff --git a/build_files/build_environment/cmake/options.cmake b/build_files/build_environment/cmake/options.cmake new file mode 100644 index 00000000000..16d79d463f6 --- /dev/null +++ b/build_files/build_environment/cmake/options.cmake @@ -0,0 +1,202 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/lapack/fftw3 by installing mingw64" ON) +endif() +set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with") + +if(NOT BUILD_MODE) + set(BUILD_MODE "Release") + message(STATUS "Build type not specified: defaulting to a release build.") +endif() +Message("BuildMode = ${BUILD_MODE}") + +if(BUILD_MODE STREQUAL "Debug") + set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Debug) +ELSE(BUILD_MODE STREQUAL "Debug") + set(LIBDIR ${CMAKE_CURRENT_BINARY_DIR}/Release) +ENDIF(BUILD_MODE STREQUAL "Debug") + +set(DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/downloads) +set(PATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}/patches) +set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/build) + +message("LIBDIR = ${LIBDIR}") +message("DOWNLOAD_DIR = ${DOWNLOAD_DIR}") +message("PATCH_DIR = ${PATCH_DIR}") +message("BUILD_DIR = ${BUILD_DIR}") + +if(WIN32) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(PATCH_CMD ${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/patch.exe) + else() + set(PATCH_CMD ${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/patch.exe) + endif() + set(LIBEXT ".lib") + set(LIBPREFIX "") + + # For OIIO and OSL + set(COMMON_DEFINES /DPSAPI_VERSION=1 /DOIIO_STATIC_BUILD /DTINYFORMAT_ALLOW_WCHAR_STRINGS) + + # TODO FIXME highly MSVC specific + if(WITH_OPTIMIZED_DEBUG) + set(BLENDER_CMAKE_C_FLAGS_DEBUG "/MTd /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") + 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") + + if(WITH_OPTIMIZED_DEBUG) + 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") + else() + set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "/MTd /O2 /Ob2 /D NDEBUG /D PLATFORM_WINDOWS /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(PLATFORM_FLAGS) + set(PLATFORM_CXX_FLAGS) + set(PLATFORM_CMAKE_FLAGS) + + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(MINGW_PATH ${DOWNLOAD_DIR}/mingw/mingw64) + set(MINGW_SHELL ming64sh.cmd) + set(PERL_SHELL ${DOWNLOAD_DIR}/perl/portableshell.bat) + set(MINGW_HOST x86_64-w64-mingw32) + else() + set(MINGW_PATH ${DOWNLOAD_DIR}/mingw/mingw32) + set(MINGW_SHELL ming32sh.cmd) + set(PERL_SHELL ${DOWNLOAD_DIR}/perl32/portableshell.bat) + set(MINGW_HOST i686-w64-mingw32) + endif() + + set(CONFIGURE_ENV + cd ${MINGW_PATH} && + call ${MINGW_SHELL} && + call ${PERL_SHELL} && + set path && + set CFLAGS=-g && + set LDFLAGS=-Wl,--as-needed -static-libgcc + ) + + set(CONFIGURE_ENV_NO_PERL + cd ${MINGW_PATH} && + call ${MINGW_SHELL} && + set path && + set CFLAGS=-g && + set LDFLAGS=-Wl,--as-needed -static-libgcc + ) + + set(CONFIGURE_COMMAND sh ./configure) +else() + set(PATCH_CMD patch) + set(LIBEXT ".a") + set(LIBPREFIX "lib") + + if(APPLE) + set(OSX_ARCHITECTURES x86_64) + set(OSX_DEPLOYMENT_TARGET 10.9) + set(OSX_SDK_VERSION 10.12) + set(OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OSX_SDK_VERSION}.sdk) + + set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET}") + set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++") + set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET}") + set(PLATFORM_BUILD_TARGET --build=x86_64-apple-darwin13.0.0) # OS X 10.9 + set(PLATFORM_CMAKE_FLAGS + -DCMAKE_OSX_ARCHITECTURES:STRING=${OSX_ARCHITECTURES} + -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${OSX_DEPLOYMENT_TARGET} + -DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT} + ) + else() + set(PLATFORM_CFLAGS "-fPIC") + set(PLATFORM_CXXFLAGS "-std=c++11 -fPIC") + set(PLATFORM_LDFLAGS) + set(PLATFORM_BUILD_TARGET) + set(PLATFORM_CMAKE_FLAGS) + endif() + + if(WITH_OPTIMIZED_DEBUG) + set(BLENDER_CMAKE_C_FLAGS_DEBUG "-O2 -DNDEBUG") + else() + set(BLENDER_CMAKE_C_FLAGS_DEBUG "-g") + endif() + set(BLENDER_CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG") + set(BLENDER_CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG") + set(BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG") + + if(WITH_OPTIMIZED_DEBUG) + set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "-O2 -DNDEBUG ${PLATFORM_CXXFLAGS}") + else() + set(BLENDER_CMAKE_CXX_FLAGS_DEBUG "-g ${PLATFORM_CXXFLAGS}") + endif() + + set(BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG ${PLATFORM_CXXFLAGS}") + set(BLENDER_CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ${PLATFORM_CXXFLAGS}") + set(BLENDER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG ${PLATFORM_CXXFLAGS}") + + set(CONFIGURE_ENV + export MACOSX_DEPLOYMENT_TARGET=${OSX_DEPLOYMENT_TARGET} && + export CFLAGS=${PLATFORM_CFLAGS} && + export CXXFLAGS=${PLATFORM_CXXFLAGS} && + export LDFLAGS=${PLATFORM_LDFLAGS} + ) + set(CONFIGURE_ENV_NO_PERL ${CONFIGURE_ENV}) + set(CONFIGURE_COMMAND ./configure ${PLATFORM_BUILD_TARGET}) +endif() + +set(DEFAULT_CMAKE_FLAGS + -DCMAKE_BUILD_TYPE=${BUILD_MODE} + -DCMAKE_C_FLAGS_DEBUG=${BLENDER_CMAKE_C_FLAGS_DEBUG} + -DCMAKE_C_FLAGS_MINSIZEREL=${BLENDER_CMAKE_C_FLAGS_MINSIZEREL} + -DCMAKE_C_FLAGS_RELEASE=${BLENDER_CMAKE_C_FLAGS_RELEASE} + -DCMAKE_C_FLAGS_RELWITHDEBINFO=${BLENDER_CMAKE_C_FLAGS_RELWITHDEBINFO} + -DCMAKE_CXX_FLAGS_DEBUG=${BLENDER_CMAKE_CXX_FLAGS_DEBUG} + -DCMAKE_CXX_FLAGS_MINSIZEREL=${BLENDER_CMAKE_CXX_FLAGS_MINSIZEREL} + -DCMAKE_CXX_FLAGS_RELEASE=${BLENDER_CMAKE_CXX_FLAGS_RELEASE} + -DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} + ${PLATFORM_CMAKE_FLAGS} +) + +if(WIN32) + #we need both flavors to build the thumbnail dlls + if(MSVC12) + set(GENERATOR_32 "Visual Studio 12 2013") + set(GENERATOR_64 "Visual Studio 12 2013 Win64") + elseif(MSVC14) + set(GENERATOR_32 "Visual Studio 14 2015") + set(GENERATOR_64 "Visual Studio 14 2015 Win64") + endif() +endif() + + +if(WIN32) + set(ZLIB_LIBRARY zlibstatic${LIBEXT}) +else() + set(ZLIB_LIBRARY libz${LIBEXT}) +endif() + +if(MSVC) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +endif() + +set(CMAKE_INSTALL_MESSAGE LAZY) diff --git a/build_files/build_environment/cmake/orc.cmake b/build_files/build_environment/cmake/orc.cmake new file mode 100644 index 00000000000..aac7884f49e --- /dev/null +++ b/build_files/build_environment/cmake/orc.cmake @@ -0,0 +1,32 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_orc + URL ${ORC_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${ORC_HASH} + PREFIX ${BUILD_DIR}/orc + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/orc/src/external_orc/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/orc --disable-shared --enable-static + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/orc/src/external_orc/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/orc/src/external_orc/ && make install + INSTALL_DIR ${LIBDIR}/orc +) + +if(MSVC) + set_target_properties(external_orc PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/osl.cmake b/build_files/build_environment/cmake/osl.cmake new file mode 100644 index 00000000000..97b86c39baa --- /dev/null +++ b/build_files/build_environment/cmake/osl.cmake @@ -0,0 +1,87 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(OSL_CMAKE_CXX_STANDARD_LIBRARIES "kernel32${LIBEXT} user32${LIBEXT} gdi32${LIBEXT} winspool${LIBEXT} shell32${LIBEXT} ole32${LIBEXT} oleaut32${LIBEXT} uuid${LIBEXT} comdlg32${LIBEXT} advapi32${LIBEXT} psapi${LIBEXT}") + set(OSL_FLEX_BISON -DFLEX_EXECUTABLE=${LIBDIR}/flexbison/win_flex.exe -DFLEX_EXTRA_OPTIONS="--wincompat" -DBISON_EXECUTABLE=${LIBDIR}/flexbison/win_bison.exe) + set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/libpng16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf-2_2${LIBEXT}") + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4") + set(OSL_SIMD_FLAGS -DOIIO_SIMD=0) + else() + set(OSL_SIMD_FLAGS -DOIIO_SIMD=sse2) + endif() +else() + set(OSL_CMAKE_CXX_STANDARD_LIBRARIES) + set(OSL_FLEX_BISON) + set(OSL_OPENIMAGEIO_LIBRARY "${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO${LIBEXT};${LIBDIR}/openimageio/lib/${LIBPREFIX}OpenImageIO_Util${LIBEXT};${LIBDIR}/png/lib/${LIBPREFIX}png16${LIBEXT};${LIBDIR}/jpg/lib/${LIBPREFIX}jpeg${LIBEXT};${LIBDIR}/tiff/lib/${LIBPREFIX}tiff${LIBEXT};${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf-2_2${LIBEXT}") +endif() + +set(OSL_ILMBASE_CUSTOM_LIBRARIES "${LIBDIR}/ilmbase/lib/Imath-2_2.lib^^${LIBDIR}/ilmbase/lib/Half.lib^^${LIBDIR}/ilmbase/lib/IlmThread-2_2.lib^^${LIBDIR}/ilmbase/lib/Iex-2_2.lib") +set(OSL_LLVM_LIBRARY "${LIBDIR}/llvm/lib/LLVMAnalysis${LIBEXT};${LIBDIR}/llvm/lib/LLVMAsmParser${LIBEXT};${LIBDIR}/llvm/lib/LLVMAsmPrinter${LIBEXT};${LIBDIR}/llvm/lib/LLVMBitReader${LIBEXT};${LIBDIR}/llvm/lib/LLVMBitWriter${LIBEXT};${LIBDIR}/llvm/lib/LLVMCodeGen${LIBEXT};${LIBDIR}/llvm/lib/LLVMCore${LIBEXT};${LIBDIR}/llvm/lib/LLVMDebugInfo${LIBEXT};${LIBDIR}/llvm/lib/LLVMExecutionEngine${LIBEXT};${LIBDIR}/llvm/lib/LLVMInstCombine${LIBEXT};${LIBDIR}/llvm/lib/LLVMInstrumentation${LIBEXT};${LIBDIR}/llvm/lib/LLVMInterpreter${LIBEXT};${LIBDIR}/llvm/lib/LLVMJIT${LIBEXT};${LIBDIR}/llvm/lib/LLVMLinker${LIBEXT};${LIBDIR}/llvm/lib/LLVMMC${LIBEXT};${LIBDIR}/llvm/lib/LLVMMCDisassembler${LIBEXT};${LIBDIR}/llvm/lib/LLVMMCJIT${LIBEXT};${LIBDIR}/llvm/lib/LLVMMCParser${LIBEXT};${LIBDIR}/llvm/lib/LLVMObject${LIBEXT};${LIBDIR}/llvm/lib/LLVMRuntimeDyld${LIBEXT};${LIBDIR}/llvm/lib/LLVMScalarOpts${LIBEXT};${LIBDIR}/llvm/lib/LLVMSelectionDAG${LIBEXT};${LIBDIR}/llvm/lib/LLVMSupport${LIBEXT};${LIBDIR}/llvm/lib/LLVMTableGen${LIBEXT};${LIBDIR}/llvm/lib/LLVMTarget${LIBEXT};${LIBDIR}/llvm/lib/LLVMTransformUtils${LIBEXT};${LIBDIR}/llvm/lib/LLVMVectorize${LIBEXT};${LIBDIR}/llvm/lib/LLVMX86AsmParser${LIBEXT};${LIBDIR}/llvm/lib/LLVMX86AsmPrinter${LIBEXT};${LIBDIR}/llvm/lib/LLVMX86CodeGen${LIBEXT};${LIBDIR}/llvm/lib/LLVMX86Desc${LIBEXT};${LIBDIR}/llvm/lib/LLVMX86Disassembler${LIBEXT};${LIBDIR}/llvm/lib/LLVMX86Info${LIBEXT};${LIBDIR}/llvm/lib/LLVMX86Utils${LIBEXT};${LIBDIR}/llvm/lib/LLVMipa${LIBEXT};${LIBDIR}/llvm/lib/LLVMipo${LIBEXT}") + +set(OSL_EXTRA_ARGS + -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING} + -DBoost_USE_MULTITHREADED=ON + -DBoost_USE_STATIC_LIBS=ON + -DBoost_USE_STATIC_RUNTIME=ON + -DBOOST_ROOT=${LIBDIR}/boost + -DBOOST_LIBRARYDIR=${LIBDIR}/boost/lib/ + -DBoost_NO_SYSTEM_PATHS=ON + -DLLVM_DIRECTORY=${LIBDIR}/llvm + -DLLVM_INCLUDES=${LIBDIR}/llvm/include + -DLLVM_LIB_DIR=${LIBDIR}/llvm/lib + -DLLVM_VERSION=3.4 + -DLLVM_LIBRARY=${OSL_LLVM_LIBRARY} + -DOPENEXR_HOME=${LIBDIR}/openexr/ + -DILMBASE_HOME=${LIBDIR}/ilmbase/ + -DILMBASE_INCLUDE_DIR=${LIBDIR}/ilmbase/include/ + -DOPENEXR_IMATH_LIBRARY=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Imath-2_2${LIBEXT} + -DOPENEXR_ILMTHREAD_LIBRARY=${LIBDIR}/ilmbase/lib/${LIBPREFIX}IlmThread-2_2${LIBEXT} + -DOPENEXR_IEX_LIBRARY=${LIBDIR}/ilmbase/lib/${LIBPREFIX}Iex-2_2${LIBEXT} + -DOPENEXR_INCLUDE_DIR=${LIBDIR}/openexr/include/ + -DOPENEXR_ILMIMF_LIBRARY=${LIBDIR}/openexr/lib/${LIBPREFIX}IlmImf-2_2${LIBEXT} + -DOSL_BUILD_TESTS=OFF + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ + -DOPENIMAGEIOHOME=${LIBDIR}/openimageio/ + -DOPENIMAGEIO_LIBRARY=${OSL_OPENIMAGEIO_LIBRARY} + -DOPENIMAGEIO_INCLUDES=${LIBDIR}/openimageio/include + ${OSL_FLEX_BISON} + -DCMAKE_CXX_STANDARD_LIBRARIES=${OSL_CMAKE_CXX_STANDARD_LIBRARIES} + -DBUILDSTATIC=ON + -DLINKSTATIC=ON + -DOSL_BUILD_PLUGINS=Off + -DSTOP_ON_WARNING=OFF + -DOSL_BUILD_CPP11=ON + -DUSE_LLVM_BITCODE=OFF + ${OSL_SIMD_FLAGS} +) + +ExternalProject_Add(external_osl + URL ${OSL_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + LIST_SEPARATOR ^^ + URL_HASH MD5=${OSL_HASH} + PREFIX ${BUILD_DIR}/osl + PATCH_COMMAND ${PATCH_CMD} -p 3 -d ${BUILD_DIR}/osl/src/external_osl < ${PATCH_DIR}/osl.diff && + ${PATCH_CMD} -p 0 -d ${BUILD_DIR}/osl/src/external_osl < ${PATCH_DIR}/osl_simd_oiio.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/osl -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} ${DEFAULT_CMAKE_FLAGS} ${OSL_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/osl +) + +add_dependencies(external_osl external_boost ll external_clang external_ilmbase external_openexr external_zlib external_flexbison external_openimageio) diff --git a/build_files/build_environment/cmake/png.cmake b/build_files/build_environment/cmake/png.cmake new file mode 100644 index 00000000000..8d6fee871f9 --- /dev/null +++ b/build_files/build_environment/cmake/png.cmake @@ -0,0 +1,41 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(PNG_EXTRA_ARGS + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/ + -DPNG_STATIC=ON +) + +ExternalProject_Add(external_png + URL ${PNG_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${PNG_HASH} + PREFIX ${BUILD_DIR}/png + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/png ${DEFAULT_CMAKE_FLAGS} ${PNG_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/png +) + +add_dependencies(external_png external_zlib) + +if(BUILD_MODE STREQUAL Debug) + ExternalProject_Add_Step(external_png after_install + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/png/lib/libpng16_staticd${LIBEXT} ${LIBDIR}/png/lib/libpng16${LIBEXT} + DEPENDEES install + ) +endif() diff --git a/build_files/build_environment/cmake/pthreads.cmake b/build_files/build_environment/cmake/pthreads.cmake new file mode 100644 index 00000000000..f4301b95f3a --- /dev/null +++ b/build_files/build_environment/cmake/pthreads.cmake @@ -0,0 +1,45 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(PTHREAD_XCFLAGS /MD) + + if(MSVC14) # vs2015 has timespec + set(PTHREAD_CPPFLAGS "/I. /DHAVE_PTW32_CONFIG_H /D_TIMESPEC_DEFINED ") + else() # everything before doesn't + set(PTHREAD_CPPFLAGS "/I. /DHAVE_PTW32_CONFIG_H ") + endif() + + set(PTHREADS_BUILD cd ${BUILD_DIR}/pthreads/src/external_pthreads/ && cd && nmake VC /e CPPFLAGS=${PTHREAD_CPPFLAGS} /e XCFLAGS=${PTHREAD_XCFLAGS} /e XLIBS=/NODEFAULTLIB:msvcr) + + ExternalProject_Add(external_pthreads + URL ${PTHREADS_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA512=${PTHREADS_SHA512} + PREFIX ${BUILD_DIR}/pthreads + CONFIGURE_COMMAND echo . + PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/pthreads/src/external_pthreads < ${PATCH_DIR}/pthreads.diff + BUILD_COMMAND ${PTHREADS_BUILD} + INSTALL_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/pthreadVC2.dll ${LIBDIR}/pthreads/lib/pthreadVC2.dll && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/pthreadVC2${LIBEXT} ${LIBDIR}/pthreads/lib/pthreadVC2${LIBEXT} && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/pthread.h ${LIBDIR}/pthreads/inc/pthread.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/sched.h ${LIBDIR}/pthreads/inc/sched.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/pthreads/src/external_pthreads/semaphore.h ${LIBDIR}/pthreads/inc/semaphore.h + INSTALL_DIR ${LIBDIR}/pthreads + ) +endif() diff --git a/build_files/build_environment/cmake/python.cmake b/build_files/build_environment/cmake/python.cmake new file mode 100644 index 00000000000..a24bbbb6aea --- /dev/null +++ b/build_files/build_environment/cmake/python.cmake @@ -0,0 +1,144 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(PYTHON_POSTFIX) +if(BUILD_MODE STREQUAL Debug) + set(PYTHON_POSTFIX _d) +endif() + +if(WIN32) + set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/run/python${PYTHON_POSTFIX}.exe) + + macro(cmake_to_dos_path MsysPath ResultingPath) + string(REPLACE "/" "\\" ${ResultingPath} "${MsysPath}") + endmacro() + + set(PYTHON_EXTERNALS_FOLDER ${BUILD_DIR}/python/src/external_python/externals) + set(DOWNLOADS_EXTERNALS_FOLDER ${DOWNLOAD_DIR}/externals) + + cmake_to_dos_path(${PYTHON_EXTERNALS_FOLDER} PYTHON_EXTERNALS_FOLDER_DOS) + cmake_to_dos_path(${DOWNLOADS_EXTERNALS_FOLDER} DOWNLOADS_EXTERNALS_FOLDER_DOS) + + message("Python externals = ${PYTHON_EXTERNALS_FOLDER}") + message("Python externals_dos = ${PYTHON_EXTERNALS_FOLDER_DOS}") + message("Python DOWNLOADS_EXTERNALS_FOLDER = ${DOWNLOADS_EXTERNALS_FOLDER}") + message("Python DOWNLOADS_EXTERNALS_FOLDER_DOS = ${DOWNLOADS_EXTERNALS_FOLDER_DOS}") + + ExternalProject_Add(external_python + URL ${PYTHON_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${PYTHON_HASH} + PREFIX ${BUILD_DIR}/python + PATCH_COMMAND echo mklink /D "${PYTHON_EXTERNALS_FOLDER_DOS}" "${DOWNLOADS_EXTERNALS_FOLDER_DOS}" && + mklink /D "${PYTHON_EXTERNALS_FOLDER_DOS}" "${DOWNLOADS_EXTERNALS_FOLDER_DOS}" && + ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python.diff && + ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/python/src/external_python/pc < ${PATCH_DIR}/pyshell.diff + CONFIGURE_COMMAND "" + BUILD_COMMAND cd ${BUILD_DIR}/python/src/external_python/pcbuild/ && set IncludeTkinter=false && call build.bat -e -p ${PYTHON_ARCH} -c ${BUILD_MODE} -k ${PYTHON_COMPILER_STRING} + INSTALL_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PYTHON_OUTPUTDIR}/python35${PYTHON_POSTFIX}.dll ${LIBDIR}/python/lib/python35${PYTHON_POSTFIX}.dll && + ${CMAKE_COMMAND} -E copy ${PYTHON_OUTPUTDIR}/python35${PYTHON_POSTFIX}.lib ${LIBDIR}/python/lib/python35${PYTHON_POSTFIX}.lib && + ${CMAKE_COMMAND} -E copy ${PYTHON_OUTPUTDIR}/python35${PYTHON_POSTFIX}.exp ${LIBDIR}/python/lib/python35${PYTHON_POSTFIX}.exp && + ${CMAKE_COMMAND} -E copy_directory ${BUILD_DIR}/python/src/external_python/include ${LIBDIR}/python/include/Python3.5 && + ${CMAKE_COMMAND} -E copy "${BUILD_DIR}/python/src/external_python/PC/pyconfig.h" ${LIBDIR}/python/include/Python3.5/pyconfig.h + ) + Message("PythinRedist = ${BUILD_DIR}/python/src/external_python/redist") + Message("POutput = ${PYTHON_OUTPUTDIR}") +else() + if(APPLE) + # we need to manually add homebrew headers to get ssl module building + set(PYTHON_CFLAGS "-I/usr/local/opt/openssl/include -I${OSX_SYSROOT}/usr/include ${PLATFORM_CFLAGS}") + set(PYTHON_LDFLAGS "-L/usr/local/opt/openssl/lib ${PLATFORM_LDFLAGS}") + set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV} && export CFLAGS=${PYTHON_CFLAGS} && export LDFLAGS=${PYTHON_LDFLAGS}) + set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python.exe) + set(PYTHON_PATCH ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/python/src/external_python < ${PATCH_DIR}/python_apple.diff) + else() + set(PYTHON_CONFIGURE_ENV ${CONFIGURE_ENV}) + set(PYTHON_BINARY ${BUILD_DIR}/python/src/external_python/python) + endif() + + ExternalProject_Add(external_python + URL ${PYTHON_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${PYTHON_HASH} + PREFIX ${BUILD_DIR}/python + PATCH_COMMAND ${PYTHON_PATCH} + CONFIGURE_COMMAND ${PYTHON_CONFIGURE_ENV} && cd ${BUILD_DIR}/python/src/external_python/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/python + BUILD_COMMAND ${PYTHON_CONFIGURE_ENV} && cd ${BUILD_DIR}/python/src/external_python/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${PYTHON_CONFIGURE_ENV} && cd ${BUILD_DIR}/python/src/external_python/ && make install + INSTALL_DIR ${LIBDIR}/python) + + add_custom_command( + OUTPUT ${LIBDIR}/python/release/python_x86_64.zip + WORKING_DIRECTORY ${LIBDIR}/python + COMMAND mkdir -p release + COMMAND zip -r release/python_x86_64.zip lib/python${PYTHON_SHORT_VERSION} lib/pkgconfig --exclude *__pycache__*) + add_custom_target(Package_Python ALL DEPENDS external_python ${LIBDIR}/python/release/python_x86_64.zip) + add_custom_target(Make_Python_Environment ALL DEPENDS Package_Python) +endif() + +if(MSVC) + add_custom_command( + OUTPUT ${LIBDIR}/python35${PYTHON_POSTFIX}.tar.gz + OUTPUT ${BUILD_DIR}/python/src/external_python/redist/bin/python${PYTHON_POSTFIX}.exe + COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILD_DIR}/python/src/external_python/lib ${BUILD_DIR}/python/src/external_python/redist/lib + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/python${PYTHON_POSTFIX}.exe" ${BUILD_DIR}/python/src/external_python/redist/bin/python${PYTHON_POSTFIX}.exe + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_bz2${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_bz2${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_hashlib${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_hashlib${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_lzma${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_lzma${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_sqlite3${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_sqlite3${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_ssl${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_ssl${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/pyexpat${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/pyexpat${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/select${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/select${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/unicodedata${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/unicodedata${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/winsound${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/winsound${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_ctypes${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_ctypes${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_ctypes_test${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_ctypes_test${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_decimal${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_decimal${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_elementtree${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_elementtree${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_msi${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_msi${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_multiprocessing${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_multiprocessing${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_overlapped${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_overlapped${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_socket${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_socket${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_testbuffer${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_testbuffer${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_testcapi${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_testcapi${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_testimportmultiple${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_testimportmultiple${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/_testmultiphase${PYTHON_POSTFIX}.pyd" ${BUILD_DIR}/python/src/external_python/redist/lib/_testmultiphase${PYTHON_POSTFIX}.pyd + COMMAND ${CMAKE_COMMAND} -E chdir "${BUILD_DIR}/python/src/external_python/redist" ${CMAKE_COMMAND} -E tar "cfvz" "${LIBDIR}/python35${PYTHON_POSTFIX}.tar.gz" "." + ) + + add_custom_target(Package_Python ALL DEPENDS external_python ${LIBDIR}/python35${PYTHON_POSTFIX}.tar.gz ${BUILD_DIR}/python/src/external_python/redist/bin/python${PYTHON_POSTFIX}.exe) + + if(MSVC12) + set(PYTHON_DISTUTIL_PATCH ${PATCH_CMD} --verbose -p 0 -d ${BUILD_DIR}/python/src/external_python/run/lib/distutils < ${PATCH_DIR}/python_runtime_vc2013.diff) + else() + set(PYTHON_DISTUTIL_PATCH echo "No patch needed") + endif() + + add_custom_command(OUTPUT ${BUILD_DIR}/python/src/external_python/run/python${PYTHON_POSTFIX}.exe + COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILD_DIR}/python/src/external_python/redist ${BUILD_DIR}/python/src/external_python/run + COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILD_DIR}/python/src/external_python/include ${BUILD_DIR}/python/src/external_python/run/include + COMMAND ${CMAKE_COMMAND} -E copy "${BUILD_DIR}/python/src/external_python/PC/pyconfig.h" ${BUILD_DIR}/python/src/external_python/run/include/pyconfig.h + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/python35${PYTHON_POSTFIX}.dll" ${BUILD_DIR}/python/src/external_python/run/python35${PYTHON_POSTFIX}.dll + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/python35${PYTHON_POSTFIX}.lib" ${BUILD_DIR}/python/src/external_python/run/libs/python35.lib #missing postfix on purpose, distutils is not expecting it + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/python35${PYTHON_POSTFIX}.lib" ${BUILD_DIR}/python/src/external_python/run/libs/python35${PYTHON_POSTFIX}.lib #other things like numpy still want it though. + COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_OUTPUTDIR}/python${PYTHON_POSTFIX}.exe" ${BUILD_DIR}/python/src/external_python/run/python${PYTHON_POSTFIX}.exe + COMMAND ${BUILD_DIR}/python/src/external_python/run/python${PYTHON_POSTFIX}.exe -m ensurepip --upgrade + COMMAND ${PYTHON_DISTUTIL_PATCH} + ) + add_custom_target(Make_Python_Environment ALL DEPENDS ${BUILD_DIR}/python/src/external_python/run/python${PYTHON_POSTFIX}.exe Package_Python) +endif(MSVC) diff --git a/build_files/build_environment/cmake/requests.cmake b/build_files/build_environment/cmake/requests.cmake new file mode 100644 index 00000000000..399bfe4009f --- /dev/null +++ b/build_files/build_environment/cmake/requests.cmake @@ -0,0 +1,29 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(BUILD_MODE STREQUAL Release) + ExternalProject_Add(external_requests + URL ${REQUESTS_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${REQUESTS_HASH} + PREFIX ${BUILD_DIR}/requests + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory ${BUILD_DIR}/requests/src/external_requests/requests ${LIBDIR}/requests + ) +endif(BUILD_MODE STREQUAL Release) diff --git a/build_files/build_environment/cmake/schroedinger.cmake b/build_files/build_environment/cmake/schroedinger.cmake new file mode 100644 index 00000000000..54a20db5b5e --- /dev/null +++ b/build_files/build_environment/cmake/schroedinger.cmake @@ -0,0 +1,45 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(SCHROEDINGER_EXTRA_FLAGS "CFLAGS=-g -I./ -I${LIBDIR}/orc/include/orc-0.4" "LDFLAGS=-Wl,--as-needed -static-libgcc -L${LIBDIR}/orc/lib" ORC_CFLAGS=-I${LIBDIR}/orc/include/orc-0.4 ORC_LDFLAGS=-L${LIBDIR}/orc/lib ORC_LIBS=${LIBDIR}/orc/lib/liborc-0.4.a ORCC=${LIBDIR}/orc/bin/orcc.exe) +else() + set(SCHROEDINGER_CFLAGS "${PLATFORM_CFLAGS} -I./ -I${LIBDIR}/orc/include/orc-0.4") + set(SCHROEDINGER_LDFLAGS "${PLATFORM_LDFLAGS} -L${LIBDIR}/orc/lib") + set(SCHROEDINGER_EXTRA_FLAGS CFLAGS=${SCHROEDINGER_CFLAGS} LDFLAGS=${SCHROEDINGER_LDFLAGS} ORC_CFLAGS=-I${LIBDIR}/orc/include/orc-0.4 ORC_LDFLAGS=-L${LIBDIR}/orc/lib ORCC=${LIBDIR}/orc/bin/orcc) # ORC_LIBS=${LIBDIR}/orc/lib/liborc-0.4.a +endif() + +ExternalProject_Add(external_schroedinger + URL ${SCHROEDINGER_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${SCHROEDINGER_HASH} + PREFIX ${BUILD_DIR}/schroedinger + PATCH_COMMAND ${PATCH_CMD} --verbose -p 0 -N -d ${BUILD_DIR}/schroedinger/src/external_schroedinger < ${PATCH_DIR}/schroedinger.diff + CONFIGURE_COMMAND ${CONFIGURE_ENV} && + cd ${BUILD_DIR}/schroedinger/src/external_schroedinger/ && + ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/schroedinger --disable-shared --enable-static ${SCHROEDINGER_EXTRA_FLAGS} + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/schroedinger/src/external_schroedinger/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/schroedinger/src/external_schroedinger/ && make install + INSTALL_DIR ${LIBDIR}/schroedinger +) + +add_dependencies(external_schroedinger external_orc) + +if(MSVC) + set_target_properties(external_schroedinger PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/sdl.cmake b/build_files/build_environment/cmake/sdl.cmake new file mode 100644 index 00000000000..0fbfa078eb1 --- /dev/null +++ b/build_files/build_environment/cmake/sdl.cmake @@ -0,0 +1,39 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(SDL_EXTRA_ARGS + -DSDL_STATIC=Off + ) +else() + set(SDL_EXTRA_ARGS + -DSDL_STATIC=ON + -DSDL_SHARED=OFF + -DSDL_VIDEO=OFF + ) +endif() + +ExternalProject_Add(external_sdl + URL ${SDL_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${SDL_HASH} + PREFIX ${BUILD_DIR}/sdl + PATCH_COMMAND ${PATCH_CMD} -p 0 -N -d ${BUILD_DIR}/sdl/src/external_sdl < ${PATCH_DIR}/sdl.diff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/sdl ${DEFAULT_CMAKE_FLAGS} ${SDL_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/sdl +) diff --git a/build_files/build_environment/cmake/setup_mingw32.cmake b/build_files/build_environment/cmake/setup_mingw32.cmake new file mode 100644 index 00000000000..f0d99356da0 --- /dev/null +++ b/build_files/build_environment/cmake/setup_mingw32.cmake @@ -0,0 +1,219 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +#################################################################################################################### +# Mingw32 Builds +#################################################################################################################### +# This installs mingw32+msys to compile ffmpeg/iconv/libsndfile/lapack/fftw3 +#################################################################################################################### + +message("LIBDIR = ${LIBDIR}") +macro(cmake_to_msys_path MsysPath ResultingPath) + string(REPLACE ":" "" TmpPath "${MsysPath}") + string(SUBSTRING ${TmpPath} 0 1 Drive) + string(SUBSTRING ${TmpPath} 1 255 PathPart) + string(TOLOWER ${Drive} LowerDrive) + string(CONCAT ${ResultingPath} "/" ${LowerDrive} ${PathPart}) +endmacro() +cmake_to_msys_path(${LIBDIR} mingw_LIBDIR) +message("mingw_LIBDIR = ${mingw_LIBDIR}") + +message("Checking for mingw32") +# download mingw32 +if(NOT EXISTS "${DOWNLOAD_DIR}/i686-w64-mingw32-gcc-4.8.0-win32_rubenvb.7z") + message("Downloading mingw32") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-4.8-release/i686-w64-mingw32-gcc-4.8.0-win32_rubenvb.7z" "${DOWNLOAD_DIR}/i686-w64-mingw32-gcc-4.8.0-win32_rubenvb.7z") +endif() + +# make mingw root directory +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw") + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/mingw + WORKING_DIRECTORY ${DOWNLOAD_DIR} + ) +endif() + +# extract mingw32 +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/mingw32env.cmd") AND (EXISTS "${DOWNLOAD_DIR}/i686-w64-mingw32-gcc-4.8.0-win32_rubenvb.7z")) + message("Extracting mingw32") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/i686-w64-mingw32-gcc-4.8.0-win32_rubenvb.7z + WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw + ) +endif() + +message("Checking for pkg-config") +if(NOT EXISTS "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip") + message("Downloading pkg-config") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip" "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip") +endif() + +# extract pkgconfig +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/pkg-config.exe") AND (EXISTS "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip")) + message("Extracting pkg-config") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/ + ) + + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1/bin/pkg-config.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/pkg-config.exe" + ) + +endif() + +message("Checking for nasm") +if(NOT EXISTS "${DOWNLOAD_DIR}/nasm-2.12.01-win32.zip") + message("Downloading nasm") + file(DOWNLOAD "http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win32/nasm-2.12.01-win32.zip" "${DOWNLOAD_DIR}/nasm-2.12.01-win32.zip") +endif() + +# extract nasm +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/nasm.exe") AND (EXISTS "${DOWNLOAD_DIR}/nasm-2.12.01-win32.zip")) + message("Extracting nasm") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/nasm-2.12.01-win32.zip" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/ + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/nasm-2.12.01/nasm.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/nasm.exe" + ) + +endif() + +message("Checking for mingwGet") +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip") + message("Downloading mingw-get") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip" "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip") +endif() + +# extract mingw_get +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get.exe") AND (EXISTS "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip")) + message("Extracting mingw-get") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw32/ + ) +endif() + +if((EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get.exe") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/make.exe")) + message("Installing MSYS") + execute_process( + COMMAND ${DOWNLOAD_DIR}/mingw/mingw32/bin/mingw-get install msys msys-patch + WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw32/bin/ + ) +endif() + +message("Checking for CoreUtils") +# download old core_utils for pr.exe (ffmpeg needs it to build) +if(NOT EXISTS "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2") + message("Downloading CoreUtils 5.97") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw/MSYS/Base/msys-core/_obsolete/coreutils-5.97-MSYS-1.0.11-2/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2" "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2") +endif() + +if((EXISTS "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/pr.exe")) + message("Installing pr from CoreUtils 5.97") + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/tmp_coreutils + WORKING_DIRECTORY ${DOWNLOAD_DIR} + ) + + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 + WORKING_DIRECTORY ${DOWNLOAD_DIR}/tmp_coreutils/ + ) + + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy ${DOWNLOAD_DIR}/tmp_coreutils/coreutils-5.97/bin/pr.exe "${DOWNLOAD_DIR}/mingw/mingw32/msys/1.0/bin/pr.exe" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/tmp_coreutils/ + ) +endif() + +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/ming32sh.cmd") + message("Installing ming32sh.cmd") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/ming32sh.cmd ${DOWNLOAD_DIR}/mingw/mingw32/ming32sh.cmd + ) +endif() + +message("Checking for perl") +# download perl for libvpx +if(NOT EXISTS "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip") + message("Downloading perl") + file(DOWNLOAD "http://strawberryperl.com/download/5.22.1.3/strawberry-perl-5.22.1.3-32bit-portable.zip" "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip") +endif() + +# make perl root directory +if(NOT EXISTS "${DOWNLOAD_DIR}/perl32") + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/perl32 + WORKING_DIRECTORY ${DOWNLOAD_DIR} + ) +endif() + +# extract perl +if((NOT EXISTS "${DOWNLOAD_DIR}/perl32/portable.perl") AND (EXISTS "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip")) + message("Extracting perl") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-32bit-portable.zip + WORKING_DIRECTORY ${DOWNLOAD_DIR}/perl32 + ) +endif() + +# get yasm for vpx +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/yasm.exe") + message("Downloading yasm") + file(DOWNLOAD "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win32.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/yasm.exe") +endif() + +message("checking i686-w64-mingw32-strings") +# copy strings.exe to i686-w64-mingw32-strings for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strings.exe") + message("fixing i686-w64-mingw32-strings.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/strings.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strings.exe" + ) +endif() + +message("checking i686-w64-mingw32-ar.exe") +# copy ar.exe to i686-w64-mingw32-ar.exe for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ar.exe") + message("fixing i686-w64-mingw32-ar.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ar.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ar.exe" + ) +endif() + +message("checking i686-w64-mingw32-strip.exe") +# copy strip.exe to i686-w64-mingw32-strip.exe for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strip.exe") + message("fixing i686-w64-mingw32-strip.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/strip.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-strip.exe" + ) +endif() + +message("checking i686-w64-mingw32-ranlib.exe") +# copy ranlib.exe to i686-w64-mingw32-ranlib.exe for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe") + message("fixing i686-w64-mingw32-ranlib.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw32/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw32/bin/i686-w64-mingw32-ranlib.exe" + ) +endif() + diff --git a/build_files/build_environment/cmake/setup_mingw64.cmake b/build_files/build_environment/cmake/setup_mingw64.cmake new file mode 100644 index 00000000000..14f75d410b4 --- /dev/null +++ b/build_files/build_environment/cmake/setup_mingw64.cmake @@ -0,0 +1,219 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +#################################################################################################################### +# Mingw64 Builds +#################################################################################################################### +# This installs mingw64+msys to compile ffmpeg/iconv/libsndfile/lapack/fftw3 +#################################################################################################################### + +message("LIBDIR = ${LIBDIR}") +macro(cmake_to_msys_path MsysPath ResultingPath) + string(REPLACE ":" "" TmpPath "${MsysPath}") + string(SUBSTRING ${TmpPath} 0 1 Drive) + string(SUBSTRING ${TmpPath} 1 255 PathPart) + string(TOLOWER ${Drive} LowerDrive) + string(CONCAT ${ResultingPath} "/" ${LowerDrive} ${PathPart}) +endmacro() +cmake_to_msys_path(${LIBDIR} mingw_LIBDIR) +message("mingw_LIBDIR = ${mingw_LIBDIR}") + +message("Checking for mingw64") +# download ming64 +if(NOT EXISTS "${DOWNLOAD_DIR}/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z") + message("Downloading mingw64") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.8-release/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z" "${DOWNLOAD_DIR}/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z") +endif() + +# make mingw root directory +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw") + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/mingw + WORKING_DIRECTORY ${DOWNLOAD_DIR} + ) +endif() + +# extract mingw64 +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/mingw64env.cmd") AND (EXISTS "${DOWNLOAD_DIR}/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z")) + message("Extracting mingw64") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/x86_64-w64-mingw32-gcc-4.8.0-win64_rubenvb.7z + WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw + ) +endif() + +message("Checking for pkg-config") +if(NOT EXISTS "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip") + message("Downloading pkg-config") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/pkgconfiglite/0.28-1/pkg-config-lite-0.28-1_bin-win32.zip" "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip") +endif() + +# extract pkgconfig +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/pkg-config.exe") AND (EXISTS "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip")) + message("Extracting pkg-config") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1_bin-win32.zip" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/ + ) + + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/pkg-config-lite-0.28-1/bin/pkg-config.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/pkg-config.exe" + ) + +endif() + +message("Checking for nasm") +if(NOT EXISTS "${DOWNLOAD_DIR}/nasm-2.12.01-win64.zip") + message("Downloading nasm") + file(DOWNLOAD "http://www.nasm.us/pub/nasm/releasebuilds/2.12.01/win64/nasm-2.12.01-win64.zip" "${DOWNLOAD_DIR}/nasm-2.12.01-win64.zip") +endif() + +# extract nasm +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/nasm.exe") AND (EXISTS "${DOWNLOAD_DIR}/nasm-2.12.01-win64.zip")) + message("Extracting nasm") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/nasm-2.12.01-win64.zip" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/ + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/nasm-2.12.01/nasm.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/nasm.exe" + ) + +endif() + +message("Checking for mingwGet") +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip") + message("Downloading mingw-get") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip" "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip") +endif() + +# extract mingw_get +if((NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/mingw-get.exe") AND (EXISTS "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip")) + message("Extracting mingw-get") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf "${DOWNLOAD_DIR}/mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw64/ + ) +endif() + +if((EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/mingw-get.exe") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/make.exe")) + message("Installing MSYS") + execute_process( + COMMAND ${DOWNLOAD_DIR}/mingw/mingw64/bin/mingw-get install msys msys-patch + WORKING_DIRECTORY ${DOWNLOAD_DIR}/mingw/mingw64/bin/ + ) +endif() + +message("Checking for CoreUtils") +# download old core_utils for pr.exe (ffmpeg needs it to build) +if(NOT EXISTS "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2") + message("Downloading CoreUtils 5.97") + file(DOWNLOAD "https://nchc.dl.sourceforge.net/project/mingw/MSYS/Base/msys-core/_obsolete/coreutils-5.97-MSYS-1.0.11-2/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2" "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2") +endif() + +if((EXISTS "${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2") AND (NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/pr.exe")) + message("Installing pr from CoreUtils 5.97") + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/tmp_coreutils + WORKING_DIRECTORY ${DOWNLOAD_DIR} + ) + + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 + WORKING_DIRECTORY ${DOWNLOAD_DIR}/tmp_coreutils/ + ) + + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy ${DOWNLOAD_DIR}/tmp_coreutils/coreutils-5.97/bin/pr.exe "${DOWNLOAD_DIR}/mingw/mingw64/msys/1.0/bin/pr.exe" + WORKING_DIRECTORY ${DOWNLOAD_DIR}/tmp_coreutils/ + ) +endif() + +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/ming64sh.cmd") + message("Installing ming64sh.cmd") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/ming64sh.cmd ${DOWNLOAD_DIR}/mingw/mingw64/ming64sh.cmd + ) +endif() + +message("Checking for perl") +# download perl for libvpx +if(NOT EXISTS "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-64bit-portable.zip") + message("Downloading perl") + file(DOWNLOAD "http://strawberryperl.com/download/5.22.1.3/strawberry-perl-5.22.1.3-64bit-portable.zip" "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-64bit-portable.zip") +endif() + +# make perl root directory +if(NOT EXISTS "${DOWNLOAD_DIR}/perl") + execute_process( + COMMAND ${CMAKE_COMMAND} -E make_directory ${DOWNLOAD_DIR}/perl + WORKING_DIRECTORY ${DOWNLOAD_DIR} + ) +endif() + +# extract perl +if((NOT EXISTS "${DOWNLOAD_DIR}/perl/portable.perl") AND (EXISTS "${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-64bit-portable.zip")) + message("Extracting perl") + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar jxf ${DOWNLOAD_DIR}/strawberry-perl-5.22.1.3-64bit-portable.zip + WORKING_DIRECTORY ${DOWNLOAD_DIR}/perl + ) +endif() + +# get yasm for vpx +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/yasm.exe") + message("Downloading yasm") + file(DOWNLOAD "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/yasm.exe") +endif() + +message("checking x86_64-w64-mingw32-strings.exe") +# copy strings.exe to x86_64-w64-mingw32-strings.exe for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-strings.exe") + message("fixing x86_64-w64-mingw32-strings.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/strings.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-strings.exe" + ) +endif() + +message("checking x86_64-w64-mingw32-ar.exe") +# copy ar.exe to x86_64-w64-mingw32-ar.exe for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ar.exe") + message("fixing x86_64-w64-mingw32-ar.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/ar.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ar.exe" + ) +endif() + +message("checking x86_64-w64-mingw32-strip.exe") +# copy strip.exe to x86_64-w64-mingw32-strip.exe for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-strip.exe") + message("fixing x86_64-w64-mingw32-strip.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/strip.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-strip.exe" + ) +endif() + +message("checking x86_64-w64-mingw32-ranlib.exe") +# copy ranlib.exe to x86_64-w64-mingw32-ranlib.exe for x264 +if(NOT EXISTS "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe") + message("fixing x86_64-w64-mingw32-ranlib.exe") + execute_process( + COMMAND ${CMAKE_COMMAND} -E copy "${DOWNLOAD_DIR}/mingw/mingw64/bin/ranlib.exe" "${DOWNLOAD_DIR}/mingw/mingw64/bin/x86_64-w64-mingw32-ranlib.exe" + ) +endif() + diff --git a/build_files/build_environment/cmake/sndfile.cmake b/build_files/build_environment/cmake/sndfile.cmake new file mode 100644 index 00000000000..13368c05fbe --- /dev/null +++ b/build_files/build_environment/cmake/sndfile.cmake @@ -0,0 +1,44 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(SNDFILE_EXTRA_ARGS) +set(SNDFILE_ENV PKG_CONFIG_PATH=${mingw_LIBDIR}/ogg/lib/pkgconfig:${mingw_LIBDIR}/vorbis/lib/pkgconfig:${mingw_LIBDIR}/flac/lib/pkgconfig:${mingw_LIBDIR}) + +if(WIN32) + set(SNDFILE_ENV set ${SNDFILE_ENV} &&) +endif() + +ExternalProject_Add(external_sndfile + URL ${SNDFILE_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${SNDFILE_HASH} + PREFIX ${BUILD_DIR}/sndfile + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && ${SNDFILE_ENV} ${CONFIGURE_COMMAND} --enable-static --disable-shared --prefix=${mingw_LIBDIR}/sndfile + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/sndfile/src/external_sndfile/ && make install + INSTALL_DIR ${LIBDIR}/sndfile +) + +if(MSVC) + set_target_properties(external_sndfile PROPERTIES FOLDER Mingw) +endif() + +add_dependencies(external_sndfile external_ogg external_vorbis) +if(UNIX) + add_dependencies(external_sndfile external_flac) +endif() diff --git a/build_files/build_environment/cmake/spnav.cmake b/build_files/build_environment/cmake/spnav.cmake new file mode 100644 index 00000000000..0dec9799715 --- /dev/null +++ b/build_files/build_environment/cmake/spnav.cmake @@ -0,0 +1,28 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_spnav + URL ${SPNAV_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${SPNAV_HASH} + PREFIX ${BUILD_DIR}/spnav + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/spnav/src/external_spnav/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/spnav --disable-shared --enable-static --with-pic + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/spnav/src/external_spnav/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/spnav/src/external_spnav/ && make install + INSTALL_DIR ${LIBDIR}/spnav +) diff --git a/build_files/build_environment/cmake/tbb.cmake b/build_files/build_environment/cmake/tbb.cmake new file mode 100644 index 00000000000..c4055d55648 --- /dev/null +++ b/build_files/build_environment/cmake/tbb.cmake @@ -0,0 +1,36 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(TBB_EXTRA_ARGS + -DTBB_BUILD_SHARED=Off + -DTBB_BUILD_TBBMALLOC=Off + -DTBB_BUILD_TBBMALLOC_PROXY=Off + -DTBB_BUILD_STATIC=On +) + +# CMake script for TBB from https://github.com/wjakob/tbb/blob/master/CMakeLists.txt +ExternalProject_Add(external_tbb + URL ${TBB_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${TBB_HASH} + PREFIX ${BUILD_DIR}/tbb + PATCH_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${PATCH_DIR}/cmakelists_tbb.txt ${BUILD_DIR}/tbb/src/external_tbb/CMakeLists.txt && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/tbb/src/external_tbb/build/vs2010/version_string.ver ${BUILD_DIR}/tbb/src/external_tbb/src/tbb/version_string.ver + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/tbb ${DEFAULT_CMAKE_FLAGS} ${TBB_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/tbb +) diff --git a/build_files/build_environment/cmake/theora.cmake b/build_files/build_environment/cmake/theora.cmake new file mode 100644 index 00000000000..03aad42f2db --- /dev/null +++ b/build_files/build_environment/cmake/theora.cmake @@ -0,0 +1,40 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_theora + URL ${THEORA_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${THEORA_HASH} + PREFIX ${BUILD_DIR}/theora + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/theora + --disable-shared + --enable-static + --with-pic + --with-ogg=${LIBDIR}/ogg + --with-vorbis=${LIBDIR}/vorbis + --disable-examples + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/theora/src/external_theora/ && make install + INSTALL_DIR ${LIBDIR}/theora +) + +add_dependencies(external_theora external_vorbis external_ogg) + +if(MSVC) + set_target_properties(external_theora PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/tiff.cmake b/build_files/build_environment/cmake/tiff.cmake new file mode 100644 index 00000000000..2c01341eb21 --- /dev/null +++ b/build_files/build_environment/cmake/tiff.cmake @@ -0,0 +1,44 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(TIFF_EXTRA_ARGS + -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include + -DPNG_STATIC=ON + -DBUILD_SHARED_LIBS=OFF + -Dlzma=OFF + -Djbig=OFF +) + +ExternalProject_Add(external_tiff + URL ${TIFF_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${TIFF_HASH} + PREFIX ${BUILD_DIR}/tiff + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/tiff ${DEFAULT_CMAKE_FLAGS} ${TIFF_EXTRA_ARGS} + INSTALL_DIR ${LIBDIR}/tiff +) + +add_dependencies(external_tiff external_zlib) + +if(BUILD_MODE STREQUAL Debug) + ExternalProject_Add_Step(external_tiff after_install + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/tiff/lib/tiffd${LIBEXT} ${LIBDIR}/tiff/lib/tiff${LIBEXT} + DEPENDEES install + ) +endif() diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake new file mode 100644 index 00000000000..f9f9fdcface --- /dev/null +++ b/build_files/build_environment/cmake/versions.cmake @@ -0,0 +1,245 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(ZLIB_VERSION 1.2.8) +set(ZLIB_URI https://netcologne.dl.sourceforge.net/project/libpng/zlib/${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz) +set(ZLIB_HASH 44d667c142d7cda120332623eab69f40) + +set(OPENAL_VERSION 1.17.2) +set(OPENAL_URI http://kcat.strangesoft.net/openal-releases/openal-soft-${OPENAL_VERSION}.tar.bz2) +set(OPENAL_HASH 1764e0d8fec499589b47ebc724e0913d) + +set(PNG_VERSION 1.6.21) +set(PNG_URI http://prdownloads.sourceforge.net/libpng/libpng-${PNG_VERSION}.tar.gz) +set(PNG_HASH aca36ec8e0a3b406a5912243bc243717) + +set(JPEG_VERSION 1.4.2) +set(JPEG_URI https://github.com/libjpeg-turbo/libjpeg-turbo/archive/${JPEG_VERSION}.tar.gz) +set(JPEG_HASH f9804884c1c41eb7f4febb9353a2cb27) + +set(BOOST_VERSION 1.60.0) +set(BOOST_VERSION_NODOTS 1_60_0) +set(BOOST_URI http://sourceforge.net/projects/boost/files/boost/${BOOST_VERSION}/boost_${BOOST_VERSION_NODOTS}.tar.bz2/download) +set(BOOST_MD5 65a840e1a0b13a558ff19eeb2c4f0cbe) + +set(BLOSC_VERSION 1.7.1) +set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.zip) +set(BLOSC_HASH ff5cc729a5a25934ef714217218eed26) + +set(PTHREADS_VERSION 2-9-1) +set(PTHREADS_URI ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-${PTHREADS_VERSION}-release.tar.gz) +set(PTHREADS_SHA512 9c06e85310766834370c3dceb83faafd397da18a32411ca7645c8eb6b9495fea54ca2872f4a3e8d83cb5fdc5dea7f3f0464be5bb9af3222a6534574a184bd551) + +set(ILMBASE_VERSION 2.2.0) +set(ILMBASE_URI http://download.savannah.nongnu.org/releases/openexr/ilmbase-${ILMBASE_VERSION}.tar.gz) +set(ILMBASE_HASH b540db502c5fa42078249f43d18a4652) + +set(OPENEXR_VERSION 2.2.0) +set(OPENEXR_URI http://download.savannah.nongnu.org/releases/openexr/openexr-2.2.0.tar.gz) +set(OPENEXR_HASH b64e931c82aa3790329c21418373db4e) + +set(FREETYPE_VERSION 263) +set(FREETYPE_URI http://download.savannah.gnu.org/releases/freetype/ft${FREETYPE_VERSION}.zip) +set(FREETYPE_HASH 0db2a43301572e5c2b4a0864f237aeeb) + +set(GLEW_VERSION 1.13.0) +set(GLEW_URI http://prdownloads.sourceforge.net/glew/glew/${GLEW_VERSION}/glew-${GLEW_VERSION}.tgz) +set(GLEW_HASH 7cbada3166d2aadfc4169c4283701066) + +set(FREEGLUT_VERSION 3.0.0) +set(FREEGLUT_URI http://pilotfiber.dl.sourceforge.net/project/freeglut/freeglut/${FREEGLUT_VERSION}/freeglut-${FREEGLUT_VERSION}.tar.gz) +set(FREEGLUT_HASH 90c3ca4dd9d51cf32276bc5344ec9754) + +set(HDF5_VERSION 1.8.17) +set(HDF5_URI https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8/hdf5-${HDF5_VERSION}/src/hdf5-${HDF5_VERSION}.tar.gz) +set(HDF5_HASH 7d572f8f3b798a628b8245af0391a0ca) + +set(ALEMBIC_VERSION 1.7.1) +set(ALEMBIC_URI https://github.com/alembic/alembic/archive/${ALEMBIC_VERSION}.zip) +set(ALEMBIC_MD5 cf7705055501d5ea0cb8256866496f79) + +## hash is for 3.1.2 +set(GLFW_GIT_UID 30306e54705c3adae9fe082c816a3be71963485c) +set(GLFW_URI https://github.com/glfw/glfw/archive/${GLFW_GIT_UID}.zip) +set(GLFW_HASH 20cacb1613da7eeb092f3ac4f6b2b3d0) + +#latest uid in git as of 2016-04-01 +set(CLEW_GIT_UID 277db43f6cafe8b27c6f1055f69dc67da4aeb299) +set(CLEW_URI https://github.com/OpenCLWrangler/clew/archive/${CLEW_GIT_UID}.zip) +set(CLEW_HASH 2c699d10ed78362e71f56fae2a4c5f98) + +#latest uid in git as of 2016-04-01 +set(CUEW_GIT_UID 1744972026de9cf27c8a7dc39cf39cd83d5f922f) +set(CUEW_URI https://github.com/CudaWrangler/cuew/archive/${CUEW_GIT_UID}.zip) +set(CUEW_HASH 86760d62978ebfd96cd93f5aa1abaf4a) + +set(OPENSUBDIV_VERSION v3_1_1) +set(OPENSUBDIV_Hash 25a9a6a94136b0eb85ce69e9c8cb6ab3) +set(OPENSUBDIV_URI https://github.com/PixarAnimationStudios/OpenSubdiv/archive/${OPENSUBDIV_VERSION}.zip) + +set(SDL_VERSION 2.0.4) +set(SDL_URI https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz) +set(SDL_HASH 44fc4a023349933e7f5d7a582f7b886e) + +set(OPENCOLLADA_VERSION v1.6.51) +set(OPENCOLLADA_URI https://github.com/KhronosGroup/OpenCOLLADA/archive/${OPENCOLLADA_VERSION}.tar.gz) +set(OPENCOLLADA_HASH 23db5087faed4bc4cc1dfe456c0d4701) + +set(OPENCOLORIO_URI https://github.com/imageworks/OpenColorIO/archive/6de971097c7f552300f669ed69ca0b6cf5a70843.zip) +set(OPENCOLORIO_HASH c9de0fd98f26ce6f2e08d617ca68b8e4) + +set(LLVM_VERSION 3.4.2) +set(LLVM_URI http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.gz) +set(LLVM_HASH a20669f75967440de949ac3b1bad439c) + +set(CLANG_URI http://llvm.org/releases/${LLVM_VERSION}/cfe-${LLVM_VERSION}.src.tar.gz) +set(CLANG_HASH 87945973b7c73038871c5f849a818588) + +set(OPENIMAGEIO_VERSION 1.7.15) +set(OPENIMAGEIO_URI https://github.com/OpenImageIO/oiio/archive/Release-${OPENIMAGEIO_VERSION}.zip) +set(OPENIMAGEIO_HASH_178 e156e3669af0e1373142ab5e8f13de66) +set(OPENIMAGEIO_HASH_179 4121cb0e0433bda6a7ef32c8628a149f) +set(OPENIMAGEIO_HASH_1713 42a662775b834161ba88c6abdb299360) +set(OPENIMAGEIO_HASH_1715 e2ece0f62c013d64c478f82265988b0b) +set(OPENIMAGEIO_HASH ${OPENIMAGEIO_HASH_1715}) + + +set(TIFF_VERSION 4.0.6) +set(TIFF_URI http://download.osgeo.org/libtiff/tiff-${TIFF_VERSION}.tar.gz) +set(TIFF_HASH d1d2e940dea0b5ad435f21f03d96dd72) + +set(FLEXBISON_VERSION 2.5.5) +set(FLEXBISON_URI http://prdownloads.sourceforge.net/winflexbison//win_flex_bison-2.5.5.zip) +set(FLEXBISON_HASH d87a3938194520d904013abef3df10ce) + +set(OSL_VERSION 1.7.5) +set(OSL_URI https://github.com/imageworks/OpenShadingLanguage/archive/Release-${OSL_VERSION}.zip) +set(OSL_HASH 6924dd5d453159e7b6eb106a08c358cf) + +set(PYTHON_VERSION 3.5.3) +set(PYTHON_SHORT_VERSION 3.5) +set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz) +set(PYTHON_HASH 57d1f8bfbabf4f2500273fb0706e6f21) + +set(TBB_VERSION 44_20160128) +set(TBB_URI https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb${TBB_VERSION}oss_src_0.tgz) +set(TBB_HASH 9d8a4cdf43496f1b3f7c473a5248e5cc) + +set(OPENVDB_VERSION 3.1.0) +set(OPENVDB_URI https://github.com/dreamworksanimation/openvdb/archive/v${OPENVDB_VERSION}.tar.gz) +set(OPENVDB_HASH 30a7e9571a03ab7bcf1a39fb62aa436f) + +set(REQUESTS_VERSION v2.10.0) +set(REQUESTS_URI https://github.com/kennethreitz/requests/archive/${REQUESTS_VERSION}.zip) +set(REQUESTS_HASH 6ebefdf0210c7f0933f61501334e46c3) + +set(NUMPY_VERSION v1.10.1) +set(NUMPY_SHORT_VERSION 1.10) +set(NUMPY_URI https://pypi.python.org/packages/a5/2e/5412784108f5dc0f827fb460ccdeaa9d76286979fe5ddd070d526d168a59/numpy-1.10.1.zip) +set(NUMPY_HASH 6f57c58bc5b28440fbeccd505da63d58) + +set(LAME_VERSION 3.99.5) +set(LAME_URI http://downloads.sourceforge.net/project/lame/lame/3.99/lame-${LAME_VERSION}.tar.gz) +set(LAME_HASH 84835b313d4a8b68f5349816d33e07ce) + +set(OGG_VERSION 1.3.2) +set(OGG_URI http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz) +set(OGG_HASH e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692) + +set(VORBIS_VERSION 1.3.5) +set(VORBIS_URI http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz) +set(VORBIS_HASH 6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce) + +set(THEORA_VERSION 1.1.1) +set(THEORA_URI http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.bz2) +set(THEORA_HASH b6ae1ee2fa3d42ac489287d3ec34c5885730b1296f0801ae577a35193d3affbc) + +set(FLAC_VERSION 1.3.1) +set(FLAC_URI http://downloads.xiph.org/releases/flac/flac-${FLAC_VERSION}.tar.xz) +set(FLAC_HASH 4773c0099dba767d963fd92143263be338c48702172e8754b9bc5103efe1c56c) + +set(VPX_VERSION 1.5.0) +set(VPX_URI http://storage.googleapis.com/downloads.webmproject.org/releases/webm/libvpx-${VPX_VERSION}.tar.bz2) +set(VPX_HASH 306d67908625675f8e188d37a81fbfafdf5068b09d9aa52702b6fbe601c76797) + +set(ORC_VERSION 0.4.25) +set(ORC_URI https://gstreamer.freedesktop.org/src/orc/orc-${ORC_VERSION}.tar.xz) +set(ORC_HASH c1b1d54a58f26d483f0b3881538984789fe5d5460ab8fab74a1cacbd3d1c53d1) + +set(SCHROEDINGER_VERSION 1.0.11) +set(SCHROEDINGER_URI https://download.videolan.org/contrib/schroedinger/schroedinger-${SCHROEDINGER_VERSION}.tar.gz) +set(SCHROEDINGER_HASH 1e572a0735b92aca5746c4528f9bebd35aa0ccf8619b22fa2756137a8cc9f912) + +set(X264_URI http://download.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20160401-2245-stable.tar.bz2) +set(X264_HASH 1e9a7b835e80313aade53a9b6ff353e099de3856bf5f30a4d8dfc91281f786f5) + +set(XVIDCORE_VERSION 1.3.4) +set(XVIDCORE_URI http://downloads.xvid.org/downloads/xvidcore-${XVIDCORE_VERSION}.tar.gz) +set(XVIDCORE_HASH 4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f) + +set(OPENJPEG_VERSION 1.5) +set(OPENJPEG_URI https://github.com/uclouvain/openjpeg/archive/version.${OPENJPEG_VERSION}.tar.gz) +set(OPENJPEG_HASH 60662566595e02104c0f6d1052f8b1669624c646e62b6280d5fd5a66d4e92f8d) + +set(FAAD_VERSION 2-2.7) +set(FAAD_URI http://downloads.sourceforge.net/faac/faad${FAAD_VERSION}.tar.bz2) +set(FAAD_HASH 4c332fa23febc0e4648064685a3d4332) + +set(FFMPEG_VERSION 3.2.1) +set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2) +set(FFMPEG_HASH cede174178e61f882844f5870c35ce72) + +set(FFTW_VERSION 3.3.4) +set(FFTW_URI http://www.fftw.org/fftw-${FFTW_VERSION}.tar.gz) +set(FFTW_HASH 2edab8c06b24feeb3b82bbb3ebf3e7b3) + +set(ICONV_VERSION 1.14) +set(ICONV_URI http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz) +set(ICONV_HASH e34509b1623cec449dfeb73d7ce9c6c6) + +set(LAPACK_VERSION 3.6.0) +set(LAPACK_URI http://www.netlib.org/lapack/lapack-${LAPACK_VERSION}.tgz) +set(LAPACK_HASH f2f6c67134e851fe189bb3ca1fbb5101) + +set(SNDFILE_VERSION 1.0.26) +set(SNDFILE_URI http://www.mega-nerd.com/libsndfile/files/libsndfile-${SNDFILE_VERSION}.tar.gz) +set(SNDFILE_HASH ec810a0c60c08772a8a5552704b63393) + +#set(HIDAPI_VERSION 0.8.0-rc1) +#set(HIDAPI_URI https://github.com/signal11/hidapi/archive/hidapi-${HIDAPI_VERSION}.tar.gz) +#set(HIDAPI_HASH 069f9dd746edc37b6b6d0e3656f47199) + +set(HIDAPI_UID 89a6c75dc6f45ecabd4ddfbd2bf5ba6ad8ba38b5) +set(HIDAPI_URI https://github.com/TheOnlyJoey/hidapi/archive/${HIDAPI_UID}.zip) +set(HIDAPI_HASH b6e22f6b514f8bcf594989f20ffc46fb) + +set(WEBP_VERSION 0.5.1) +set(WEBP_URI https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-${WEBP_VERSION}.tar.gz) +set(WEBP_HASH 3d7db92ebba5b4f679413d25c6040881) + +set(SPNAV_VERSION 0.2.3) +set(SPNAV_URI http://downloads.sourceforge.net/project/spacenav/spacenav%20library%20%28SDK%29/libspnav%20${SPNAV_VERSION}/libspnav-${SPNAV_VERSION}.tar.gz) +set(SPNAV_HASH 44d840540d53326d4a119c0f1aa7bf0a) + +set(JEMALLOC_VERSION 5.0.1) +set(JEMALLOC_URI https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2) +set(JEMALLOC_HASH 507f7b6b882d868730d644510491d18f) + +set(XML2_VERSION 2.9.4) +set(XML2_URI ftp://xmlsoft.org/libxml2/libxml2-${XML2_VERSION}.tar.gz) +set(XML2_HASH ae249165c173b1ff386ee8ad676815f5) diff --git a/build_files/build_environment/cmake/vorbis.cmake b/build_files/build_environment/cmake/vorbis.cmake new file mode 100644 index 00000000000..d16c7c6a1bc --- /dev/null +++ b/build_files/build_environment/cmake/vorbis.cmake @@ -0,0 +1,38 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_vorbis + URL ${VORBIS_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${VORBIS_HASH} + PREFIX ${BUILD_DIR}/vorbis + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vorbis/src/external_vorbis/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/vorbis + --disable-shared + --enable-static + --with-pic + --with-ogg=${LIBDIR}/ogg + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vorbis/src/external_vorbis/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vorbis/src/external_vorbis/ && make install + INSTALL_DIR ${LIBDIR}/vorbis +) + +add_dependencies(external_vorbis external_ogg) + +if(MSVC) + set_target_properties(external_vorbis PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/vpx.cmake b/build_files/build_environment/cmake/vpx.cmake new file mode 100644 index 00000000000..6569708cb5f --- /dev/null +++ b/build_files/build_environment/cmake/vpx.cmake @@ -0,0 +1,56 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(VPX_EXTRA_FLAGS --target=x86_64-win64-gcc) + else() + set(VPX_EXTRA_FLAGS --target=x86-win32-gcc) + endif() +else() + set(VPX_EXTRA_FLAGS --target=generic-gnu) +endif() + +ExternalProject_Add(external_vpx + URL ${VPX_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${VPX_HASH} + PREFIX ${BUILD_DIR}/vpx + CONFIGURE_COMMAND ${CONFIGURE_ENV} && + cd ${BUILD_DIR}/vpx/src/external_vpx/ && + ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/vpx + --disable-shared + --enable-static + --disable-install-bins + --disable-install-srcs + --disable-sse4_1 + --disable-sse3 + --disable-ssse3 + --disable-avx + --disable-avx2 + --disable-unit-tests + --disable-examples + ${VPX_EXTRA_FLAGS} + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/vpx/src/external_vpx/ && make install + INSTALL_DIR ${LIBDIR}/vpx +) + +if(MSVC) + set_target_properties(external_vpx PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/webp.cmake b/build_files/build_environment/cmake/webp.cmake new file mode 100644 index 00000000000..0504988a088 --- /dev/null +++ b/build_files/build_environment/cmake/webp.cmake @@ -0,0 +1,50 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +# Note the utility apps may use png/tiff/gif system libraries, but the +# library itself does not depend on them, so should give no problems. + +set(WEBP_EXTRA_ARGS + -DWEBP_HAVE_SSE2=ON + -DWEBP_HAVE_SSE41=OFF + -DWEBP_HAVE_AVX2=OFF +) + +if(WIN32) + set(WEBP_BUILD_DIR ${BUILD_MODE}/) +else() + set(WEBP_BUILD_DIR) +endif() + +ExternalProject_Add(external_webp + URL ${WEBP_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${WEBP_HASH} + PREFIX ${BUILD_DIR}/webp + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/webp -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${WEBP_EXTRA_ARGS} + INSTALL_COMMAND COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp-build/${WEBP_BUILD_DIR}${LIBPREFIX}webp${LIBEXT} ${LIBDIR}/webp/lib/${LIBPREFIX}webp${LIBEXT} && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/decode.h ${LIBDIR}/webp/include/webp/decode.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/encode.h ${LIBDIR}/webp/include/webp/encode.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/demux.h ${LIBDIR}/webp/include/webp/demux.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/extras.h ${LIBDIR}/webp/include/webp/extras.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/format_constants.h ${LIBDIR}/webp/include/webp/format_constants.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/mux.h ${LIBDIR}/webp/include/webp/mux.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/mux_types.h ${LIBDIR}/webp/include/webp/mux_types.h && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/webp/src/external_webp/src/webp/types.h ${LIBDIR}/webp/include/webp/types.h + INSTALL_DIR ${LIBDIR}/webp +) diff --git a/build_files/build_environment/cmake/x264.cmake b/build_files/build_environment/cmake/x264.cmake new file mode 100644 index 00000000000..64029ca1b5e --- /dev/null +++ b/build_files/build_environment/cmake/x264.cmake @@ -0,0 +1,40 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(X264_EXTRA_ARGS --enable-win32thread --cross-prefix=${MINGW_HOST}- --host=${MINGW_HOST}) +endif() + +ExternalProject_Add(external_x264 + URL ${X264_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${X264_HASH} + PREFIX ${BUILD_DIR}/x264 + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264 + --enable-static + --enable-pic + --disable-lavf + ${X264_EXTRA_ARGS} + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && make install + INSTALL_DIR ${LIBDIR}/x264 +) + +if(MSVC) + set_target_properties(external_x264 PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/xml2.cmake b/build_files/build_environment/cmake/xml2.cmake new file mode 100644 index 00000000000..a8f87a67ad4 --- /dev/null +++ b/build_files/build_environment/cmake/xml2.cmake @@ -0,0 +1,36 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_xml2 + URL ${XML2_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH MD5=${XML2_HASH} + PREFIX ${BUILD_DIR}/xml2 + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && ${CONFIGURE_COMMAND} + --prefix=${LIBDIR}/xml2 + --disable-shared + --enable-static + --with-pic + --with-python=no + --with-lzma=no + --with-zlib=no + --with-iconv=no + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xml2/src/external_xml2/ && make install + INSTALL_DIR ${LIBDIR}/xml2 +) diff --git a/build_files/build_environment/cmake/xvidcore.cmake b/build_files/build_environment/cmake/xvidcore.cmake new file mode 100644 index 00000000000..a341275ea47 --- /dev/null +++ b/build_files/build_environment/cmake/xvidcore.cmake @@ -0,0 +1,44 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +if(WIN32) + set(XVIDCORE_EXTRA_ARGS --host=${MINGW_HOST}) +endif() + +ExternalProject_Add(external_xvidcore + URL ${XVIDCORE_URI} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + URL_HASH SHA256=${XVIDCORE_HASH} + PREFIX ${BUILD_DIR}/xvidcore + CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xvidcore/src/external_xvidcore/build/generic && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/xvidcore ${XVIDCORE_EXTRA_ARGS} + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/xvidcore/src/external_xvidcore/build/generic && make -j${MAKE_THREADS} + INSTALL_COMMAND ${CONFIGURE_ENV} && + ${CMAKE_COMMAND} -E remove ${LIBDIR}/xvidcore/lib/* && # clean because re-installing fails otherwise + cd ${BUILD_DIR}/xvidcore/src/external_xvidcore/build/generic && make install + INSTALL_DIR ${LIBDIR}/xvidcore +) + +ExternalProject_Add_Step(external_xvidcore after_install + COMMAND ${CMAKE_COMMAND} -E rename ${LIBDIR}/xvidcore/lib/xvidcore.a ${LIBDIR}/xvidcore/lib/libxvidcore.a || true + COMMAND ${CMAKE_COMMAND} -E remove ${LIBDIR}/xvidcore/lib/xvidcore.dll.a + DEPENDEES install +) + +if(MSVC) + set_target_properties(external_xvidcore PROPERTIES FOLDER Mingw) +endif() diff --git a/build_files/build_environment/cmake/zlib.cmake b/build_files/build_environment/cmake/zlib.cmake new file mode 100644 index 00000000000..3307cb1f167 --- /dev/null +++ b/build_files/build_environment/cmake/zlib.cmake @@ -0,0 +1,33 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_zlib + URL ${ZLIB_URI} + URL_HASH MD5=${ZLIB_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PREFIX ${BUILD_DIR}/zlib + CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zlib ${DEFAULT_CMAKE_FLAGS} + INSTALL_DIR ${LIBDIR}/zlib +) + +if(BUILD_MODE STREQUAL Debug) + ExternalProject_Add_Step(external_zlib after_install + COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zlib/lib/zlibstaticd${LIBEXT} ${LIBDIR}/zlib/lib/${ZLIB_LIBRARY} + DEPENDEES install + ) +endif() diff --git a/build_files/build_environment/cmake/zlib_mingw.cmake b/build_files/build_environment/cmake/zlib_mingw.cmake new file mode 100644 index 00000000000..13345f29ffa --- /dev/null +++ b/build_files/build_environment/cmake/zlib_mingw.cmake @@ -0,0 +1,40 @@ +# ***** 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. +# +# ***** END GPL LICENSE BLOCK ***** + +ExternalProject_Add(external_zlib_mingw + URL ${ZLIB_URI} + URL_HASH MD5=${ZLIB_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PREFIX ${BUILD_DIR}/zlib_mingw + CONFIGURE_COMMAND echo . + BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/zlib_mingw/src/external_zlib_mingw/ && make -f win32/makefile.gcc -j${MAKE_THREADS} + INSTALL_COMMAND echo . + INSTALL_DIR ${LIBDIR}/zlib_mingw +) + +if(BUILD_MODE STREQUAL Release) + ExternalProject_Add_Step(external_zlib_mingw after_install + COMMAND ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/zlib_mingw/src/external_zlib_mingw/libz.a ${LIBDIR}/zlib/lib/z.lib + DEPENDEES install + ) +endif() + +if(MSVC) + set_target_properties(external_zlib_mingw PROPERTIES FOLDER Mingw) +endif() + diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index 3852b4fe705..b2aa6978a47 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -1774,7 +1774,7 @@ compile_LLVM() { cd $_src # XXX Ugly patching hack! - patch -p1 -i "$SCRIPT_DIR/install_deps_patches/llvm.patch" + patch -p1 -i "$SCRIPT_DIR/patches/install_deps_llvm.patch" cd $CWD @@ -1880,7 +1880,7 @@ compile_OSL() { git reset --hard # XXX Ugly patching hack! - patch -p1 -i "$SCRIPT_DIR/install_deps_patches/osl.patch" + patch -p1 -i "$SCRIPT_DIR/patches/install_deps_osl.patch" fi # Always refresh the whole build! diff --git a/build_files/build_environment/patches/alembic.diff b/build_files/build_environment/patches/alembic.diff new file mode 100644 index 00000000000..f869858efb2 --- /dev/null +++ b/build_files/build_environment/patches/alembic.diff @@ -0,0 +1,35 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3e09c57..26565ae 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -116,7 +116,7 @@ IF (NOT ${ALEMBIC_LIB_USES_TR1} AND NOT ${ALEMBIC_LIB_USES_BOOST}) + INCLUDE(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) + CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +- IF (COMPILER_SUPPORTS_CXX1X) ++ IF (COMPILER_SUPPORTS_CXX11) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + ELSEIF (COMPILER_SUPPORTS_CXX0X) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +--- a/lib/Alembic/AbcCoreOgawa/StreamManager.cpp ++++ b/lib/Alembic/AbcCoreOgawa/StreamManager.cpp +@@ -47,7 +47,18 @@ + #define COMPARE_EXCHANGE( V, COMP, EXCH ) V.compare_exchange_weak( COMP, EXCH, std::memory_order_seq_cst, std::memory_order_seq_cst ) + // Windows + #elif defined( _MSC_VER ) +-#define COMPARE_EXCHANGE( V, COMP, EXCH ) InterlockedCompareExhange64( &V, EXCH, COMP ) == COMP ++#define COMPARE_EXCHANGE( V, COMP, EXCH ) InterlockedCompareExchange64( &V, EXCH, COMP ) == COMP ++int ffsll(long long value) ++{ ++ if (!value) ++ return 0; ++ ++ for (int bit = 0; bit < 63; bit++) ++ { ++ if (value & (1 << bit)) ++ return bit + 1; ++ } ++} + // gcc 4.8 and above not using C++11 + #elif defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8 + #define COMPARE_EXCHANGE( V, COMP, EXCH ) __atomic_compare_exchange_n( &V, &COMP, EXCH, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST ) diff --git a/build_files/build_environment/patches/blosc.diff b/build_files/build_environment/patches/blosc.diff new file mode 100644 index 00000000000..3bd6ef28144 --- /dev/null +++ b/build_files/build_environment/patches/blosc.diff @@ -0,0 +1,33 @@ +diff -Naur src/blosc/CMakeLists.txt external_blosc/blosc/CMakeLists.txt +--- src/blosc/CMakeLists.txt 2016-02-03 10:26:28 -0700 ++++ external_blosc/blosc/CMakeLists.txt 2017-03-03 09:03:31 -0700 +@@ -61,6 +61,8 @@ + set(SOURCES ${SOURCES} win32/pthread.c) + else(NOT Threads_FOUND) + set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++ set(LIBS ${LIBS} ${PTHREAD_LIBS}) ++ include_directories( ${PTHREAD_INCLUDE_DIR} ) + endif(NOT Threads_FOUND) + else(WIN32) + find_package(Threads REQUIRED) +diff -Naur src/blosc/blosc.c external_blosc/blosc/blosc.c +--- src/blosc/blosc.c 2016-02-03 10:26:28 -0700 ++++ external_blosc/blosc/blosc.c 2017-03-03 09:01:50 -0700 +@@ -49,12 +49,12 @@ + #include + #endif /* _WIN32 */ + +-#if defined(_WIN32) && !defined(__GNUC__) +- #include "win32/pthread.h" +- #include "win32/pthread.c" +-#else ++//#if defined(_WIN32) && !defined(__GNUC__) ++// #include "win32/pthread.h" ++ //#include "win32/pthread.c" ++//#else + #include +-#endif ++//#endif + + /* If C11 is supported, use it's built-in aligned allocation. */ + #if __STDC_VERSION__ >= 201112L diff --git a/build_files/build_environment/patches/clang.diff b/build_files/build_environment/patches/clang.diff new file mode 100644 index 00000000000..724e92f8163 --- /dev/null +++ b/build_files/build_environment/patches/clang.diff @@ -0,0 +1,127 @@ +--- cfe/trunk/lib/Serialization/ASTWriter.cpp ++++ cfe/trunk/lib/Serialization/ASTWriter.cpp +@@ -56,14 +56,14 @@ + using namespace clang::serialization; + + template +-static StringRef bytes(const std::vector &v) { ++static StringRef data(const std::vector &v) { + if (v.empty()) return StringRef(); + return StringRef(reinterpret_cast(&v[0]), + sizeof(T) * v.size()); + } + + template +-static StringRef bytes(const SmallVectorImpl &v) { ++static StringRef data(const SmallVectorImpl &v) { + return StringRef(reinterpret_cast(v.data()), + sizeof(T) * v.size()); + } +@@ -1385,7 +1385,7 @@ + Record.push_back(INPUT_FILE_OFFSETS); + Record.push_back(InputFileOffsets.size()); + Record.push_back(UserFilesNum); +- Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, bytes(InputFileOffsets)); ++ Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, data(InputFileOffsets)); + } + + //===----------------------------------------------------------------------===// +@@ -1771,7 +1771,7 @@ + Record.push_back(SOURCE_LOCATION_OFFSETS); + Record.push_back(SLocEntryOffsets.size()); + Record.push_back(SourceMgr.getNextLocalOffset() - 1); // skip dummy +- Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, bytes(SLocEntryOffsets)); ++ Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, data(SLocEntryOffsets)); + + // Write the source location entry preloads array, telling the AST + // reader which source locations entries it should load eagerly. +@@ -2087,7 +2087,7 @@ + Record.push_back(MacroOffsets.size()); + Record.push_back(FirstMacroID - NUM_PREDEF_MACRO_IDS); + Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record, +- bytes(MacroOffsets)); ++ data(MacroOffsets)); + } + + void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) { +@@ -2185,7 +2185,7 @@ + Record.push_back(PPD_ENTITIES_OFFSETS); + Record.push_back(FirstPreprocessorEntityID - NUM_PREDEF_PP_ENTITY_IDS); + Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record, +- bytes(PreprocessedEntityOffsets)); ++ data(PreprocessedEntityOffsets)); + } + } + +@@ -2548,7 +2548,7 @@ + Record.push_back(CXX_BASE_SPECIFIER_OFFSETS); + Record.push_back(CXXBaseSpecifiersOffsets.size()); + Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record, +- bytes(CXXBaseSpecifiersOffsets)); ++ data(CXXBaseSpecifiersOffsets)); + } + + //===----------------------------------------------------------------------===// +@@ -2623,7 +2623,7 @@ + Decls.push_back(std::make_pair((*D)->getKind(), GetDeclRef(*D))); + + ++NumLexicalDeclContexts; +- Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record, bytes(Decls)); ++ Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record, data(Decls)); + return Offset; + } + +@@ -2642,7 +2642,7 @@ + Record.push_back(TYPE_OFFSET); + Record.push_back(TypeOffsets.size()); + Record.push_back(FirstTypeID - NUM_PREDEF_TYPE_IDS); +- Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets)); ++ Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, data(TypeOffsets)); + + // Write the declaration offsets array + Abbrev = new BitCodeAbbrev(); +@@ -2655,7 +2655,7 @@ + Record.push_back(DECL_OFFSET); + Record.push_back(DeclOffsets.size()); + Record.push_back(FirstDeclID - NUM_PREDEF_DECL_IDS); +- Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets)); ++ Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, data(DeclOffsets)); + } + + void ASTWriter::WriteFileDeclIDsMap() { +@@ -2680,7 +2680,7 @@ + unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev); + Record.push_back(FILE_SORTED_DECLS); + Record.push_back(FileSortedIDs.size()); +- Stream.EmitRecordWithBlob(AbbrevCode, Record, bytes(FileSortedIDs)); ++ Stream.EmitRecordWithBlob(AbbrevCode, Record, data(FileSortedIDs)); + } + + void ASTWriter::WriteComments() { +@@ -2893,7 +2893,7 @@ + Record.push_back(SelectorOffsets.size()); + Record.push_back(FirstSelectorID - NUM_PREDEF_SELECTOR_IDS); + Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record, +- bytes(SelectorOffsets)); ++ data(SelectorOffsets)); + } + } + +@@ -3253,7 +3253,7 @@ + Record.push_back(IdentifierOffsets.size()); + Record.push_back(FirstIdentID - NUM_PREDEF_IDENT_IDS); + Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record, +- bytes(IdentifierOffsets)); ++ data(IdentifierOffsets)); + } + + //===----------------------------------------------------------------------===// +@@ -4046,7 +4046,7 @@ + Record.clear(); + Record.push_back(TU_UPDATE_LEXICAL); + Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record, +- bytes(NewGlobalDecls)); ++ data(NewGlobalDecls)); + + // And a visible updates block for the translation unit. + Abv = new llvm::BitCodeAbbrev(); diff --git a/build_files/build_environment/patches/cmake/modules/FindBlosc.cmake b/build_files/build_environment/patches/cmake/modules/FindBlosc.cmake new file mode 100644 index 00000000000..d490b7a2ff3 --- /dev/null +++ b/build_files/build_environment/patches/cmake/modules/FindBlosc.cmake @@ -0,0 +1,73 @@ +# - Find BLOSC library +# Find the native BLOSC includes and library +# This module defines +# BLOSC_INCLUDE_DIRS, where to find blosc.h, Set when +# BLOSC is found. +# BLOSC_LIBRARIES, libraries to link against to use BLOSC. +# BLOSC_ROOT_DIR, The base directory to search for BLOSC. +# This can also be an environment variable. +# BLOSC_FOUND, If false, do not try to use BLOSC. +# +# also defined, but not for general use are +# BLOSC_LIBRARY, where to find the BLOSC library. + +#============================================================================= +# Copyright 2016 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If BLOSC_ROOT_DIR was defined in the environment, use it. +IF(NOT BLOSC_ROOT_DIR AND NOT $ENV{BLOSC_ROOT_DIR} STREQUAL "") + SET(BLOSC_ROOT_DIR $ENV{BLOSC_ROOT_DIR}) +ENDIF() + +SET(_blosc_SEARCH_DIRS + ${BLOSC_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt/lib/blosc +) + +FIND_PATH(BLOSC_INCLUDE_DIR + NAMES + blosc.h + HINTS + ${_blosc_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(BLOSC_LIBRARY + NAMES + blosc + HINTS + ${_blosc_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib +) + +# handle the QUIETLY and REQUIRED arguments and set BLOSC_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(BLOSC DEFAULT_MSG + BLOSC_LIBRARY BLOSC_INCLUDE_DIR) + +IF(BLOSC_FOUND) + SET(BLOSC_LIBRARIES ${BLOSC_LIBRARY}) + SET(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIR}) +ELSE() + SET(BLOSC_FOUND FALSE) +ENDIF() + +MARK_AS_ADVANCED( + BLOSC_INCLUDE_DIR + BLOSC_LIBRARY +) diff --git a/build_files/build_environment/patches/cmake/modules/FindCppUnit.cmake b/build_files/build_environment/patches/cmake/modules/FindCppUnit.cmake new file mode 100644 index 00000000000..3dd480356af --- /dev/null +++ b/build_files/build_environment/patches/cmake/modules/FindCppUnit.cmake @@ -0,0 +1,73 @@ +# - Find CPPUNIT library +# Find the native CPPUNIT includes and library +# This module defines +# CPPUNIT_INCLUDE_DIRS, where to find cppunit.h, Set when +# CPPUNIT is found. +# CPPUNIT_LIBRARIES, libraries to link against to use CPPUNIT. +# CPPUNIT_ROOT_DIR, The base directory to search for CPPUNIT. +# This can also be an environment variable. +# CPPUNIT_FOUND, If false, do not try to use CPPUNIT. +# +# also defined, but not for general use are +# CPPUNIT_LIBRARY, where to find the CPPUNIT library. + +#============================================================================= +# Copyright 2016 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If CPPUNIT_ROOT_DIR was defined in the environment, use it. +IF(NOT CPPUNIT_ROOT_DIR AND NOT $ENV{CPPUNIT_ROOT_DIR} STREQUAL "") + SET(CPPUNIT_ROOT_DIR $ENV{CPPUNIT_ROOT_DIR}) +ENDIF() + +SET(_cppunit_SEARCH_DIRS + ${CPPUNIT_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt/lib/cppunit +) + +FIND_PATH(CPPUNIT_INCLUDE_DIR + NAMES + cppunit/Test.h + HINTS + ${_cppunit_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(CPPUNIT_LIBRARY + NAMES + cppunit + HINTS + ${_cppunit_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib +) + +# handle the QUIETLY and REQUIRED arguments and set CPPUNIT_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG + CPPUNIT_LIBRARY CPPUNIT_INCLUDE_DIR) + +IF(CPPUNIT_FOUND) + SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY}) + SET(CPPUNIT_INCLUDE_DIRS ${CPPUNIT_INCLUDE_DIR}) +ELSE() + SET(CPPUNIT_FOUND FALSE) +ENDIF() + +MARK_AS_ADVANCED( + CPPUNIT_INCLUDE_DIR + CPPUNIT_LIBRARY +) diff --git a/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake new file mode 100644 index 00000000000..f1a45228128 --- /dev/null +++ b/build_files/build_environment/patches/cmake/modules/FindIlmBase.cmake @@ -0,0 +1,260 @@ +# Module to find IlmBase +# +# This module will first look into the directories defined by the variables: +# - ILMBASE_HOME, ILMBASE_VERSION, ILMBASE_LIB_AREA +# +# It also supports non-standard names for the library components. +# +# To use a custom IlmBase: +# - Set the variable ILMBASE_CUSTOM to True +# - Set the variable ILMBASE_CUSTOM_LIBRARIES to a list of the libraries to +# use, e.g. "SpiImath SpiHalf SpiIlmThread SpiIex" +# - Optionally set the variable ILMBASE_CUSTOM_INCLUDE_DIR to any +# particularly weird place that the OpenEXR/*.h files may be found +# - Optionally set the variable ILMBASE_CUSTOM_LIB_DIR to any +# particularly weird place that the libraries files may be found +# +# This module defines the following variables: +# +# ILMBASE_INCLUDE_DIR - where to find half.h, IlmBaseConfig.h, etc. +# ILMBASE_LIBRARIES - list of libraries to link against when using IlmBase. +# ILMBASE_FOUND - True if IlmBase was found. + +# Other standarnd issue macros +include (FindPackageHandleStandardArgs) +include (FindPackageMessage) +include (SelectLibraryConfigurations) + + +if( ILMBASE_USE_STATIC_LIBS ) + set( _ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() +endif() + +# Macro to assemble a helper state variable +macro (SET_STATE_VAR varname) + set (tmp_ilmbaselibs ${ILMBASE_CUSTOM_LIBRARIES}) + separate_arguments (tmp_ilmbaselibs) + set (tmp_lst + ${ILMBASE_CUSTOM} | ${tmp_ilmbaselibs} | + ${ILMBASE_HOME} | ${ILMBASE_VERSION} | ${ILMBASE_LIB_AREA} + ) + set (${varname} "${tmp_lst}") + unset (tmp_ilmbaselibs) + unset (tmp_lst) +endmacro () + +# To enforce that find_* functions do not use inadvertently existing versions +if (ILMBASE_CUSTOM) + set (ILMBASE_FIND_OPTIONS "NO_DEFAULT_PATH") +endif () + +# Macro to search for an include directory +macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var) + string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname) + find_path(${tmp_varname} ${includefile} + HINTS ${${libpath_var}} + PATH_SUFFIXES include + ${ILMBASE_FIND_OPTIONS} + ) + if (${tmp_varname}) + mark_as_advanced (${tmp_varname}) + endif () + unset (tmp_varname) +endmacro () + + +# Macro to search for the given library and adds the cached +# variable names to the specified list +macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) + string (TOUPPER ${prefix}_${libname} tmp_prefix) + # Handle new library names for OpenEXR 2.1 build via cmake + string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION}) + string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION ) + + find_library(${tmp_prefix}_LIBRARY_RELEASE + NAMES ${libname} ${libname}-${_ILMBASE_VERSION} + HINTS ${${libpath_var}} + PATH_SUFFIXES lib + ${ILMBASE_FIND_OPTIONS} + ) + find_library(${tmp_prefix}_LIBRARY_DEBUG + NAMES ${libname}d ${libname}_d ${libname}debug ${libname}_debug + HINTS ${${libpath_var}} + PATH_SUFFIXES lib + ${ILMBASE_FIND_OPTIONS} + ) + # Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES + select_library_configurations (${tmp_prefix}) + list (APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES) + + # Add to the list of variables which should be reset + list (APPEND ${cachelist_var} + ${tmp_prefix}_LIBRARY + ${tmp_prefix}_LIBRARY_RELEASE + ${tmp_prefix}_LIBRARY_DEBUG) + mark_as_advanced ( + ${tmp_prefix}_LIBRARY + ${tmp_prefix}_LIBRARY_RELEASE + ${tmp_prefix}_LIBRARY_DEBUG) + unset (tmp_prefix) +endmacro () + + +# Encode the current state of the external variables into a string +SET_STATE_VAR (ILMBASE_CURRENT_STATE) + +# If the state has changed, clear the cached variables +if (ILMBASE_CACHED_STATE AND + NOT ILMBASE_CACHED_STATE STREQUAL ILMBASE_CURRENT_STATE) + + foreach (libvar ${ILMBASE_CACHED_VARS}) + unset (${libvar} CACHE) + endforeach () +endif () + + +# Generic search paths +set (IlmBase_generic_include_paths + ${ILMBASE_CUSTOM_INCLUDE_DIR} + /usr/include + /usr/include/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/local/include + /sw/include + /opt/local/include) +set (IlmBase_generic_library_paths + ${ILMBASE_CUSTOM_LIB_DIR} + /usr/lib + /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/local/lib + /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /sw/lib + /opt/local/lib) + +# Search paths for the IlmBase files +if (ILMBASE_HOME) + if (ILMBASE_VERSION) + set (IlmBase_include_paths + ${ILMBASE_HOME}/ilmbase-${ILMBASE_VERSION}/include + ${ILMBASE_HOME}/include/ilmbase-${ILMBASE_VERSION}) + set (IlmBase_library_paths + ${ILMBASE_HOME}/ilmbase-${ILMBASE_VERSION}/lib + ${ILMBASE_HOME}/lib/ilmbase-${ILMBASE_VERSION}) + endif() + list (APPEND IlmBase_include_paths ${ILMBASE_HOME}/include) + set (IlmBase_library_paths + ${ILMBASE_HOME}/lib + ${ILMBASE_HOME}/lib64 + ${ILMBASE_LIB_AREA} + ${IlmBase_library_paths}) +endif () +list (APPEND IlmBase_include_paths ${IlmBase_generic_include_paths}) +list (APPEND IlmBase_library_paths ${IlmBase_generic_library_paths}) + +# Locate the header files +PREFIX_FIND_INCLUDE_DIR (IlmBase + OpenEXR/IlmBaseConfig.h IlmBase_include_paths) + +if (ILMBASE_INCLUDE_DIR) + # Get the version from config file, if not already set. + if (NOT ILMBASE_VERSION) + FILE(STRINGS "${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h" ILMBASE_BUILD_SPECIFICATION + REGEX "^[ \t]*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"[.0-9]+\".*$") + + if(ILMBASE_BUILD_SPECIFICATION) + if (NOT IlmBase_FIND_QUIETLY) + message(STATUS "${ILMBASE_BUILD_SPECIFICATION}") + endif () + string(REGEX REPLACE ".*#define[ \t]+ILMBASE_VERSION_STRING[ \t]+\"([.0-9]+)\".*" + "\\1" XYZ ${ILMBASE_BUILD_SPECIFICATION}) + set("ILMBASE_VERSION" ${XYZ} CACHE STRING "Version of ILMBase lib") + else() + # Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though. + message(WARNING "Could not determine ILMBase library version, assuming 2.0.") + set("ILMBASE_VERSION" "2.0" CACHE STRING "Version of ILMBase lib") + endif() + endif() +endif () + + +if (ILMBASE_CUSTOM) + if (NOT ILMBASE_CUSTOM_LIBRARIES) + message (FATAL_ERROR "Custom IlmBase libraries requested but ILMBASE_CUSTOM_LIBRARIES is not set.") + endif() + set (IlmBase_Libraries ${ILMBASE_CUSTOM_LIBRARIES}) + separate_arguments(IlmBase_Libraries) +else () +#elseif (${ILMBASE_VERSION} VERSION_LESS "2.1") + set (IlmBase_Libraries Half Iex Imath IlmThread) +#else () +# string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _ilmbase_libs_ver ${ILMBASE_VERSION}) +# set (IlmBase_Libraries Half Iex-${_ilmbase_libs_ver} Imath-${_ilmbase_libs_ver} IlmThread-${_ilmbase_libs_ver}) +endif () + + +# Locate the IlmBase libraries +set (IlmBase_libvars "") +set (IlmBase_cachevars "") +foreach (ilmbase_lib ${IlmBase_Libraries}) + PREFIX_FIND_LIB (IlmBase ${ilmbase_lib} + IlmBase_library_paths IlmBase_libvars IlmBase_cachevars) +endforeach () +# Create the list of variables that might need to be cleared +set (ILMBASE_CACHED_VARS + ILMBASE_INCLUDE_DIR ${IlmBase_cachevars} + CACHE INTERNAL "Variables set by FindIlmBase.cmake" FORCE) + +# Store the current state so that variables might be cleared if required +set (ILMBASE_CACHED_STATE ${ILMBASE_CURRENT_STATE} + CACHE INTERNAL "State last seen by FindIlmBase.cmake" FORCE) + +# Link with pthreads if required +if (NOT WIN32 AND EXISTS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h) + file (STRINGS ${ILMBASE_INCLUDE_DIR}/OpenEXR/IlmBaseConfig.h + ILMBASE_HAVE_PTHREAD + REGEX "^[ \\t]*#define[ \\t]+HAVE_PTHREAD[ \\t]1[ \\t]*\$" + ) + if (ILMBASE_HAVE_PTHREAD) + find_package (Threads) + if (CMAKE_USE_PTHREADS_INIT) + set (ILMBASE_PTHREADS ${CMAKE_THREAD_LIBS_INIT}) + endif () + endif () +endif () + +# Use the standard function to handle ILMBASE_FOUND +FIND_PACKAGE_HANDLE_STANDARD_ARGS (IlmBase DEFAULT_MSG + ILMBASE_INCLUDE_DIR ${IlmBase_libvars}) + +if (ILMBASE_FOUND) + set (ILMBASE_LIBRARIES "") + foreach (tmplib ${IlmBase_libvars}) + list (APPEND ILMBASE_LIBRARIES ${${tmplib}}) + endforeach () + list (APPEND ILMBASE_LIBRARIES ${ILMBASE_PTHREADS}) + if (NOT IlmBase_FIND_QUIETLY) + FIND_PACKAGE_MESSAGE (ILMBASE + "Found IlmBase: ${ILMBASE_LIBRARIES}" + "[${ILMBASE_INCLUDE_DIR}][${ILMBASE_LIBRARIES}][${ILMBASE_CURRENT_STATE}]" + ) + endif () +endif () + +# Restore the original find library ordering +if( ILMBASE_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_ilmbase_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +endif() + +# Unset the helper variables to avoid pollution +unset (ILMBASE_CURRENT_STATE) +unset (IlmBase_include_paths) +unset (IlmBase_library_paths) +unset (IlmBase_generic_include_paths) +unset (IlmBase_generic_library_paths) +unset (IlmBase_libvars) +unset (IlmBase_cachevars) +unset (ILMBASE_PTHREADS) diff --git a/build_files/build_environment/patches/cmake/modules/FindLogC4Plus.cmake b/build_files/build_environment/patches/cmake/modules/FindLogC4Plus.cmake new file mode 100644 index 00000000000..2002419cc75 --- /dev/null +++ b/build_files/build_environment/patches/cmake/modules/FindLogC4Plus.cmake @@ -0,0 +1,73 @@ +# - Find LOGC4PLUS library +# Find the native LOGC4PLUS includes and library +# This module defines +# LOGC4PLUS_INCLUDE_DIRS, where to find logc4plus.h, Set when +# LOGC4PLUS is found. +# LOGC4PLUS_LIBRARIES, libraries to link against to use LOGC4PLUS. +# LOGC4PLUS_ROOT_DIR, The base directory to search for LOGC4PLUS. +# This can also be an environment variable. +# LOGC4PLUS_FOUND, If false, do not try to use LOGC4PLUS. +# +# also defined, but not for general use are +# LOGC4PLUS_LIBRARY, where to find the LOGC4PLUS library. + +#============================================================================= +# Copyright 2016 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If LOGC4PLUS_ROOT_DIR was defined in the environment, use it. +IF(NOT LOGC4PLUS_ROOT_DIR AND NOT $ENV{LOGC4PLUS_ROOT_DIR} STREQUAL "") + SET(LOGC4PLUS_ROOT_DIR $ENV{LOGC4PLUS_ROOT_DIR}) +ENDIF() + +SET(_logc4plus_SEARCH_DIRS + ${LOGC4PLUS_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt/lib/logc4plus +) + +FIND_PATH(LOGC4PLUS_INCLUDE_DIR + NAMES + logc4plus.h + HINTS + ${_logc4plus_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(LOGC4PLUS_LIBRARY + NAMES + logc4plus + HINTS + ${_logc4plus_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set LOGC4PLUS_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LOGC4PLUS DEFAULT_MSG + LOGC4PLUS_LIBRARY LOGC4PLUS_INCLUDE_DIR) + +IF(LOGC4PLUS_FOUND) + SET(LOGC4PLUS_LIBRARIES ${LOGC4PLUS_LIBRARY}) + SET(LOGC4PLUS_INCLUDE_DIRS ${LOGC4PLUS_INCLUDE_DIR}) +ELSE() + SET(LOGC4PLUS_LOGC4PLUS_FOUND FALSE) +ENDIF() + +MARK_AS_ADVANCED( + LOGC4PLUS_INCLUDE_DIR + LOGC4PLUS_LIBRARY +) diff --git a/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake new file mode 100644 index 00000000000..08d872445d7 --- /dev/null +++ b/build_files/build_environment/patches/cmake/modules/FindOpenEXR.cmake @@ -0,0 +1,244 @@ +# Module to find OpenEXR. +# +# This module will first look into the directories defined by the variables: +# - OPENEXR_HOME, OPENEXR_VERSION, OPENEXR_LIB_AREA +# +# It also supports non-standard names for the library components. +# +# To use a custom OpenEXR +# - Set the variable OPENEXR_CUSTOM to True +# - Set the variable OPENEXR_CUSTOM_LIBRARY to the name of the library to +# use, e.g. "SpiIlmImf" +# - Optionally set the variable OPENEXR_CUSTOM_INCLUDE_DIR to any +# particularly weird place that the OpenEXR/*.h files may be found +# - Optionally set the variable OPENEXR_CUSTOM_LIB_DIR to any +# particularly weird place that the libraries files may be found +# +# This module defines the following variables: +# +# OPENEXR_INCLUDE_DIR - where to find ImfRgbaFile.h, OpenEXRConfig, etc. +# OPENEXR_LIBRARIES - list of libraries to link against when using OpenEXR. +# This list does NOT include the IlmBase libraries. +# These are defined by the FindIlmBase module. +# OPENEXR_FOUND - True if OpenEXR was found. + +# Other standarnd issue macros +include (SelectLibraryConfigurations) +include (FindPackageHandleStandardArgs) +include (FindPackageMessage) + +if( OPENEXR_USE_STATIC_LIBS ) + set( _openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ) + endif() +endif() + +# Macro to assemble a helper state variable +macro (SET_STATE_VAR varname) + set (tmp_lst + ${OPENEXR_CUSTOM} | ${OPENEXR_CUSTOM_LIBRARY} | + ${OPENEXR_HOME} | ${OPENEXR_VERSION} | ${OPENEXR_LIB_AREA} + ) + set (${varname} "${tmp_lst}") + unset (tmp_lst) +endmacro () + +# To enforce that find_* functions do not use inadvertently existing versions +if (OPENEXR_CUSTOM) + set (OPENEXR_FIND_OPTIONS "NO_DEFAULT_PATH") +endif () + +# Macro to search for an include directory +macro (PREFIX_FIND_INCLUDE_DIR prefix includefile libpath_var) + string (TOUPPER ${prefix}_INCLUDE_DIR tmp_varname) + find_path(${tmp_varname} ${includefile} + HINTS ${${libpath_var}} + PATH_SUFFIXES include + ${OPENEXR_FIND_OPTIONS} + ) + if (${tmp_varname}) + mark_as_advanced (${tmp_varname}) + endif () + unset (tmp_varname) +endmacro () + + +# Macro to search for the given library and adds the cached +# variable names to the specified list +macro (PREFIX_FIND_LIB prefix libname libpath_var liblist_var cachelist_var) + string (TOUPPER ${prefix}_${libname} tmp_prefix) + # Handle new library names for OpenEXR 2.1 build via cmake + string(REPLACE "." "_" _ILMBASE_VERSION ${ILMBASE_VERSION}) + string(SUBSTRING ${_ILMBASE_VERSION} 0 3 _ILMBASE_VERSION ) + find_library(${tmp_prefix}_LIBRARY_RELEASE + NAMES ${libname} ${libname}-${_ILMBASE_VERSION} + HINTS ${${libpath_var}} + PATH_SUFFIXES lib + ${OPENEXR_FIND_OPTIONS} + ) + find_library(${tmp_prefix}_LIBRARY_DEBUG + NAMES ${libname}d ${libname}_d ${libname}debug ${libname}_debug + HINTS ${${libpath_var}} + PATH_SUFFIXES lib + ${OPENEXR_FIND_OPTIONS} + ) + # Properly define ${tmp_prefix}_LIBRARY (cached) and ${tmp_prefix}_LIBRARIES + select_library_configurations (${tmp_prefix}) + list (APPEND ${liblist_var} ${tmp_prefix}_LIBRARIES) + + # Add to the list of variables which should be reset + list (APPEND ${cachelist_var} + ${tmp_prefix}_LIBRARY + ${tmp_prefix}_LIBRARY_RELEASE + ${tmp_prefix}_LIBRARY_DEBUG) + mark_as_advanced ( + ${tmp_prefix}_LIBRARY + ${tmp_prefix}_LIBRARY_RELEASE + ${tmp_prefix}_LIBRARY_DEBUG) + unset (tmp_prefix) +endmacro () + + +# Encode the current state of the external variables into a string +SET_STATE_VAR (OPENEXR_CURRENT_STATE) + +# If the state has changed, clear the cached variables +if (OPENEXR_CACHED_STATE AND + NOT OPENEXR_CACHED_STATE STREQUAL OPENEXR_CURRENT_STATE) + foreach (libvar ${OPENEXR_CACHED_VARS}) + unset (${libvar} CACHE) + endforeach () +endif () + +# Generic search paths +set (OpenEXR_generic_include_paths + ${OPENEXR_CUSTOM_INCLUDE_DIR} + /usr/include + /usr/include/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/local/include + /sw/include + /opt/local/include) +set (OpenEXR_generic_library_paths + ${OPENEXR_CUSTOM_LIB_DIR} + /usr/lib + /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /usr/local/lib + /usr/local/lib/${CMAKE_LIBRARY_ARCHITECTURE} + /sw/lib + /opt/local/lib) + +# Search paths for the OpenEXR files +if (OPENEXR_HOME) + set (OpenEXR_library_paths + ${OPENEXR_HOME}/lib + ${OPENEXR_HOME}/lib64) + if (OPENEXR_VERSION) + set (OpenEXR_include_paths + ${OPENEXR_HOME}/openexr-${OPENEXR_VERSION}/include + ${OPENEXR_HOME}/include/openexr-${OPENEXR_VERSION}) + list (APPEND OpenEXR_library_paths + ${OPENEXR_HOME}/openexr-${OPENEXR_VERSION}/lib + ${OPENEXR_HOME}/lib/openexr-${OPENEXR_VERSION}) + endif() + list (APPEND OpenEXR_include_paths ${OPENEXR_HOME}/include) + if (OPENEXR_LIB_AREA) + list (INSERT OpenEXR_library_paths 2 ${OPENEXR_LIB_AREA}) + endif () +endif () +if (ILMBASE_HOME AND OPENEXR_VERSION) + list (APPEND OpenEXR_include_paths + ${ILMBASE_HOME}/include/openexr-${OPENEXR_VERSION}) +endif() +list (APPEND OpenEXR_include_paths ${OpenEXR_generic_include_paths}) +list (APPEND OpenEXR_library_paths ${OpenEXR_generic_library_paths}) + +# Locate the header files +PREFIX_FIND_INCLUDE_DIR (OpenEXR + OpenEXR/ImfArray.h OpenEXR_include_paths) + +if (OPENEXR_INCLUDE_DIR) + # Get the version from config file, if not already set. + if (NOT OPENEXR_VERSION) + FILE(STRINGS "${OPENEXR_INCLUDE_DIR}/OpenEXR/OpenEXRConfig.h" OPENEXR_BUILD_SPECIFICATION + REGEX "^[ \t]*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"[.0-9]+\".*$") + + if(OPENEXR_BUILD_SPECIFICATION) + if (NOT OpenEXR_FIND_QUIETLY) + message(STATUS "${OPENEXR_BUILD_SPECIFICATION}") + endif () + string(REGEX REPLACE ".*#define[ \t]+OPENEXR_VERSION_STRING[ \t]+\"([.0-9]+)\".*" + "\\1" XYZ ${OPENEXR_BUILD_SPECIFICATION}) + set("OPENEXR_VERSION" ${XYZ} CACHE STRING "Version of OpenEXR lib") + else() + # Old versions (before 2.0?) do not have any version string, just assuming 2.0 should be fine though. + message(WARNING "Could not determine ILMBase library version, assuming 2.0.") + set("OPENEXR_VERSION" "2.0" CACHE STRING "Version of OpenEXR lib") + endif() + endif() +endif () + +if (OPENEXR_CUSTOM) + if (NOT OPENEXR_CUSTOM_LIBRARY) + message (FATAL_ERROR "Custom OpenEXR library requested but OPENEXR_CUSTOM_LIBRARY is not set.") + endif() + set (OpenEXR_Library ${OPENEXR_CUSTOM_LIBRARY}) +else () +#elseif (${OPENEXR_VERSION} VERSION_LESS "2.1") + set (OpenEXR_Library IlmImf) +#else () +# string(REGEX REPLACE "([0-9]+)[.]([0-9]+).*" "\\1_\\2" _openexr_libs_ver ${OPENEXR_VERSION}) +# set (OpenEXR_Library IlmImf-${_openexr_libs_ver}) +endif () + +# Locate the OpenEXR library +set (OpenEXR_libvars "") +set (OpenEXR_cachevars "") +PREFIX_FIND_LIB (OpenEXR ${OpenEXR_Library} + OpenEXR_library_paths OpenEXR_libvars OpenEXR_cachevars) + +# Create the list of variables that might need to be cleared +set (OPENEXR_CACHED_VARS + OPENEXR_INCLUDE_DIR ${OpenEXR_cachevars} + CACHE INTERNAL "Variables set by FindOpenEXR.cmake" FORCE) + +# Store the current state so that variables might be cleared if required +set (OPENEXR_CACHED_STATE ${OPENEXR_CURRENT_STATE} + CACHE INTERNAL "State last seen by FindOpenEXR.cmake" FORCE) + +# Always link explicitly with zlib +set (OPENEXR_ZLIB ${ZLIB_LIBRARIES}) + +# Use the standard function to handle OPENEXR_FOUND +FIND_PACKAGE_HANDLE_STANDARD_ARGS (OpenEXR DEFAULT_MSG + OPENEXR_INCLUDE_DIR ${OpenEXR_libvars}) + +if (OPENEXR_FOUND) + set (OPENEXR_LIBRARIES "") + foreach (tmplib ${OpenEXR_libvars}) + list (APPEND OPENEXR_LIBRARIES ${${tmplib}}) + endforeach () + list (APPEND OPENEXR_LIBRARIES ${ZLIB_LIBRARIES}) + if (NOT OpenEXR_FIND_QUIETLY) + FIND_PACKAGE_MESSAGE (OPENEXR + "Found OpenEXR: ${OPENEXR_LIBRARIES}" + "[${OPENEXR_INCLUDE_DIR}][${OPENEXR_LIBRARIES}][${OPENEXR_CURRENT_STATE}]" + ) + endif () +endif () + +# Restore the original find library ordering +if( OPENEXR_USE_STATIC_LIBS ) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openexr_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +endif() + +# Unset the helper variables to avoid pollution +unset (OPENEXR_CURRENT_STATE) +unset (OpenEXR_include_paths) +unset (OpenEXR_library_paths) +unset (OpenEXR_generic_include_paths) +unset (OpenEXR_generic_library_paths) +unset (OpenEXR_libvars) +unset (OpenEXR_cachevars) diff --git a/build_files/build_environment/patches/cmake/modules/FindTBB.cmake b/build_files/build_environment/patches/cmake/modules/FindTBB.cmake new file mode 100644 index 00000000000..8a821f8092e --- /dev/null +++ b/build_files/build_environment/patches/cmake/modules/FindTBB.cmake @@ -0,0 +1,73 @@ +# - Find TBB library +# Find the native TBB includes and library +# This module defines +# TBB_INCLUDE_DIRS, where to find tbb.h, Set when +# TBB is found. +# TBB_LIBRARIES, libraries to link against to use TBB. +# TBB_ROOT_DIR, The base directory to search for TBB. +# This can also be an environment variable. +# TBB_FOUND, If false, do not try to use TBB. +# +# also defined, but not for general use are +# TBB_LIBRARY, where to find the TBB library. + +#============================================================================= +# Copyright 2016 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +# If TBB_ROOT_DIR was defined in the environment, use it. +IF(NOT TBB_ROOT_DIR AND NOT $ENV{TBB_ROOT_DIR} STREQUAL "") + SET(TBB_ROOT_DIR $ENV{TBB_ROOT_DIR}) +ENDIF() + +SET(_tbb_SEARCH_DIRS + ${TBB_ROOT_DIR} + /usr/local + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt/lib/tbb +) + +FIND_PATH(TBB_INCLUDE_DIR + NAMES + tbb/tbb.h + HINTS + ${_tbb_SEARCH_DIRS} + PATH_SUFFIXES + include +) + +FIND_LIBRARY(TBB_LIBRARY + NAMES + tbb + HINTS + ${_tbb_SEARCH_DIRS} + PATH_SUFFIXES + lib64 lib + ) + +# handle the QUIETLY and REQUIRED arguments and set TBB_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(TBB DEFAULT_MSG + TBB_LIBRARY TBB_INCLUDE_DIR) + +IF(TBB_FOUND) + SET(TBB_LIBRARIES ${TBB_LIBRARY}) + SET(TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR}) +ELSE() + SET(TBB_TBB_FOUND FALSE) +ENDIF() + +MARK_AS_ADVANCED( + TBB_INCLUDE_DIR + TBB_LIBRARY +) diff --git a/build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake b/build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake new file mode 100644 index 00000000000..51b4dda0653 --- /dev/null +++ b/build_files/build_environment/patches/cmake/modules/SelectLibraryConfigurations.cmake @@ -0,0 +1,82 @@ +# select_library_configurations( basename ) +# +# This macro takes a library base name as an argument, and will choose good +# values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and +# basename_LIBRARY_RELEASE depending on what has been found and set. If only +# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG, +# and basename_LIBRARY_RELEASE will be set to the release value. If only +# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY, +# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value. +# +# If the generator supports configuration types, then basename_LIBRARY and +# basename_LIBRARIES will be set with debug and optimized flags specifying the +# library to be used for the given configuration. If no build type has been set +# or the generator in use does not support configuration types, then +# basename_LIBRARY and basename_LIBRARIES will take only the release values. + +#============================================================================= +# Copyright 2009 Kitware, Inc. +# Copyright 2009 Will Dicharry +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This macro was adapted from the FindQt4 CMake module and is maintained by Will +# Dicharry . + +# Utility macro to check if one variable exists while another doesn't, and set +# one that doesn't exist to the one that exists. +macro( _set_library_name basename GOOD BAD ) + if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} ) + set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} ) + set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} ) + endif( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} ) +endmacro( _set_library_name ) + +macro( select_library_configurations basename ) + # if only the release version was found, set the debug to be the release + # version. + _set_library_name( ${basename} RELEASE DEBUG ) + # if only the debug version was found, set the release value to be the + # debug value. + _set_library_name( ${basename} DEBUG RELEASE ) + if (${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + # if the generator supports configuration types or CMAKE_BUILD_TYPE + # is set, then set optimized and debug options. + if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + set( ${basename}_LIBRARY + optimized ${${basename}_LIBRARY_RELEASE} + debug ${${basename}_LIBRARY_DEBUG} ) + set( ${basename}_LIBRARIES + optimized ${${basename}_LIBRARY_RELEASE} + debug ${${basename}_LIBRARY_DEBUG} ) + else( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + # If there are no configuration types or build type, just use + # the release version + set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} ) + set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} ) + endif( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) + endif( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE ) + + set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH + "The ${basename} library" ) + + if( ${basename}_LIBRARY ) + set( ${basename}_FOUND TRUE ) + endif( ${basename}_LIBRARY ) + + mark_as_advanced( ${basename}_LIBRARY + ${basename}_LIBRARY_RELEASE + ${basename}_LIBRARY_DEBUG + ) +endmacro( select_library_configurations ) + diff --git a/build_files/build_environment/patches/cmakelists_glew.txt b/build_files/build_environment/patches/cmakelists_glew.txt new file mode 100644 index 00000000000..ec36d4bde63 --- /dev/null +++ b/build_files/build_environment/patches/cmakelists_glew.txt @@ -0,0 +1,2 @@ +cmake_minimum_required (VERSION 2.4) +add_subdirectory(build/cmake) \ No newline at end of file diff --git a/build_files/build_environment/patches/cmakelists_hidapi.txt b/build_files/build_environment/patches/cmakelists_hidapi.txt new file mode 100644 index 00000000000..239b9d88b16 --- /dev/null +++ b/build_files/build_environment/patches/cmakelists_hidapi.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.8) +project(hidapi) + +set(SRC_FILES + windows/hid.c +) + +set(HEADER_FILES + hidapi/hidapi.h +) +include_directories(hidapi) +add_definitions(-DHID_API_STATIC) +add_library(hidapi STATIC ${SRC_FILES} ${HEADER_FILES}) + +install(TARGETS hidapi DESTINATION lib) + +INSTALL(FILES hidapi/hidapi.h + DESTINATION "include" + ) + diff --git a/build_files/build_environment/patches/cmakelists_openvdb.txt b/build_files/build_environment/patches/cmakelists_openvdb.txt new file mode 100644 index 00000000000..dd3e9c1a887 --- /dev/null +++ b/build_files/build_environment/patches/cmakelists_openvdb.txt @@ -0,0 +1,398 @@ +# -------------------------------------------------------------------------------- + +cmake_minimum_required(VERSION 2.8) + +# -------------------------------------------------------------------------------- + +project(OpenVDB) + +# -------------------------------------------------------------------------------- + +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") + +# -------------------------------------------------------------------------------- + +set(CMAKE_BUILD_TYPE_INIT "Release") + +# -------------------------------------------------------------------------------- +# Options + +option(WITH_BLOSC "Enable Blosc support for compression" OFF) +option(WITH_LOGC4PLUS "Enable logging" OFF) +option(WITH_OPENVDB_2_ABI "Enable building the library to be compability with the OpenVDB 2 ABI" OFF) +option(WITH_PRINTER "Enable building the OpenVDB print executable" OFF) +option(WITH_PYTHON "Enable building the OpenVDB python API" OFF) +option(WITH_RENDERER "Enable building the OpenVDB render executable" OFF) +option(WITH_UNITTEST "Enable building the unit tests" OFF) +option(WITH_VIEWER "Enable building the OpenVDB viewer executable" OFF) + +# -------------------------------------------------------------------------------- +# Find packages +#set(BOOST_LIBRARIES boost_iostreams boost_system boost_thread) + +find_package(IlmBase) +find_package(OpenEXR) +find_package(TBB) +find_package(Boost) + +if(WITH_BLOSC) + find_package(Blosc) + + if(NOT BLOSC_FOUND) + set(WITH_BLOSC OFF) + endif() +endif() + +# todo +if(WITH_VIEWER) + set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_PATH}) + set(GLFW_LIBRARY_DIRS ${GLFW_LIBRARY_PATH}) +endif() + +if(WITH_LOGC4PLUS) + find_package(LogC4Plus) + + if(NOT LOGC4PLUS_FOUND) + set(WITH_LOGC4PLUS OFF) + endif() +endif() + +# todo +if(WITH_PYTHON) + set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_PATH}) + set(PYTHON_LIBRARY_DIRS ${PYTHON_LIBRARY_PATH}) +endif() + +if(WITH_UNITTEST) + find_package(CppUnit) + + if(NOT CPPUNIT_FOUND) + set(WITH_UNITTEST OFF) + endif() +endif() + +# -------------------------------------------------------------------------------- + +message (STATUS "BOOST_ROOT ${BOOST_ROOT}") +message (STATUS "Boost found ${Boost_FOUND} ") +message (STATUS "Boost version ${Boost_VERSION}") +message (STATUS "Boost include dirs ${Boost_INCLUDE_DIRS}") +message (STATUS "Boost library dirs ${Boost_LIBRARY_DIRS}") +message (STATUS "Boost libraries ${Boost_LIBRARIES}") + +message (STATUS "ILMBase found ${ILMBASE_FOUND} ") +message (STATUS "ILMBase include dir ${ILMBASE_INCLUDE_DIR}") +message (STATUS "ILMBase libraries ${ILMBASE_LIBRARIES}") + +message (STATUS "TBB found ${TBB_FOUND} ") +message (STATUS "TBB include dir ${TBB_INCLUDE_DIR}") +message (STATUS "TBB libraries ${TBB_LIBRARIES}") + +if(MSVC) + set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj" ) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj" ) +endif() + +set(OPENVDB_LIBRARIES ${BLOSC_LIBRARIES} ${BOOST_LIBRARIES} ${OPENEXR_LIBRARIES} ${ILMBASE_LIBRARIES} ${TBB_LIBRARIES} ${ZLIB_LIBRARY} ) + +include_directories(. ${CMAKE_CURRENT_SOURCE_DIR}/../ ${Boost_INCLUDE_DIRS} ${ILMBASE_INCLUDE_DIR} ${OPENEXR_INCLUDE_DIR} ${TBB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) +link_directories(${Boost_LIBRARY_DIRS} ${OPENEXR_LIBRARY_DIRS} ${TBB_INCLUDE_DIRS}) +add_definitions(-DNOMINMAX -D__TBB_NO_IMPLICIT_LINKAGE -DOPENVDB_STATICLIB -DOPENVDB_OPENEXR_STATICLIB) + +if(WITH_BLOSC) + add_definitions(-DOPENVDB_USE_BLOSC) + include_directories(${BLOSC_INCLUDE_DIRS}) + link_directories(${BLOSC_LIBRARY_DIRS}) +endif() + +if(WITH_LOGC4PLUS) + add_definitions(-DOPENVDB_USE_LOG4CPLUS) + include_directories(${LOG4CPLUS_INCLUDE_DIRS}) + link_directories(${LOG4CPLUS_LIBRARY_DIRS}) +endif() + +if(WITH_OPENVDB_2_ABI) + add_definitions(-DOPENVDB_2_ABI_COMPATIBLE) +endif() + +# todo +if(WITH_OPENVDB_USE_GLFW_3) + add_definitions(-DOPENVDB_USE_GLFW_3) +endif() + +if(WITH_UNITTEST) + include_directories(${CPPUNIT_INCLUDE_DIRS}) + link_directories(${CPPUNIT_LIBRARY_DIRS}) +endif() + +# -------------------------------------------------------------------------------- + +set(SRC_FILES + openvdb/openvdb.cc + openvdb/io/Compression.cc + openvdb/io/File.cc + openvdb/io/Queue.cc + openvdb/io/Stream.cc + openvdb/io/TempFile.cc + openvdb/io/GridDescriptor.cc + openvdb/io/Archive.cc + openvdb/metadata/MetaMap.cc + openvdb/metadata/Metadata.cc + openvdb/math/Maps.cc + openvdb/math/Transform.cc + openvdb/math/QuantizedUnitVec.cc + openvdb/math/Proximity.cc + openvdb/Grid.cc + openvdb/util/Formats.cc + openvdb/util/Util.cc +) + +set(HEADER_FILES + openvdb/openvdb.h + openvdb/version.h + openvdb/PlatformConfig.h + openvdb/Metadata.h + openvdb/Exceptions.h + openvdb/Grid.h + openvdb/Types.h + openvdb/Platform.h + openvdb/tree/ValueAccessor.h + openvdb/tree/NodeUnion.h + openvdb/tree/Tree.h + openvdb/tree/Iterator.h + openvdb/tree/LeafNodeBool.h + openvdb/tree/TreeIterator.h + openvdb/tree/LeafNode.h + openvdb/tree/NodeManager.h + openvdb/tree/LeafManager.h + openvdb/tree/InternalNode.h + openvdb/tree/RootNode.h + openvdb/tools/PointScatter.h + openvdb/tools/VolumeAdvect.h + openvdb/tools/LevelSetTracker.h + openvdb/tools/Composite.h + openvdb/tools/Morphology.h + openvdb/tools/ValueTransformer.h + openvdb/tools/ChangeBackground.h + openvdb/tools/GridTransformer.h + openvdb/tools/Prune.h + openvdb/tools/LevelSetUtil.h + openvdb/tools/VolumeToSpheres.h + openvdb/tools/LevelSetAdvect.h + openvdb/tools/Statistics.h + openvdb/tools/LevelSetMeasure.h + openvdb/tools/VectorTransformer.h + openvdb/tools/RayIntersector.h + openvdb/tools/PointPartitioner.h + openvdb/tools/Interpolation.h + openvdb/tools/VelocityFields.h + openvdb/tools/PointIndexGrid.h + openvdb/tools/LevelSetRebuild.h + openvdb/tools/Clip.h + openvdb/tools/SignedFloodFill.h + openvdb/tools/MeshToVolume.h + openvdb/tools/Dense.h + openvdb/tools/Filter.h + openvdb/tools/RayTracer.h + openvdb/tools/Diagnostics.h + openvdb/tools/VolumeToMesh.h + openvdb/tools/PoissonSolver.h + openvdb/tools/LevelSetFracture.h + openvdb/tools/GridOperators.h + openvdb/tools/DenseSparseTools.h + openvdb/tools/ParticlesToLevelSet.h + openvdb/tools/LevelSetSphere.h + openvdb/tools/LevelSetMorph.h + openvdb/tools/LevelSetFilter.h + openvdb/tools/PointAdvect.h + openvdb/io/Queue.h + openvdb/io/TempFile.h + openvdb/io/Stream.h + openvdb/io/GridDescriptor.h + openvdb/io/Archive.h + openvdb/io/io.h + openvdb/io/Compression.h + openvdb/io/File.h + openvdb/metadata/StringMetadata.h + openvdb/metadata/MetaMap.h + openvdb/metadata/Metadata.h + openvdb/math/DDA.h + openvdb/math/Vec2.h + openvdb/math/FiniteDifference.h + openvdb/math/Stencils.h + openvdb/math/BBox.h + openvdb/math/Mat3.h + openvdb/math/Mat.h + openvdb/math/Proximity.h + openvdb/math/Ray.h + openvdb/math/ConjGradient.h + openvdb/math/Quat.h + openvdb/math/Vec3.h + openvdb/math/Vec4.h + openvdb/math/QuantizedUnitVec.h + openvdb/math/Coord.h + openvdb/math/Operators.h + openvdb/math/Stats.h + openvdb/math/Math.h + openvdb/math/Tuple.h + openvdb/math/LegacyFrustum.h + openvdb/math/Mat4.h + openvdb/math/Maps.h + openvdb/math/Transform.h + openvdb/util/PagedArray.h + openvdb/util/CpuTimer.h + openvdb/util/Formats.h + openvdb/util/NullInterrupter.h + openvdb/util/Util.h + openvdb/util/Name.h + openvdb/util/MapsUtil.h + openvdb/util/NodeMasks.h + openvdb/util/logging.h +) + +add_library(openvdb STATIC ${SRC_FILES} ${HEADER_FILES}) + +# -------------------------------------------------------------------------------- + +target_link_libraries(openvdb ${OPENVDB_LIBRARIES}) + +set(OPENVDB_VERSION_MAJOR 3) +set(OPENVDB_VERSION_MINOR 1) +set(OPENVDB_VERSION_PATCH 0) +set(OPENVDB_VERSION_STRING ${OPENVDB_VERSION_MAJOR}.${OPENVDB_VERSION_MINOR}.${OPENVDB_VERSION_PATCH}) + +set_target_properties(openvdb PROPERTIES VERSION ${OPENVDB_VERSION_STRING} SOVERSION ${OPENVDB_VERSION_MAJOR}) + +install(TARGETS openvdb DESTINATION lib) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION include COMPONENT Development FILES_MATCHING PATTERN "*.h" + PATTERN ".git" EXCLUDE PATTERN "build" EXCLUDE PATTERN "cmake" EXCLUDE) + +# -------------------------------------------------------------------------------- + +if(WITH_PRINTER) + set(PRINT_SRC + openvdb/cmd/openvdb_print/main.cc + ) + + add_executable(vdb_print ${PRINT_SRC}) + target_link_libraries(vdb_print openvdb) + install(TARGETS vdb_print RUNTIME DESTINATION bin) +endif() + +if(WITH_RENDER) + set(RENDER_SRC + openvdb/cmd/openvdb_render/main.cc + ) + + add_executable(vdb_render ${RENDER_SRC}) + target_link_libraries(vdb_render openvdb) + install(TARGETS vdb_render RUNTIME DESTINATION bin) +endif() + +# todo +if(WITH_VIEWER) + set(VIEWER_SRC + openvdb/viewer/Camera.cc + openvdb/viewer/ClipBox.cc + openvdb/viewer/Font.cc + openvdb/viewer/RenderModules.cc + openvdb/viewer/Viewer.cc + + openvdb/viewer/Camera.h + openvdb/viewer/ClipBox.h + openvdb/viewer/Font.h + openvdb/viewer/RenderModules.h + openvdb/viewer/Viewer.h + openvdb/cmd/openvdb_viewer/main.cc + ) + + include_directories(${GLFW_INCLUDE_DIRS}) + link_directories(${GLFW_LIBRARY_DIRS}) + + add_executable(vdb_viewer ${VIEWER_SRC}) + target_link_libraries(vdb_viewer openvdb) + install(TARGETS vdb_viewer RUNTIME DESTINATION bin) +endif() + +# todo +if(WITH_PYTHON) +# add_library(pyopenvdb SHARED ) +endif() + +set(UNITTEST_SRC + openvdb/unittest/main.cc + openvdb/unittest/TestBBox.cc + openvdb/unittest/TestConjGradient.cc + openvdb/unittest/TestCoord.cc + openvdb/unittest/TestCpt.cc + openvdb/unittest/TestCurl.cc + openvdb/unittest/TestDense.cc + openvdb/unittest/TestDenseSparseTools.cc + openvdb/unittest/TestDiagnostics.cc + openvdb/unittest/TestDivergence.cc + openvdb/unittest/TestDoubleMetadata.cc + openvdb/unittest/TestExceptions.cc + openvdb/unittest/TestFile.cc + openvdb/unittest/TestFloatMetadata.cc + openvdb/unittest/TestGradient.cc + openvdb/unittest/TestGrid.cc + openvdb/unittest/TestGridBbox.cc + openvdb/unittest/TestGridDescriptor.cc + openvdb/unittest/TestGridIO.cc + openvdb/unittest/TestGridTransformer.cc + openvdb/unittest/TestInit.cc + openvdb/unittest/TestInt32Metadata.cc + openvdb/unittest/TestInt64Metadata.cc + openvdb/unittest/TestInternalOrigin.cc + openvdb/unittest/TestLaplacian.cc + openvdb/unittest/TestLeaf.cc + openvdb/unittest/TestLeafBool.cc + openvdb/unittest/TestLeafIO.cc + openvdb/unittest/TestLeafOrigin.cc + openvdb/unittest/TestLevelSetRayIntersector.cc + openvdb/unittest/TestLevelSetUtil.cc + openvdb/unittest/TestLinearInterp.cc + openvdb/unittest/TestMaps.cc + openvdb/unittest/TestMat4Metadata.cc + openvdb/unittest/TestMath.cc + openvdb/unittest/TestMeanCurvature.cc + openvdb/unittest/TestMeshToVolume.cc + openvdb/unittest/TestMetadata.cc + openvdb/unittest/TestMetadataIO.cc + openvdb/unittest/TestMetaMap.cc + openvdb/unittest/TestName.cc + openvdb/unittest/TestNodeIterator.cc + openvdb/unittest/TestNodeMask.cc + openvdb/unittest/TestParticlesToLevelSet.cc + openvdb/unittest/TestPointIndexGrid.cc + openvdb/unittest/TestPointPartitioner.cc + openvdb/unittest/TestPoissonSolver.cc + openvdb/unittest/TestPrePostAPI.cc + openvdb/unittest/TestQuadraticInterp.cc + openvdb/unittest/TestQuantizedUnitVec.cc + openvdb/unittest/TestQuat.cc + openvdb/unittest/TestRay.cc + openvdb/unittest/TestStats.cc + openvdb/unittest/TestStream.cc + openvdb/unittest/TestStringMetadata.cc + openvdb/unittest/TestTools.cc + openvdb/unittest/TestTransform.cc + openvdb/unittest/TestTree.cc + openvdb/unittest/TestTreeCombine.cc + openvdb/unittest/TestTreeGetSetValues.cc + openvdb/unittest/TestTreeIterators.cc + openvdb/unittest/TestTreeVisitor.cc + openvdb/unittest/TestUtil.cc + openvdb/unittest/TestValueAccessor.cc + openvdb/unittest/TestVec2Metadata.cc + openvdb/unittest/TestVec3Metadata.cc + openvdb/unittest/TestVolumeRayIntersector.cc + openvdb/unittest/TestVolumeToMesh.cc +) + +# todo +if(WITH_UNITTEST) + add_executable(test ${UNITTEST_SRC} ${HEADER_FILES}) + target_link_libraries(test openvdb ${CPPUNIT_LIBRARIES}) +endif() diff --git a/build_files/build_environment/patches/cmakelists_tbb.txt b/build_files/build_environment/patches/cmakelists_tbb.txt new file mode 100644 index 00000000000..1be9ca25f6a --- /dev/null +++ b/build_files/build_environment/patches/cmakelists_tbb.txt @@ -0,0 +1,196 @@ +cmake_minimum_required (VERSION 2.8) +project(tbb CXX) + +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() + +include_directories(include src src/rml/include ) + +option(TBB_BUILD_SHARED "Build TBB shared library" ON) +option(TBB_BUILD_STATIC "Build TBB static library" ON) +option(TBB_BUILD_TBBMALLOC "Build TBB malloc library" ON) +option(TBB_BUILD_TBBMALLOC_PROXY "Build TBB malloc proxy library" ON) + +if(APPLE) + set(CMAKE_MACOSX_RPATH ON) +endif() + +file(GLOB tbb_src "${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/*.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/old/*.cpp") +list(APPEND tbb_src ${CMAKE_CURRENT_SOURCE_DIR}/src/rml/client/rml_tbb.cpp) +file(GLOB to_remove "${CMAKE_CURRENT_SOURCE_DIR}/src/old/test*.cpp") +list(REMOVE_ITEM tbb_src ${to_remove}) + +set(tbbmalloc_static_src + src/tbbmalloc/backend.cpp + src/tbbmalloc/large_objects.cpp + src/tbbmalloc/backref.cpp + src/tbbmalloc/tbbmalloc.cpp + src/tbbmalloc/frontend.cpp + src/tbb/itt_notify.cpp) + +set(tbbmalloc_src ${tbbmalloc_static_src}) + +set(tbbmalloc_proxy_src + src/tbbmalloc/proxy.cpp + src/tbbmalloc/tbb_function_replacement.cpp) + +if (NOT APPLE) + add_definitions(-DDO_ITT_NOTIFY) +else() + # Disable annoying "has no symbols" warnings + set(CMAKE_C_ARCHIVE_CREATE " Scr ") + set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") + set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") + set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") +endif() + +if (UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -DUSE_PTHREAD") + if(NOT CMAKE_CXX_FLAGS MATCHES "-mno-rtm") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mrtm") + endif() + if (APPLE) + set(ARCH_PREFIX "mac") + else() + set(ARCH_PREFIX "lin") + endif() + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + set(ARCH_PREFIX "${ARCH_PREFIX}64") + else() + set(ARCH_PREFIX "${ARCH_PREFIX}32") + endif() + set(ENABLE_RTTI "-frtti -fexceptions ") + set(DISABLE_RTTI "-fno-rtti -fno-exceptions ") +elseif(WIN32) + cmake_minimum_required (VERSION 3.1) + enable_language(ASM_MASM) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS- /Zc:wchar_t /Zc:forScope /DUSE_WINTHREAD") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_DEPRECATE /D_WIN32_WINNT=0x0600 /volatile:iso") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4800 /wd4146 /wd4244 /wd4018") + + if (CMAKE_SIZEOF_VOID_P EQUAL 8) + list(APPEND tbb_src src/tbb/intel64-masm/atomic_support.asm + src/tbb/intel64-masm/itsx.asm src/tbb/intel64-masm/intel64_misc.asm) + list(APPEND tbbmalloc_src src/tbb/intel64-masm/atomic_support.asm) + set(CMAKE_ASM_MASM_FLAGS "/DEM64T=1") + set(ARCH_PREFIX "win64") + else() + list(APPEND tbb_src src/tbb/ia32-masm/atomic_support.asm + src/tbb/ia32-masm/itsx.asm src/tbb/ia32-masm/lock_byte.asm) + list(APPEND tbbmalloc_src src/tbb/ia32-masm/atomic_support.asm) + set(ARCH_PREFIX "win32") + endif() + set(ENABLE_RTTI "/EHsc /GR ") + set(DISABLE_RTTI "/EHs- /GR- ") +endif() + +# Linker export definitions +if (WIN32) + add_custom_command(OUTPUT tbb.def + COMMAND ${CMAKE_CXX_COMPILER} /TC /EP ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include > tbb.def + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def + COMMENT "Preprocessing tbb.def" + ) + + add_custom_command(OUTPUT tbbmalloc.def + COMMAND ${CMAKE_CXX_COMPILER} /TC /EP ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include > tbbmalloc.def + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def + COMMENT "Preprocessing tbbmalloc.def" + ) +else() + add_custom_command(OUTPUT tbb.def + COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbb.def + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/${ARCH_PREFIX}-tbb-export.def + COMMENT "Preprocessing tbb.def" + ) + + add_custom_command(OUTPUT tbbmalloc.def + COMMAND ${CMAKE_CXX_COMPILER} -xc++ -E ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def -I ${CMAKE_CURRENT_SOURCE_DIR}/include -o tbbmalloc.def + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/src/tbbmalloc/${ARCH_PREFIX}-tbbmalloc-export.def + COMMENT "Preprocessing tbbmalloc.def" + ) +endif() + +add_custom_target(tbb_def_files DEPENDS tbb.def tbbmalloc.def) + +# TBB library +if (TBB_BUILD_STATIC) + add_library(tbb_static STATIC ${tbb_src}) + set_property(TARGET tbb_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1") + set_property(TARGET tbb_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_SOURCE_DIRECTLY_INCLUDED=1") + set_property(TARGET tbb_static APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI}) + install(TARGETS tbb_static ARCHIVE DESTINATION lib) +endif() + +if (TBB_BUILD_SHARED) + add_library(tbb SHARED ${tbb_src}) + set_property(TARGET tbb APPEND PROPERTY COMPILE_DEFINITIONS "__TBB_BUILD=1") + set_property(TARGET tbb APPEND_STRING PROPERTY COMPILE_FLAGS ${ENABLE_RTTI}) + add_dependencies(tbb tbb_def_files) + if (APPLE) + set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbb.def") + elseif(UNIX) + set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbb.def") + elseif(WIN32) + set_property(TARGET tbb APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbb.def") + endif() + install(TARGETS tbb DESTINATION lib) +endif() + +if(CMAKE_COMPILER_IS_GNUCC) + # Quench a warning on GCC + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/governor.cpp COMPILE_FLAGS "-Wno-missing-field-initializers ") +elseif(MSVC) + # Quench a warning on MSVC + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/tbb/scheduler.cpp COMPILE_FLAGS "/wd4458 ") +endif() + +if(TBB_BUILD_TBBMALLOC) + # TBB malloc library + if (TBB_BUILD_STATIC) + add_library(tbbmalloc_static STATIC ${tbbmalloc_static_src}) + set_property(TARGET tbbmalloc_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") + set_property(TARGET tbbmalloc_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) + install(TARGETS tbbmalloc_static ARCHIVE DESTINATION lib) + endif() + + if (TBB_BUILD_SHARED) + add_library(tbbmalloc SHARED ${tbbmalloc_src}) + set_property(TARGET tbbmalloc APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") + set_property(TARGET tbbmalloc APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) + add_dependencies(tbbmalloc tbb_def_files) + if (APPLE) + set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def") + elseif(UNIX) + set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "-Wl,-version-script,${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def") + elseif(WIN32) + set_property(TARGET tbbmalloc APPEND PROPERTY LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/tbbmalloc.def") + endif() + install(TARGETS tbbmalloc DESTINATION lib) + endif() +endif() + +if(TBB_BUILD_TBBMALLOC_PROXY) + # TBB malloc proxy library + if (TBB_BUILD_STATIC) + add_library(tbbmalloc_proxy_static STATIC ${tbbmalloc_proxy_src}) + set_property(TARGET tbbmalloc_proxy_static APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") + set_property(TARGET tbbmalloc_proxy_static APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) + link_libraries(tbbmalloc_proxy_static tbbmalloc) + install(TARGETS tbbmalloc_proxy_static ARCHIVE DESTINATION lib) + endif() + + if (TBB_BUILD_SHARED) + add_library(tbbmalloc_proxy SHARED ${tbbmalloc_proxy_src}) + set_property(TARGET tbbmalloc_proxy APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") + set_property(TARGET tbbmalloc_proxy APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) + link_libraries(tbbmalloc_proxy tbbmalloc) + install(TARGETS tbbmalloc_proxy DESTINATION lib) + endif() +endif() + +install(DIRECTORY include/tbb DESTINATION include) diff --git a/build_files/build_environment/patches/cuew.diff b/build_files/build_environment/patches/cuew.diff new file mode 100644 index 00000000000..0363034cd93 --- /dev/null +++ b/build_files/build_environment/patches/cuew.diff @@ -0,0 +1,26 @@ +--- CmakeLists.txt.orig 2015-12-31 03:46:41 -0700 ++++ CMakeLists.txt 2016-04-01 13:28:33 -0600 +@@ -22,3 +22,10 @@ + + add_executable(testcuew cuewTest/cuewTest.c include/cuew.h) + target_link_libraries(testcuew cuew ${CMAKE_DL_LIBS}) ++ ++install(TARGETS cuew ++ LIBRARY DESTINATION lib COMPONENT libraries ++ ARCHIVE DESTINATION lib/static COMPONENT libraries) ++ ++INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/cuew.h ++ DESTINATION include/) +\ No newline at end of file +--- src/cuew.c 2016-04-01 13:41:43 -0600 ++++ src/cuew.c 2016-04-01 13:41:11 -0600 +@@ -15,7 +15,9 @@ + */ + + #ifdef _MSC_VER ++#if _MSC_VER < 1900 + # define snprintf _snprintf ++#endif + # define popen _popen + # define pclose _pclose + # define _CRT_SECURE_NO_WARNINGS diff --git a/build_files/build_environment/patches/distutildebugflags.diff b/build_files/build_environment/patches/distutildebugflags.diff new file mode 100644 index 00000000000..3d6b688bc53 --- /dev/null +++ b/build_files/build_environment/patches/distutildebugflags.diff @@ -0,0 +1,11 @@ +--- _msvccompiler.py.orig 2017-01-17 00:57:48 -0700 ++++ _msvccompiler.py 2017-05-20 09:47:26 -0600 +@@ -237,7 +237,7 @@ + ldflags.extend(('/nodefaultlib:libucrt.lib', 'ucrt.lib')) + + ldflags_debug = [ +- '/nologo', '/INCREMENTAL:NO', '/LTCG', '/DEBUG:FULL' ++ '/nologo', '/INCREMENTAL:NO', '/LTCG' + ] + + self.ldflags_exe = [*ldflags, '/MANIFEST:EMBED,ID=1'] diff --git a/build_files/build_environment/patches/ffmpeg.diff b/build_files/build_environment/patches/ffmpeg.diff new file mode 100644 index 00000000000..75fc6490031 --- /dev/null +++ b/build_files/build_environment/patches/ffmpeg.diff @@ -0,0 +1,32 @@ +--- libavutil/common.h 2016-02-14 19:29:42 -0700 ++++ libavutil/common.h 2016-03-30 09:50:29 -0600 +@@ -99,6 +99,11 @@ + #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) + #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + ++//msvc helper ++#ifdef _MSC_VER ++#define inline __inline ++#endif ++ + /* misc math functions */ + + #ifdef HAVE_AV_CONFIG_H +--- configure 2016-11-26 03:12:05.000000000 +0100 ++++ configure 2017-04-05 03:24:35.000000000 +0200 +@@ -1899,7 +1899,6 @@ + access + aligned_malloc + arc4random +- clock_gettime + closesocket + CommandLineToArgvW + CoTaskMemFree +@@ -5494,7 +5493,6 @@ + + check_func access + check_func_headers stdlib.h arc4random +-check_func_headers time.h clock_gettime || { check_func_headers time.h clock_gettime -lrt && add_extralibs -lrt && LIBRT="-lrt"; } + check_func fcntl + check_func fork + check_func gethrtime diff --git a/build_files/build_environment/patches/fftw3.diff b/build_files/build_environment/patches/fftw3.diff new file mode 100644 index 00000000000..48d88414045 --- /dev/null +++ b/build_files/build_environment/patches/fftw3.diff @@ -0,0 +1,25 @@ +--- config.h.in 2014-03-04 11:44:58 -0700 ++++ config.h.in 2016-03-30 11:42:49 -0600 +@@ -142,9 +142,6 @@ + /* Define to 1 if you have the `gethrtime' function. */ + #undef HAVE_GETHRTIME + +-/* Define to 1 if you have the `gettimeofday' function. */ +-#undef HAVE_GETTIMEOFDAY +- + /* Define to 1 if hrtime_t is defined in */ + #undef HAVE_HRTIME_T + +--- kernel/assert.c 2014-03-04 11:41:03 -0700 ++++ kernel/assert.c 2016-04-01 09:41:05 -0600 +@@ -24,8 +24,10 @@ + + void X(assertion_failed)(const char *s, int line, const char *file) + { ++#if 0 + fflush(stdout); + fprintf(stderr, "fftw: %s:%d: assertion failed: %s\n", file, line, s); ++#endif + #ifdef HAVE_ABORT + abort(); + #else diff --git a/build_files/build_environment/patches/hdf5.diff b/build_files/build_environment/patches/hdf5.diff new file mode 100644 index 00000000000..cb84625810d --- /dev/null +++ b/build_files/build_environment/patches/hdf5.diff @@ -0,0 +1,11 @@ +--- UserMacros.cmake ++++ UserMacros.cmake +@@ -16,6 +16,8 @@ + if (BUILD_USER_DEFINED_LIBS) + MACRO_USER_DEFINED_LIBS () + endif (BUILD_USER_DEFINED_LIBS) ++ ++include(Config/cmake/usermacros/windows_mt.cmake) + #----------------------------------------------------------------------------- + #------------------- E X A M P L E E N D ----------------------------------- + #----------------------------------------------------------------------------- diff --git a/build_files/build_environment/patches/hidapi.diff b/build_files/build_environment/patches/hidapi.diff new file mode 100644 index 00000000000..720a8ae5ae9 --- /dev/null +++ b/build_files/build_environment/patches/hidapi.diff @@ -0,0 +1,15 @@ +--- hidapi/hidapi.h 2011-10-25 20:58:16 -0600 ++++ hidapi/hidapi.h 2016-11-01 12:05:58 -0600 +@@ -30,7 +30,11 @@ + #include + + #ifdef _WIN32 +- #define HID_API_EXPORT __declspec(dllexport) ++ #ifdef HID_API_STATIC ++ #define HID_API_EXPORT ++ #else ++ #define HID_API_EXPORT __declspec(dllexport) ++ #endif + #define HID_API_CALL + #else + #define HID_API_EXPORT /**< API export macro */ diff --git a/build_files/build_environment/install_deps_patches/llvm.patch b/build_files/build_environment/patches/install_deps_llvm.diff similarity index 100% rename from build_files/build_environment/install_deps_patches/llvm.patch rename to build_files/build_environment/patches/install_deps_llvm.diff diff --git a/build_files/build_environment/install_deps_patches/osl.patch b/build_files/build_environment/patches/install_deps_osl.diff similarity index 100% rename from build_files/build_environment/install_deps_patches/osl.patch rename to build_files/build_environment/patches/install_deps_osl.diff diff --git a/build_files/build_environment/patches/libfaad.diff b/build_files/build_environment/patches/libfaad.diff new file mode 100644 index 00000000000..37605b29cd9 --- /dev/null +++ b/build_files/build_environment/patches/libfaad.diff @@ -0,0 +1,10 @@ +--- frontend/main.c 2008-09-22 11:55:09 -0600 ++++ frontend/main.c 2016-04-06 15:20:36 -0600 +@@ -31,7 +31,6 @@ + #ifdef _WIN32 + #define WIN32_LEAN_AND_MEAN + #include +-#define off_t __int64 + #else + #include + #endif diff --git a/build_files/build_environment/patches/llvm-alloca-fix.diff b/build_files/build_environment/patches/llvm-alloca-fix.diff new file mode 100644 index 00000000000..5394a472167 --- /dev/null +++ b/build_files/build_environment/patches/llvm-alloca-fix.diff @@ -0,0 +1,111 @@ +Index: lib/Target/X86/X86ISelLowering.cpp +=================================================================== +--- lib/Target/X86/X86ISelLowering.cpp 2014-04-11 23:04:44.000000000 +0200 ++++ lib/Target/X86/X86ISelLowering.cpp (working copy) +@@ -15493,12 +15493,36 @@ + // non-trivial part is impdef of ESP. + + if (Subtarget->isTargetWin64()) { ++ const char *StackProbeSymbol = ++ Subtarget->isTargetCygMing() ? "___chkstk" : "__chkstk"; ++ ++ MachineInstrBuilder MIB; ++ ++ if (getTargetMachine().getCodeModel() == CodeModel::Large) { ++ // For large code model we need to do indirect call to __chkstk. ++ ++ // R11 will be used to contain the address of __chkstk. ++ // R11 is a volotiale register and assumed to be destoyed by the callee, ++ // so there is no need to save and restore it. ++ BuildMI(*BB, MI, DL, TII->get(X86::MOV64ri), X86::R11) ++ .addExternalSymbol(StackProbeSymbol); ++ // Create a call to __chkstk function which address contained in R11. ++ MIB = BuildMI(*BB, MI, DL, TII->get(X86::CALL64r)) ++ .addReg(X86::R11, RegState::Kill); ++ ++ } else { ++ ++ // For non-large code model we can do direct call to __chkstk. ++ ++ MIB = BuildMI(*BB, MI, DL, TII->get(X86::W64ALLOCA)) ++ .addExternalSymbol(StackProbeSymbol); ++ } ++ + if (Subtarget->isTargetCygMing()) { + // ___chkstk(Mingw64): + // Clobbers R10, R11, RAX and EFLAGS. + // Updates RSP. +- BuildMI(*BB, MI, DL, TII->get(X86::W64ALLOCA)) +- .addExternalSymbol("___chkstk") ++ MIB + .addReg(X86::RAX, RegState::Implicit) + .addReg(X86::RSP, RegState::Implicit) + .addReg(X86::RAX, RegState::Define | RegState::Implicit) +@@ -15507,8 +15531,7 @@ + } else { + // __chkstk(MSVCRT): does not update stack pointer. + // Clobbers R10, R11 and EFLAGS. +- BuildMI(*BB, MI, DL, TII->get(X86::W64ALLOCA)) +- .addExternalSymbol("__chkstk") ++ MIB + .addReg(X86::RAX, RegState::Implicit) + .addReg(X86::EFLAGS, RegState::Define | RegState::Implicit); + // RAX has the offset to be subtracted from RSP. +Index: lib/Target/X86/X86FrameLowering.cpp +=================================================================== +--- lib/Target/X86/X86FrameLowering.cpp 2013-10-24 01:37:01.000000000 +0200 ++++ lib/Target/X86/X86FrameLowering.cpp (working copy) +@@ -635,25 +635,49 @@ + .addReg(X86::EAX, RegState::Kill) + .setMIFlag(MachineInstr::FrameSetup); + } ++ ++ MachineInstrBuilder MIB; + + if (Is64Bit) { ++ + // Handle the 64-bit Windows ABI case where we need to call __chkstk. + // Function prologue is responsible for adjusting the stack pointer. + BuildMI(MBB, MBBI, DL, TII.get(X86::MOV64ri), X86::RAX) + .addImm(NumBytes) + .setMIFlag(MachineInstr::FrameSetup); ++ ++ if (TM.getCodeModel() == CodeModel::Large) { ++ // For large code model we need to do indirect call to __chkstk. ++ ++ ++ // R11 will be used to contain the address of __chkstk. ++ // R11 is a volotiale register and assumed to be destoyed by the callee, ++ // so there is no need to save and restore it. ++ BuildMI(MBB, MBBI, DL, TII.get(X86::MOV64ri), X86::R11) ++ .addExternalSymbol(StackProbeSymbol); ++ // Create a call to __chkstk function which address contained in R11. ++ MIB = BuildMI(MBB, MBBI, DL, TII.get(X86::CALL64r)) ++ .addReg(X86::R11, RegState::Kill); ++ } else { ++ ++ // For non-large code model we can do direct call to __chkstk. ++ ++ MIB = BuildMI(MBB, MBBI, DL, TII.get(X86::W64ALLOCA)) ++ .addExternalSymbol(StackProbeSymbol); ++ } + } else { + // Allocate NumBytes-4 bytes on stack in case of isEAXAlive. + // We'll also use 4 already allocated bytes for EAX. + BuildMI(MBB, MBBI, DL, TII.get(X86::MOV32ri), X86::EAX) + .addImm(isEAXAlive ? NumBytes - 4 : NumBytes) + .setMIFlag(MachineInstr::FrameSetup); ++ ++ MIB = BuildMI(MBB, MBBI, DL, TII.get(X86::CALLpcrel32)) ++ .addExternalSymbol(StackProbeSymbol); + } + +- BuildMI(MBB, MBBI, DL, +- TII.get(Is64Bit ? X86::W64ALLOCA : X86::CALLpcrel32)) +- .addExternalSymbol(StackProbeSymbol) +- .addReg(StackPtr, RegState::Define | RegState::Implicit) ++ ++ MIB.addReg(StackPtr, RegState::Define | RegState::Implicit) + .addReg(X86::EFLAGS, RegState::Define | RegState::Implicit) + .setMIFlag(MachineInstr::FrameSetup); + diff --git a/build_files/build_environment/patches/ming32sh.cmd b/build_files/build_environment/patches/ming32sh.cmd new file mode 100644 index 00000000000..3259d9d3714 --- /dev/null +++ b/build_files/build_environment/patches/ming32sh.cmd @@ -0,0 +1,7 @@ +@title MinGW-w64 32-bit GCC build environment + +@echo Setting up environment for MinGW-w64 GCC 32-bit... + +@set PATH=%CD%\bin;%CD%\msys\1.0\bin;%cd%\..\..\perl32\site\bin;%cd%\..\..\perl32\bin;%cd%\..\..\c\bin;%PATH% + + diff --git a/build_files/build_environment/patches/ming64sh.cmd b/build_files/build_environment/patches/ming64sh.cmd new file mode 100644 index 00000000000..18fea3829f3 --- /dev/null +++ b/build_files/build_environment/patches/ming64sh.cmd @@ -0,0 +1,7 @@ +@title MinGW-w64 64-bit GCC build environment + +@echo Setting up environment for MinGW-w64 GCC 64-bit... + +@set PATH=%CD%\bin;%CD%\msys\1.0\bin;%cd%\..\..\perl\site\bin;%cd%\..\..\perl\bin;%cd%\..\..\c\bin;%PATH% + + diff --git a/build_files/build_environment/patches/numpy.diff b/build_files/build_environment/patches/numpy.diff new file mode 100644 index 00000000000..c4c57222838 --- /dev/null +++ b/build_files/build_environment/patches/numpy.diff @@ -0,0 +1,23 @@ +diff -Naur numpy-1.11.1/numpy/distutils/ccompiler.py numpy-1.11.1/numpy/distutils/ccompiler.py +--- numpy-1.11.1/numpy/distutils/ccompiler.py 2016-06-25 08:38:34 -0600 ++++ numpy-1.11.1/numpy/distutils/ccompiler.py 2016-08-04 12:33:43 -0600 +@@ -29,6 +29,7 @@ + + # Using customized CCompiler.spawn. + def CCompiler_spawn(self, cmd, display=None): ++ cmd = quote_args(cmd) + """ + Execute a command in a sub-process. + +diff -Naur numpy-1.11.1/numpy/distutils/misc_util.py numpy-1.11.1/numpy/distutils/misc_util.py +--- numpy-1.11.1/numpy/distutils/misc_util.py 2016-06-25 08:38:34 -0600 ++++ numpy-1.11.1/numpy/distutils/misc_util.py 2016-08-04 12:34:56 -0600 +@@ -116,7 +116,7 @@ + args = list(args) + for i in range(len(args)): + a = args[i] +- if ' ' in a and a[0] not in '"\'': ++ if ' ' in a and a[0] not in '"\'' and a[len(a)-1] not in '"\'': + args[i] = '"%s"' % (a) + return args + diff --git a/build_files/build_environment/patches/opencollada.diff b/build_files/build_environment/patches/opencollada.diff new file mode 100644 index 00000000000..0c91b4151fe Binary files /dev/null and b/build_files/build_environment/patches/opencollada.diff differ diff --git a/build_files/build_environment/patches/opencolorio.diff b/build_files/build_environment/patches/opencolorio.diff new file mode 100644 index 00000000000..4e947d89097 --- /dev/null +++ b/build_files/build_environment/patches/opencolorio.diff @@ -0,0 +1,21 @@ +diff -ru ./CMakeLists.txt ./CMakeLists.txt +--- ./CMakeLists.txt 2014-09-11 21:08:18.000000000 +0200 ++++ ./CMakeLists.txt 2016-05-15 17:17:01.000000000 +0200 +@@ -186,7 +186,7 @@ + PATCH_COMMAND patch -f -p1 < ${CMAKE_SOURCE_DIR}/ext/tinyxml_${TINYXML_VERSION}.patch + BINARY_DIR ext/build/tinyxml + INSTALL_DIR ext/dist +- CMAKE_ARGS ${TINYXML_CMAKE_ARGS} ++ CMAKE_ARGS ${TINYXML_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} -DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG} -DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE} -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + ) + if(WIN32) + set(TINYXML_STATIC_LIBRARIES ${PROJECT_BINARY_DIR}/ext/dist/lib/tinyxml.lib) +@@ -254,7 +254,7 @@ + BINARY_DIR ext/build/yaml-cpp + PATCH_COMMAND patch -p1 < ${CMAKE_SOURCE_DIR}/ext/yaml-cpp-${YAML_CPP_VERSION}.patch + INSTALL_DIR ext/dist +- CMAKE_ARGS ${YAML_CPP_CMAKE_ARGS} ++ CMAKE_ARGS ${YAML_CPP_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} -DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} -DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG} -DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE} -DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} + ) + set(YAML_CPP_INCLUDE_DIRS ${PROJECT_BINARY_DIR}/ext/dist/include) + set(YAML_CPP_LIBRARY_DIRS ${PROJECT_BINARY_DIR}/ext/dist/lib) diff --git a/build_files/build_environment/patches/openexr.diff b/build_files/build_environment/patches/openexr.diff new file mode 100644 index 00000000000..ec18751fe74 --- /dev/null +++ b/build_files/build_environment/patches/openexr.diff @@ -0,0 +1,33 @@ +--- IlmImf/CMakeLists.txt 2014-08-10 06:23:56.000000000 +0200 ++++ IlmImf/CMakeLists.txt 2017-01-08 04:06:04.931723800 +0100 +@@ -8,8 +8,8 @@ + + TARGET_LINK_LIBRARIES ( b44ExpLogTable + Half +- Iex${ILMBASE_LIBSUFFIX} + IlmThread${ILMBASE_LIBSUFFIX} ++ Iex${ILMBASE_LIBSUFFIX} + ${PTHREAD_LIB} + ) + +@@ -25,8 +25,8 @@ + + TARGET_LINK_LIBRARIES ( dwaLookups + Half +- Iex${ILMBASE_LIBSUFFIX} + IlmThread${ILMBASE_LIBSUFFIX} ++ Iex${ILMBASE_LIBSUFFIX} + ${PTHREAD_LIB} + ) + +@@ -138,9 +138,9 @@ + + TARGET_LINK_LIBRARIES ( IlmImf + Half +- Iex${ILMBASE_LIBSUFFIX} + Imath${ILMBASE_LIBSUFFIX} + IlmThread${ILMBASE_LIBSUFFIX} ++ Iex${ILMBASE_LIBSUFFIX} + ${PTHREAD_LIB} ${ZLIB_LIBRARIES} + ) + diff --git a/build_files/build_environment/patches/openimageio_gdi.diff b/build_files/build_environment/patches/openimageio_gdi.diff new file mode 100644 index 00000000000..af0c90638de --- /dev/null +++ b/build_files/build_environment/patches/openimageio_gdi.diff @@ -0,0 +1,26 @@ +Index: OpenImageIO/osdep.h +=================================================================== +--- OpenImageIO/osdep.h (revision 61595) ++++ OpenImageIO/osdep.h (working copy) +@@ -34,6 +34,7 @@ + # define WIN32_LEAN_AND_MEAN + # define VC_EXTRALEAN + # define NOMINMAX ++# define NOGDI + # include + #endif + +Index: OpenImageIO/platform.h +=================================================================== +--- OpenImageIO/platform.h (revision 61595) ++++ OpenImageIO/platform.h (working copy) +@@ -77,6 +77,9 @@ + # ifndef NOMINMAX + # define NOMINMAX + # endif ++# ifndef NOGDI ++# define NOGDI ++# endif + # include + #endif + diff --git a/build_files/build_environment/patches/openimageio_idiff.diff b/build_files/build_environment/patches/openimageio_idiff.diff new file mode 100644 index 00000000000..ae1884f76b5 --- /dev/null +++ b/build_files/build_environment/patches/openimageio_idiff.diff @@ -0,0 +1,13 @@ +--- idiff.cpp 2016-11-18 11:42:01 -0700 ++++ idiff.cpp 2016-11-18 11:41:25 -0700 +@@ -308,8 +308,10 @@ + // printed with three digit exponent. We change this behaviour to fit + // Linux way + #ifdef _MSC_VER ++#if _MSC_VER < 1900 + _set_output_format(_TWO_DIGIT_EXPONENT); + #endif ++#endif + std::streamsize precis = std::cout.precision(); + std::cout << " " << cr.nwarn << " pixels (" + << std::setprecision(3) << (100.0*cr.nwarn / npels) diff --git a/build_files/build_environment/patches/openimageio_staticexr.diff b/build_files/build_environment/patches/openimageio_staticexr.diff new file mode 100644 index 00000000000..7e4eee04548 --- /dev/null +++ b/build_files/build_environment/patches/openimageio_staticexr.diff @@ -0,0 +1,10 @@ +--- CMakeLists.txt 2016-11-01 01:03:44 -0600 ++++ CMakeLists.txt 2016-12-01 09:20:12 -0700 +@@ -454,7 +454,6 @@ + add_definitions (-D_CRT_NONSTDC_NO_WARNINGS) + add_definitions (-D_SCL_SECURE_NO_WARNINGS) + add_definitions (-DJAS_WIN_MSVC_BUILD) +- add_definitions (-DOPENEXR_DLL) + if (LINKSTATIC) + add_definitions (-DBoost_USE_STATIC_LIBS=1) + else () diff --git a/build_files/build_environment/patches/opensubdiv.diff b/build_files/build_environment/patches/opensubdiv.diff new file mode 100644 index 00000000000..9e9cf7ad554 --- /dev/null +++ b/build_files/build_environment/patches/opensubdiv.diff @@ -0,0 +1,16 @@ + opensubdiv/osd/d3d11VertexBuffer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/opensubdiv/osd/d3d11VertexBuffer.cpp b/opensubdiv/osd/d3d11VertexBuffer.cpp +index 603cbf4..07e7e0a 100644 +--- a/opensubdiv/osd/d3d11VertexBuffer.cpp ++++ b/opensubdiv/osd/d3d11VertexBuffer.cpp +@@ -81,7 +81,7 @@ D3D11VertexBuffer::UpdateData(const float *src, int startVertex, int numVertices + + deviceContext->Unmap(_uploadBuffer, 0); + +- D3D11_BOX srcBox = { 0, 0, 0, size, 1, 1 }; ++ D3D11_BOX srcBox = { 0, 0, 0, (UINT) size, 1, 1 }; + deviceContext->CopySubresourceRegion(_buffer, 0, 0, 0, 0, + _uploadBuffer, 0, &srcBox); + } diff --git a/build_files/build_environment/patches/openvdb.diff b/build_files/build_environment/patches/openvdb.diff new file mode 100644 index 00000000000..f3afa13ea17 --- /dev/null +++ b/build_files/build_environment/patches/openvdb.diff @@ -0,0 +1,11 @@ +diff -Naur k:\BlenderDev\lib\win64_vc12_Harvest\openVDB\/include/openvdb/math/Coord.h .\openVDB/include/openvdb/math/Coord.h +--- k:\BlenderDev\lib\win64_vc12_Harvest\openVDB\/include/openvdb/math/Coord.h 2016-03-30 15:09:49 -0600 ++++ .\openVDB/include/openvdb/math/Coord.h 2016-04-01 06:53:47 -0600 +@@ -34,6 +34,7 @@ + #include + #include "Math.h" + #include "Vec3.h" ++#define NOMINMAX + + namespace tbb { class split; } // forward declaration + diff --git a/build_files/build_environment/patches/openvdb_vc2013.diff b/build_files/build_environment/patches/openvdb_vc2013.diff new file mode 100644 index 00000000000..7dc3e476297 --- /dev/null +++ b/build_files/build_environment/patches/openvdb_vc2013.diff @@ -0,0 +1,35 @@ +--- openvdb/tree/LeafNode.h 2015-10-01 15:55:33 -0600 ++++ openvdb/tree/LeafNode.h 2016-03-26 13:12:22 -0600 +@@ -70,13 +70,14 @@ + typedef boost::shared_ptr Ptr; + typedef util::NodeMask NodeMaskType; + +- static const Index +- LOG2DIM = Log2Dim, // needed by parent nodes +- TOTAL = Log2Dim, // needed by parent nodes +- DIM = 1 << TOTAL, // dimension along one coordinate direction +- NUM_VALUES = 1 << 3 * Log2Dim, +- NUM_VOXELS = NUM_VALUES, // total number of voxels represented by this node +- SIZE = NUM_VALUES, ++ static const Index ++ LOG2DIM = Log2Dim, // needed by parent nodes ++ TOTAL = Log2Dim, // needed by parent nodes ++ DIM = 1 << TOTAL, // dimension along one coordinate direction ++ NUM_VALUES = 1 << 3 * Log2Dim, ++ NUM_VOXELS = NUM_VALUES; // total number of voxels represented by this node ++ static const Index ++ SIZE = NUM_VALUES, + LEVEL = 0; // level 0 = leaf + + /// @brief ValueConverter::Type is the type of a LeafNode having the same +--- openvdb/PlatformConfig.h 2016-03-30 15:09:49 -0600 ++++ openvdb/PlatformConfig.h 2016-04-01 07:00:38 -0600 +@@ -47,7 +47,7 @@ + #if !defined(OPENVDB_OPENEXR_STATICLIB) && !defined(OPENEXR_DLL) + #define OPENEXR_DLL + #endif +- ++ #define NOMINMAX + #endif // _WIN32 + + #endif // OPENVDB_PLATFORMCONFIG_HAS_BEEN_INCLUDED diff --git a/build_files/build_environment/patches/osl.diff b/build_files/build_environment/patches/osl.diff new file mode 100644 index 00000000000..fcb5ec4165f --- /dev/null +++ b/build_files/build_environment/patches/osl.diff @@ -0,0 +1,12 @@ +diff -Naur osl/src/external_osl/src/cmake/flexbison.cmake osl_bak/src/external_osl/src/cmake/flexbison.cmake +--- osl/src/external_osl//src/cmake/flexbison.cmake 2016-01-29 11:15:22 -0700 ++++ osl_bak/src/external_osl/src/cmake/flexbison.cmake 2016-02-29 21:26:26 -0700 +@@ -77,7 +77,7 @@ + DEPENDS ${${compiler_headers}} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) + ADD_CUSTOM_COMMAND ( OUTPUT ${flexoutputcxx} +- COMMAND ${FLEX_EXECUTABLE} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}" ++ COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXTRA_OPTIONS} -o ${flexoutputcxx} "${CMAKE_CURRENT_SOURCE_DIR}/${flexsrc}" + MAIN_DEPENDENCY ${flexsrc} + DEPENDS ${${compiler_headers}} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) diff --git a/build_files/build_environment/patches/osl_simd_oiio.diff b/build_files/build_environment/patches/osl_simd_oiio.diff new file mode 100644 index 00000000000..5062a597167 --- /dev/null +++ b/build_files/build_environment/patches/osl_simd_oiio.diff @@ -0,0 +1,14 @@ +--- CMakeLists.txt 2016-10-31 16:48:19 -0600 ++++ CMakeLists.txt 2017-04-10 10:38:48 -0600 +@@ -269,6 +269,11 @@ + add_definitions ("-DOIIO_STATIC_BUILD=1") + endif () + ++set (OIIO_NOSIMD OFF CACHE BOOL "Disable simd support in oiio") ++if (OIIO_NOSIMD) ++ add_definitions ("-DOIIO_NO_SSE=1") ++endif () ++ + if (OSL_NO_DEFAULT_TEXTURESYSTEM) + add_definitions ("-DOSL_NO_DEFAULT_TEXTURESYSTEM=1") + endif () diff --git a/build_files/build_environment/patches/pthreads.diff b/build_files/build_environment/patches/pthreads.diff new file mode 100644 index 00000000000..bbabfdc8925 --- /dev/null +++ b/build_files/build_environment/patches/pthreads.diff @@ -0,0 +1,13 @@ +--- pthread.h.orig 2012-05-26 22:16:45 -0600 ++++ pthread.h 2016-04-01 09:20:36 -0600 +@@ -109,6 +109,10 @@ + /* Include everything */ + #endif + ++#if _MSC_VER >= 1900 ++# define HAVE_STRUCT_TIMESPEC 1 ++#endif ++ + #if defined(_UWIN) + # define HAVE_STRUCT_TIMESPEC 1 + # define HAVE_SIGNAL_H 1 diff --git a/build_files/build_environment/patches/pyshell.diff b/build_files/build_environment/patches/pyshell.diff new file mode 100644 index 00000000000..7ccffe4c040 --- /dev/null +++ b/build_files/build_environment/patches/pyshell.diff @@ -0,0 +1,12 @@ +--- pyshellext.cpp.orig 2017-01-17 00:57:53 -0700 ++++ pyshellext.cpp 2017-05-20 15:21:51 -0600 +@@ -13,6 +13,9 @@ + #include + + #include "pyshellext_h.h" ++#if _MSC_VER < 1900 ++#include "pyshellext_i.c" ++#endif + + #define DDWM_UPDATEWINDOW (WM_USER+3) + diff --git a/build_files/build_environment/patches/python.diff b/build_files/build_environment/patches/python.diff new file mode 100644 index 00000000000..749a51d6972 --- /dev/null +++ b/build_files/build_environment/patches/python.diff @@ -0,0 +1,40 @@ +--- pcbuild/build.bat 2016-05-21 09:53:55 -0600 ++++ pcbuild/build.bat 2016-05-21 09:56:16 -0600 +@@ -59,6 +59,7 @@ + if "%~1"=="-h" goto Usage + if "%~1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts + if "%~1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts ++if "%~1"=="-k" (set vs_toolset=%2) & shift & shift & goto CheckOpts + if "%~1"=="-r" (set target=Rebuild) & shift & goto CheckOpts + if "%~1"=="-t" (set target=%2) & shift & shift & goto CheckOpts + if "%~1"=="-d" (set conf=Debug) & shift & goto CheckOpts +@@ -126,7 +126,7 @@ + + :Kill + echo on +-msbuild "%dir%\pythoncore.vcxproj" /t:KillPython %verbose%^ ++msbuild "%dir%\pythoncore.vcxproj" /t:KillPython %verbose% /p:PlatformToolset=%vs_toolset%^ + /p:Configuration=%conf% /p:Platform=%platf%^ + /p:KillPython=true + +@@ -95,7 +96,7 @@ + rem batch is, shall we say, "lackluster" + echo on + msbuild "%dir%pcbuild.proj" /t:%target% %parallel% %verbose%^ +- /p:Configuration=%conf% /p:Platform=%platf%^ ++ /p:Configuration=%conf% /p:Platform=%platf% /p:PlatformToolset=%vs_toolset%^ + /p:IncludeExternals=%IncludeExternals%^ + /p:IncludeSSL=%IncludeSSL% /p:IncludeTkinter=%IncludeTkinter%^ + /p:UseTestMarker=%UseTestMarker%^ + +--- pcbuild/sqlite3.vcxproj 2015-12-06 18:39:10 -0700 ++++ pcbuild/sqlite3.vcxproj 2016-11-02 09:25:56 -0600 +@@ -43,7 +43,7 @@ + + + +- DynamicLibrary ++ StaticLibrary + NotSet + + diff --git a/build_files/build_environment/patches/python_apple.diff b/build_files/build_environment/patches/python_apple.diff new file mode 100644 index 00000000000..0ca7a8d8f04 --- /dev/null +++ b/build_files/build_environment/patches/python_apple.diff @@ -0,0 +1,48 @@ +--- Modules/expat/expat_external.h 2016-12-17 06:51:30 -0500 ++++ Modules/expat/expat_external.h 2016-12-17 06:55:29 -0500 +@@ -7,9 +7,17 @@ + + /* External API definitions */ + +-/* Namespace external symbols to allow multiple libexpat version to +- co-exist. */ +-#include "pyexpatns.h" ++/* ++ ++ HACK: Fix build breakage on MacOS: ++ *** WARNING: renaming "pyexpat" since importing it failed: dlopen(build/lib.macosx-10.6-i386-3.3/pyexpat.so, 2): Symbol not found: _XML_ErrorString ++ This reverts c242a8f30806 from the python hg repo: ++ restore namespacing of pyexpat symbols (closes #19186) ++ See http://bugs.python.org/issue19186#msg214069 ++ The recommendation to include Modules/inc at first broke the Linux build... ++ So do it this way, as it was before. Needs some realignment later. ++ ++*/ + + #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) + #define XML_USE_MSC_EXTENSIONS 1 +--- pyconfig.h.in 2017-04-05 02:47:52.000000000 +0200 ++++ pyconfig.h.in 2017-04-05 02:51:33.000000000 +0200 +@@ -119,12 +119,6 @@ + /* Define to 1 if you have the `clock' function. */ + #undef HAVE_CLOCK + +-/* Define to 1 if you have the `clock_getres' function. */ +-#undef HAVE_CLOCK_GETRES +- +-/* Define to 1 if you have the `clock_gettime' function. */ +-#undef HAVE_CLOCK_GETTIME +- + /* Define if the C compiler supports computed gotos. */ + #undef HAVE_COMPUTED_GOTOS + +@@ -338,9 +332,6 @@ + /* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ + #undef HAVE_GETC_UNLOCKED + +-/* Define to 1 if you have the `getentropy' function. */ +-#undef HAVE_GETENTROPY +- + /* Define to 1 if you have the `getgrouplist' function. */ + #undef HAVE_GETGROUPLIST + diff --git a/build_files/build_environment/patches/python_runtime_vc2013.diff b/build_files/build_environment/patches/python_runtime_vc2013.diff new file mode 100644 index 00000000000..8177f735c92 --- /dev/null +++ b/build_files/build_environment/patches/python_runtime_vc2013.diff @@ -0,0 +1,13 @@ +--- _msvccompiler.py 2016-08-12 10:44:32 -0600 ++++ _msvccompiler.py 2016-08-12 10:47:29 -0600 +@@ -246,8 +246,8 @@ + ldflags = [ + '/nologo', '/INCREMENTAL:NO', '/LTCG' + ] +- if not self._vcruntime_redist: +- ldflags.extend(('/nodefaultlib:libucrt.lib', 'ucrt.lib')) ++ #if not self._vcruntime_redist: ++ # ldflags.extend(('/nodefaultlib:libucrt.lib', 'ucrt.lib')) + + ldflags_debug = [ + '/nologo', '/INCREMENTAL:NO', '/LTCG', '/DEBUG:FULL' diff --git a/build_files/build_environment/patches/schroedinger.diff b/build_files/build_environment/patches/schroedinger.diff new file mode 100644 index 00000000000..6acb35f2a7b --- /dev/null +++ b/build_files/build_environment/patches/schroedinger.diff @@ -0,0 +1,54 @@ +--- configure.orig 2012-01-22 19:06:43 -0700 ++++ configure 2016-04-06 20:00:50 -0600 +@@ -16492,10 +16492,10 @@ + HAVE_ORC=yes + fi + if test "x${HAVE_ORC}" != xyes ; then +- as_fn_error $? "orc-0.4 >= $ORC_VER is required" "$LINENO" 5 ++ $as_echo "orc-0.4 >= $ORC_VER is required" + fi + SCHRO_PKG_DEPS="$SCHRO_PKG_DEPS orc-0.4 >= $ORC_VER" +-ORCC=`$PKG_CONFIG --variable=orcc orc-0.4` ++#ORCC=`$PKG_CONFIG --variable=orcc orc-0.4` + + if test "x$cross_compiling" != xyes; then + HAVE_ORCC_TRUE= +--- Makefile.in 2012-01-22 18:06:42 -0700 ++++ Makefile.in 2016-04-06 20:30:09 -0600 +@@ -291,7 +291,7 @@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign +-SUBDIRS = schroedinger doc tools testsuite ++SUBDIRS = schroedinger doc tools + DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc + DIST_SUBDIRS = schroedinger doc tools testsuite + EXTRA_DIST = COPYING COPYING.GPL COPYING.LGPL COPYING.MIT COPYING.MPL \ + +--- schroedinger.pc.in 2011-03-21 17:08:39 -0600 ++++ schroedinger.pc.in 2016-04-08 13:30:42 -0600 +@@ -7,9 +7,9 @@ + + Name: schroedinger-@SCHRO_MAJORMINOR@ + Description: Dirac codec library +-Requires.private: @SCHRO_PKG_DEPS@ ++Requires: @SCHRO_PKG_DEPS@ + Version: @VERSION@ +-Libs: -L${libdir} -lschroedinger-@SCHRO_MAJORMINOR@ ++Libs: -L${libdir} -lschroedinger-@SCHRO_MAJORMINOR@ -lorc-0.4 + Libs.private: @PTHREAD_LIBS@ @LIBM@ + Cflags: -I${includedir} + +--- ./schroedinger/schrodecoder.c 2012-01-23 00:38:57.000000000 +0100 ++++ ./schroedinger/schrodecoder.c 2016-05-15 06:07:24.000000000 +0200 +@@ -70,8 +70,8 @@ + }; + + +-int _schro_decode_prediction_only; +-int _schro_telemetry; ++int _schro_decode_prediction_only = 0; ++int _schro_telemetry = 0; + + static void schro_decoder_x_decode_motion (SchroAsyncStage * stage); + static void schro_decoder_x_render_motion (SchroAsyncStage * stage); diff --git a/build_files/build_environment/patches/sdl.diff b/build_files/build_environment/patches/sdl.diff new file mode 100644 index 00000000000..b309d0230f3 --- /dev/null +++ b/build_files/build_environment/patches/sdl.diff @@ -0,0 +1,50 @@ +diff -ru /Users/brecht/dev/lib/deps/Downloads/SDL2-2.0.4/src/video/SDL_video.c ./src/video/SDL_video.c +--- /Users/brecht/dev/lib/deps/Downloads/SDL2-2.0.4/src/video/SDL_video.c 2016-01-02 20:56:31.000000000 +0100 ++++ ./src/video/SDL_video.c 2016-05-15 02:58:27.000000000 +0200 +@@ -137,7 +137,7 @@ + + #define FULLSCREEN_MASK (SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN) + +-#ifdef __MACOSX__ ++#if SDL_VIDEO_DRIVER_COCOA + /* Support for Mac OS X fullscreen spaces */ + extern SDL_bool Cocoa_IsWindowInFullscreenSpace(SDL_Window * window); + extern SDL_bool Cocoa_SetWindowFullscreenSpace(SDL_Window * window, SDL_bool state); +@@ -1141,7 +1141,7 @@ + if ( window->is_hiding && fullscreen ) + return 0; + +-#ifdef __MACOSX__ ++#if SDL_VIDEO_DRIVER_COCOA + /* if the window is going away and no resolution change is necessary, + do nothing, or else we may trigger an ugly double-transition + */ +@@ -2365,7 +2365,7 @@ + return SDL_FALSE; + } + +-#ifdef __MACOSX__ ++#if SDL_VIDEO_DRIVER_COCOA + if (Cocoa_IsWindowInFullscreenSpace(window)) { + return SDL_FALSE; + } +--- CMakeLists.txt.old 2016-01-02 12:56:31 -0700 ++++ CMakeLists.txt 2016-10-03 11:24:24 -0600 +@@ -609,7 +609,7 @@ + list(APPEND EXTRA_LIBS m) + endif() + +- check_library_exists(iconv iconv_open "" HAVE_LIBICONV) ++ #check_library_exists(iconv iconv_open "" HAVE_LIBICONV) + if(HAVE_LIBICONV) + list(APPEND EXTRA_LIBS iconv) + set(HAVE_ICONV 1) +@@ -1455,7 +1455,7 @@ + set(_INSTALL_LIBS "SDL2main") + + if(SDL_SHARED) +- add_library(SDL2 SHARED ${SOURCE_FILES}) ++ add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) + if(UNIX) + set_target_properties(SDL2 PROPERTIES + VERSION ${LT_VERSION} diff --git a/build_files/build_environment/patches/semi.txt b/build_files/build_environment/patches/semi.txt new file mode 100644 index 00000000000..092bc2b0412 --- /dev/null +++ b/build_files/build_environment/patches/semi.txt @@ -0,0 +1 @@ +; diff --git a/build_files/build_environment/windows/build_deps.cmd b/build_files/build_environment/windows/build_deps.cmd new file mode 100644 index 00000000000..3e458816a5a --- /dev/null +++ b/build_files/build_environment/windows/build_deps.cmd @@ -0,0 +1,122 @@ +@echo off +if NOT "%1" == "" ( + if "%1" == "2013" ( + echo "Building for VS2013" + set VSVER=12.0 + set VSVER_SHORT=12 + set BuildDir=VS12 + goto par2 + ) + if "%1" == "2015" ( + echo "Building for VS2015" + set VSVER=14.0 + set VSVER_SHORT=14 + set BuildDir=VS14 + goto par2 + ) +) +:usage + +Echo Usage build_deps 2013/2015 x64/x86 +goto exit +:par2 +if NOT "%2" == "" ( + if "%2" == "x86" ( + echo "Building for x86" + set HARVESTROOT=Windows_vc + set ARCH=86 + if "%1" == "2013" ( + set CMAKE_BUILDER=Visual Studio 12 2013 + ) + if "%1" == "2015" ( + set CMAKE_BUILDER=Visual Studio 14 2015 + ) + goto start + ) + if "%2" == "x64" ( + echo "Building for x64" + set HARVESTROOT=Win64_vc + set ARCH=64 + if "%1" == "2013" ( + set CMAKE_BUILDER=Visual Studio 12 2013 Win64 + ) + if "%1" == "2015" ( + set CMAKE_BUILDER=Visual Studio 14 2015 Win64 + ) + goto start + ) +) +goto usage + +:start +setlocal ENABLEEXTENSIONS +set CMAKE_DEBUG_OPTIONS=-DWITH_OPTIMIZED_DEBUG=On +if "%3" == "debug" set CMAKE_DEBUG_OPTIONS=-DWITH_OPTIMIZED_DEBUG=Off + +set SOURCE_DIR=%~dp0\.. +set BUILD_DIR=%~dp0\..\..\..\..\build_windows\deps +set HARVEST_DIR=%BUILD_DIR%\output +set STAGING=%BUILD_DIR%\S + +rem for python module build +set MSSdk=1 +set DISTUTILS_USE_SDK=1 +rem for python externals source to be shared between the various archs and compilers +mkdir %SOURCE_DIR%\downloads\externals + +REM Detect MSVC Installation +if DEFINED VisualStudioVersion goto msvc_detect_finally +set VALUE_NAME=ProductDir +REM Check 64 bits +set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%VSVER%\Setup\VC" +for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO set MSVC_VC_DIR=%%C +if DEFINED MSVC_VC_DIR goto msvc_detect_finally +REM Check 32 bits +set KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\%VSVER%\Setup\VC" +for /F "usebackq skip=2 tokens=1-2*" %%A IN (`REG QUERY %KEY_NAME% /v %VALUE_NAME% 2^>nul`) DO set MSVC_VC_DIR=%%C +if DEFINED MSVC_VC_DIR goto msvc_detect_finally +:msvc_detect_finally +if DEFINED MSVC_VC_DIR call "%MSVC_VC_DIR%\vcvarsall.bat" +echo on + +REM Sanity Checks +where /Q msbuild +if %ERRORLEVEL% NEQ 0 ( + echo Error: "MSBuild" command not in the PATH. + echo You must have MSVC installed and run this from the "Developer Command Prompt" + echo ^(available from Visual Studio's Start menu entry^), aborting! + goto EOF +) +where /Q cmake +if %ERRORLEVEL% NEQ 0 ( + echo Error: "CMake" command not in the PATH. + echo You must have CMake installed and added to your PATH, aborting! + goto EOF +) + +set StatusFile=%BUILD_DIR%\%1_%2.log +set path=%SOURCE_DIR%\downloads\mingw\mingw64\msys\1.0\bin\;%SOURCE_DIR%\downloads\nasm-2.12.01\;%path% +mkdir %STAGING%\%BuildDir%%ARCH%R +cd %Staging%\%BuildDir%%ARCH%R +echo %DATE% %TIME% : Start > %StatusFile% +cmake -G "%CMAKE_BUILDER%" %SOURCE_DIR% -DBUILD_MODE=Release -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ +echo %DATE% %TIME% : Release Configuration done >> %StatusFile% +msbuild /m "ll.vcxproj" /p:Configuration=Release /fl /flp:logfile=BlenderDeps_llvm.log +msbuild /m "BlenderDependencies.sln" /p:Configuration=Release /fl /flp:logfile=BlenderDeps.log +echo %DATE% %TIME% : Release Build done >> %StatusFile% +cmake --build . --target Harvest_Release_Results > Harvest_Release.txt +echo %DATE% %TIME% : Release Harvest done >> %StatusFile% +cd %BUILD_DIR% +mkdir %STAGING%\%BuildDir%%ARCH%D +cd %Staging%\%BuildDir%%ARCH%D +cmake -G "%CMAKE_BUILDER%" %SOURCE_DIR% -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=Debug -DHARVEST_TARGET=%HARVEST_DIR%/%HARVESTROOT%%VSVER_SHORT%/ %CMAKE_DEBUG_OPTIONS% +echo %DATE% %TIME% : Debug Configuration done >> %StatusFile% +msbuild /m "ll.vcxproj" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps_llvm.log +msbuild /m "BlenderDependencies.sln" /p:Configuration=Debug /fl /flp:logfile=BlenderDeps.log +echo %DATE% %TIME% : Debug Build done >> %StatusFile% +cmake --build . --target Harvest_Debug_Results> Harvest_Debug.txt +echo %DATE% %TIME% : Debug Harvest done >> %StatusFile% +cd %BUILD_DIR% + +:exit +Echo . diff --git a/build_files/build_environment/windows/buildall.cmd b/build_files/build_environment/windows/buildall.cmd new file mode 100644 index 00000000000..480be8cde44 --- /dev/null +++ b/build_files/build_environment/windows/buildall.cmd @@ -0,0 +1,10 @@ +title building 1_4 - x86_2013 +call build_deps 2013 x86 +title building 2_4 - x86_2015 +call build_deps 2015 x86 +title building 3_4 - x64_2013 +call build_deps 2013 x64 +title building 4_4 - x64_2015 +call build_deps 2015 x64 +title done! +echo done! \ No newline at end of file diff --git a/build_files/build_environment/windows/nuke.cmd b/build_files/build_environment/windows/nuke.cmd new file mode 100644 index 00000000000..68dbc8d1487 --- /dev/null +++ b/build_files/build_environment/windows/nuke.cmd @@ -0,0 +1,52 @@ +@echo off +if "%1"=="" goto EOF: +set ROOT=%~dp0\..\..\..\..\build_windows\deps + +set CurPath=%ROOT%\s\vs1264D\debug\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1264D\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1264R\release\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1264R\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\output\win64_vc12\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) + +set CurPath=%ROOT%\s\vs1464D\debug\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1464D\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1464R\release\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1464R\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\output\win64_vc14\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) + +set CurPath=%ROOT%\s\vs1286D\debug\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1286D\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1286R\release\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1286R\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\output\windows_vc12\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) + +set CurPath=%ROOT%\s\vs1486D\debug\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1486D\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1486R\release\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\s\vs1486R\build\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) +set CurPath=%ROOT%\output\windows_vc14\%1\ +if EXIST %CurPath%\nul ( echo removing "%CurPath%" && rd /s /q "%CurPath%" ) + + +:EOF + + diff --git a/release/windows/blendthumb/CMakeLists.txt b/release/windows/blendthumb/CMakeLists.txt new file mode 100644 index 00000000000..1e5f5131a36 --- /dev/null +++ b/release/windows/blendthumb/CMakeLists.txt @@ -0,0 +1,42 @@ +# ***** 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) 2006, Blender Foundation +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): Jacques Beaurain. +# +# ***** END GPL LICENSE BLOCK ***** + +#----------------------------------------------------------------------------- +cmake_minimum_required(VERSION 2.8) +project(BlendThumb) + +#Bring the headers, such as Student.h into the project +include_directories(${ZLIB_INCLUDE}) + +#Can manually add the sources using the set command as follows: +set(SOURCES src/BlenderThumb.cpp + src/BlendThumb.def + src/BlendThumb.rc + src/Dll.cpp +) + +add_library(BlendThumb SHARED ${SOURCES}) +target_link_libraries(BlendThumb ${ZLIB_LIBS}) +install (TARGETS BlendThumb DESTINATION bin) diff --git a/release/windows/blendthumb/src/BlendThumb.def b/release/windows/blendthumb/src/BlendThumb.def new file mode 100644 index 00000000000..71f9236735f --- /dev/null +++ b/release/windows/blendthumb/src/BlendThumb.def @@ -0,0 +1,5 @@ +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE \ No newline at end of file diff --git a/release/windows/blendthumb/src/BlendThumb.rc b/release/windows/blendthumb/src/BlendThumb.rc new file mode 100644 index 00000000000..5dfd416b0c5 --- /dev/null +++ b/release/windows/blendthumb/src/BlendThumb.rc @@ -0,0 +1,26 @@ +#define IDR_VERSION1 1 + +IDR_VERSION1 VERSIONINFO +FILEVERSION 1,4,0,0 +PRODUCTVERSION 2,78,0,0 +FILEOS 0x00000004 +FILETYPE 0x00000002 +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "FFFF04B0" + BEGIN + VALUE "FileVersion", "1.4\0" + VALUE "ProductVersion", "2.78\0" + VALUE "FileDescription", "Blender Thumbnail Handler\0" + VALUE "OriginalFilename", "BlendThumb.dll\0" + VALUE "ProductName", "Blender\0" + VALUE "LegalCopyright", "GPL2, 2016\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409, 0x04B0 + END +END + diff --git a/release/windows/blendthumb/src/BlenderThumb.cpp b/release/windows/blendthumb/src/BlenderThumb.cpp new file mode 100644 index 00000000000..508b9f74852 --- /dev/null +++ b/release/windows/blendthumb/src/BlenderThumb.cpp @@ -0,0 +1,324 @@ +/* + * ***** 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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include +#include // For IThumbnailProvider. +#include + +#pragma comment(lib, "shlwapi.lib") + +// this thumbnail provider implements IInitializeWithStream to enable being hosted +// in an isolated process for robustness + +class CBlendThumb : public IInitializeWithStream, public IThumbnailProvider +{ +public: + CBlendThumb() : _cRef(1), _pStream(NULL) {} + + virtual ~CBlendThumb() + { + if (_pStream) + { + _pStream->Release(); + } + } + + // IUnknown + IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv) + { + static const QITAB qit[] = + { + QITABENT(CBlendThumb, IInitializeWithStream), + QITABENT(CBlendThumb, IThumbnailProvider), + { 0 }, + }; + return QISearch(this, qit, riid, ppv); + } + + IFACEMETHODIMP_(ULONG) AddRef() + { + return InterlockedIncrement(&_cRef); + } + + IFACEMETHODIMP_(ULONG) Release() + { + ULONG cRef = InterlockedDecrement(&_cRef); + if (!cRef) + { + delete this; + } + return cRef; + } + + // IInitializeWithStream + IFACEMETHODIMP Initialize(IStream *pStream, DWORD grfMode); + + // IThumbnailProvider + IFACEMETHODIMP GetThumbnail(UINT cx, HBITMAP *phbmp, WTS_ALPHATYPE *pdwAlpha); + +private: + long _cRef; + IStream *_pStream; // provided during initialization. +}; + +HRESULT CBlendThumb_CreateInstance(REFIID riid, void **ppv) +{ + CBlendThumb *pNew = new (std::nothrow) CBlendThumb(); + HRESULT hr = pNew ? S_OK : E_OUTOFMEMORY; + if (SUCCEEDED(hr)) + { + hr = pNew->QueryInterface(riid, ppv); + pNew->Release(); + } + return hr; +} + +// IInitializeWithStream +IFACEMETHODIMP CBlendThumb::Initialize(IStream *pStream, DWORD) +{ + HRESULT hr = E_UNEXPECTED; // can only be inited once + if (_pStream == NULL) + { + // take a reference to the stream if we have not been inited yet + hr = pStream->QueryInterface(&_pStream); + } + return hr; +} + +#include +#include +#include "Wincodec.h" +const unsigned char gzip_magic[3] = { 0x1f, 0x8b, 0x08 }; + +// IThumbnailProvider +IFACEMETHODIMP CBlendThumb::GetThumbnail(UINT cx, HBITMAP *phbmp, WTS_ALPHATYPE *pdwAlpha) +{ + ULONG BytesRead; + HRESULT hr = S_FALSE; + LARGE_INTEGER SeekPos; + + // Compressed? + unsigned char in_magic[3]; + _pStream->Read(&in_magic,3,&BytesRead); + bool gzipped = true; + for ( int i=0; i < 3; i++ ) + if ( in_magic[i] != gzip_magic[i] ) + { + gzipped = false; + break; + } + + if (gzipped) + { + // Zlib inflate + z_stream stream; + stream.zalloc = Z_NULL; + stream.zfree = Z_NULL; + stream.opaque = Z_NULL; + + // Get compressed file length + SeekPos.QuadPart = 0; + _pStream->Seek(SeekPos,STREAM_SEEK_END,NULL); + + // Get compressed and uncompressed size + uLong source_size; + uLongf dest_size; + //SeekPos.QuadPart = -4; // last 4 bytes define size of uncompressed file + //ULARGE_INTEGER Tell; + //_pStream->Seek(SeekPos,STREAM_SEEK_END,&Tell); + //source_size = (uLong)Tell.QuadPart + 4; // src + //_pStream->Read(&dest_size,4,&BytesRead); // dest + dest_size = 1024*70; // thumbnail is currently always inside the first 65KB...if it moves or enlargens this line will have to change or go! + source_size = (uLong)max(SeekPos.QuadPart,dest_size); // for safety, assume no compression + + // Input + Bytef* src = new Bytef[source_size]; + stream.next_in = (Bytef*)src; + stream.avail_in = (uInt)source_size; + + // Output + Bytef* dest = new Bytef[dest_size]; + stream.next_out = (Bytef*)dest; + stream.avail_out = dest_size; + + // IStream to src + SeekPos.QuadPart = 0; + _pStream->Seek(SeekPos,STREAM_SEEK_SET,NULL); + _pStream->Read(src,source_size,&BytesRead); + + // Do the inflation + int err; + err = inflateInit2(&stream,16); // 16 means "gzip"...nice! + err = inflate(&stream, Z_FINISH); + err = inflateEnd(&stream); + + // Replace the IStream, which is read-only + _pStream->Release(); + _pStream = SHCreateMemStream(dest,dest_size); + + delete[] src; + delete[] dest; + } + + // Blender version, early out if sub 2.5 + SeekPos.QuadPart = 9; + _pStream->Seek(SeekPos,STREAM_SEEK_SET,NULL); + char version[4]; + version[3] = '\0'; + _pStream->Read(&version,3,&BytesRead); + if ( BytesRead != 3) + return E_UNEXPECTED; + int iVersion = atoi(version); + if ( iVersion < 250 ) + return S_FALSE; + + // 32 or 64 bit blend? + SeekPos.QuadPart = 7; + _pStream->Seek(SeekPos,STREAM_SEEK_SET,NULL); + + char _PointerSize; + _pStream->Read(&_PointerSize,1,&BytesRead); + + int PointerSize = _PointerSize == '_' ? 4 : 8; + int HeaderSize = 16 + PointerSize; + + // Find and read thumbnail ("TEST") block + SeekPos.QuadPart = 12; + _pStream->Seek(SeekPos,STREAM_SEEK_SET,NULL); + int BlockOffset = 12; + while ( _pStream ) + { + // Scan current block + char BlockName[5]; + BlockName[4] = '\0'; + int BlockSize = 0; + + if (_pStream->Read(BlockName,4,&BytesRead) == S_OK && _pStream->Read((void*)&BlockSize,4,&BytesRead) == S_OK) + { + if ( strcmp (BlockName,"TEST") != 0 ) + { + SeekPos.QuadPart = BlockOffset += HeaderSize + BlockSize; + _pStream->Seek(SeekPos,STREAM_SEEK_SET,NULL); + continue; + } + } + else break; // eof + + // Found the block + SeekPos.QuadPart = BlockOffset + HeaderSize; + _pStream->Seek(SeekPos,STREAM_SEEK_SET,NULL); + + int width, height; + _pStream->Read((char*)&width,4,&BytesRead); + _pStream->Read((char*)&height,4,&BytesRead); + BlockSize -= 8; + + // Isolate RGBA data + char* pRGBA = new char[BlockSize]; + _pStream->Read(pRGBA,BlockSize,&BytesRead); + + if (BytesRead != (ULONG)BlockSize) + return E_UNEXPECTED; + + // Convert to BGRA for Windows + for (int i=0; i < BlockSize; i+=4 ) + { + #define RED_BYTE pRGBA[i] + #define BLUE_BYTE pRGBA[i+2] + + char red = RED_BYTE; + RED_BYTE = BLUE_BYTE; + BLUE_BYTE = red; + } + + // Flip vertically (Blender stores it upside-down) + unsigned int LineSize = width*4; + char* FlippedImage = new char[BlockSize]; + for (int i=0; i cx || (unsigned)height > cx ) + { + float scale = 1.0f / (max(width,height) / (float)cx); + LONG NewWidth = (LONG)(width *scale); + LONG NewHeight = (LONG)(height *scale); + +#ifdef _DEBUG +#if 1 + MessageBox(0,L"Attach now",L"Debugging",MB_OK); +#endif +#endif + IWICImagingFactory *pImgFac; + hr = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pImgFac)); + + IWICBitmap* WICBmp; + hr = pImgFac->CreateBitmapFromHBITMAP(*phbmp,0,WICBitmapUseAlpha,&WICBmp); + + BITMAPINFO bmi = {}; + bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader); + bmi.bmiHeader.biWidth = NewWidth; + bmi.bmiHeader.biHeight = -NewHeight; + bmi.bmiHeader.biPlanes = 1; + bmi.bmiHeader.biBitCount = 32; + bmi.bmiHeader.biCompression = BI_RGB; + + BYTE *pBits; + HBITMAP ResizedHBmp = CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void**)&pBits, NULL, 0); + hr = ResizedHBmp ? S_OK : E_OUTOFMEMORY; + if (SUCCEEDED(hr)) + { + IWICBitmapScaler* pIScaler; + hr = pImgFac->CreateBitmapScaler(&pIScaler); + hr = pIScaler->Initialize(WICBmp,NewWidth,NewHeight,WICBitmapInterpolationModeFant); + + WICRect rect = {0, 0, NewWidth, NewHeight}; + hr = pIScaler->CopyPixels(&rect, NewWidth * 4, NewWidth * NewHeight * 4, pBits); + + if (SUCCEEDED(hr)) + { + DeleteObject(*phbmp); + *phbmp = ResizedHBmp; + } + else + DeleteObject(ResizedHBmp); + + pIScaler->Release(); + } + WICBmp->Release(); + pImgFac->Release(); + } + else + hr = S_OK; + break; + } + return hr; +} diff --git a/release/windows/blendthumb/src/Dll.cpp b/release/windows/blendthumb/src/Dll.cpp new file mode 100644 index 00000000000..09ccd34ff8e --- /dev/null +++ b/release/windows/blendthumb/src/Dll.cpp @@ -0,0 +1,277 @@ +/* + * ***** 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. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include +#include +#include // For IThumbnailProvider. +#include // For SHChangeNotify +#include + +extern HRESULT CBlendThumb_CreateInstance(REFIID riid, void **ppv); + +#define SZ_CLSID_BLENDTHUMBHANDLER L"{D45F043D-F17F-4e8a-8435-70971D9FA46D}" +#define SZ_BLENDTHUMBHANDLER L"Blender Thumbnail Handler" +const CLSID CLSID_BlendThumbHandler = { 0xd45f043d, 0xf17f, 0x4e8a, { 0x84, 0x35, 0x70, 0x97, 0x1d, 0x9f, 0xa4, 0x6d } }; + +typedef HRESULT (*PFNCREATEINSTANCE)(REFIID riid, void **ppvObject); +struct CLASS_OBJECT_INIT +{ + const CLSID *pClsid; + PFNCREATEINSTANCE pfnCreate; +}; + +// add classes supported by this module here +const CLASS_OBJECT_INIT c_rgClassObjectInit[] = +{ + { &CLSID_BlendThumbHandler, CBlendThumb_CreateInstance } +}; + + +long g_cRefModule = 0; + +// Handle the the DLL's module +HINSTANCE g_hInst = NULL; + +// Standard DLL functions +STDAPI_(BOOL) DllMain(HINSTANCE hInstance, DWORD dwReason, void *) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + g_hInst = hInstance; + DisableThreadLibraryCalls(hInstance); + } + return TRUE; +} + +STDAPI DllCanUnloadNow() +{ + // Only allow the DLL to be unloaded after all outstanding references have been released + return (g_cRefModule == 0) ? S_OK : S_FALSE; +} + +void DllAddRef() +{ + InterlockedIncrement(&g_cRefModule); +} + +void DllRelease() +{ + InterlockedDecrement(&g_cRefModule); +} + +class CClassFactory : public IClassFactory +{ +public: + static HRESULT CreateInstance(REFCLSID clsid, const CLASS_OBJECT_INIT *pClassObjectInits, size_t cClassObjectInits, REFIID riid, void **ppv) + { + *ppv = NULL; + HRESULT hr = CLASS_E_CLASSNOTAVAILABLE; + for (size_t i = 0; i < cClassObjectInits; i++) + { + if (clsid == *pClassObjectInits[i].pClsid) + { + IClassFactory *pClassFactory = new (std::nothrow) CClassFactory(pClassObjectInits[i].pfnCreate); + hr = pClassFactory ? S_OK : E_OUTOFMEMORY; + if (SUCCEEDED(hr)) + { + hr = pClassFactory->QueryInterface(riid, ppv); + pClassFactory->Release(); + } + break; // match found + } + } + return hr; + } + + CClassFactory(PFNCREATEINSTANCE pfnCreate) : _cRef(1), _pfnCreate(pfnCreate) + { + DllAddRef(); + } + + // IUnknown + IFACEMETHODIMP QueryInterface(REFIID riid, void ** ppv) + { + static const QITAB qit[] = + { + QITABENT(CClassFactory, IClassFactory), + { 0 } + }; + return QISearch(this, qit, riid, ppv); + } + + IFACEMETHODIMP_(ULONG) AddRef() + { + return InterlockedIncrement(&_cRef); + } + + IFACEMETHODIMP_(ULONG) Release() + { + long cRef = InterlockedDecrement(&_cRef); + if (cRef == 0) + { + delete this; + } + return cRef; + } + + // IClassFactory + IFACEMETHODIMP CreateInstance(IUnknown *punkOuter, REFIID riid, void **ppv) + { + return punkOuter ? CLASS_E_NOAGGREGATION : _pfnCreate(riid, ppv); + } + + IFACEMETHODIMP LockServer(BOOL fLock) + { + if (fLock) + { + DllAddRef(); + } + else + { + DllRelease(); + } + return S_OK; + } + +private: + ~CClassFactory() + { + DllRelease(); + } + + long _cRef; + PFNCREATEINSTANCE _pfnCreate; +}; + +STDAPI DllGetClassObject(REFCLSID clsid, REFIID riid, void **ppv) +{ + return CClassFactory::CreateInstance(clsid, c_rgClassObjectInit, ARRAYSIZE(c_rgClassObjectInit), riid, ppv); +} + +// A struct to hold the information required for a registry entry + +struct REGISTRY_ENTRY +{ + HKEY hkeyRoot; + PCWSTR pszKeyName; + PCWSTR pszValueName; + DWORD dwValueType; + PCWSTR pszData; +}; + +// Creates a registry key (if needed) and sets the default value of the key + +HRESULT CreateRegKeyAndSetValue(const REGISTRY_ENTRY *pRegistryEntry) +{ + HKEY hKey; + HRESULT hr = HRESULT_FROM_WIN32(RegCreateKeyExW(pRegistryEntry->hkeyRoot, pRegistryEntry->pszKeyName, + 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, NULL)); + if (SUCCEEDED(hr)) + { + // All this just to support REG_DWORD... + DWORD size; + DWORD data; + BYTE* lpData = (LPBYTE) pRegistryEntry->pszData; + switch (pRegistryEntry->dwValueType) + { + case REG_SZ: + size = ((DWORD) wcslen(pRegistryEntry->pszData) + 1) * sizeof(WCHAR); + break; + case REG_DWORD: + size = sizeof(DWORD); + data = (DWORD)pRegistryEntry->pszData; + lpData = (BYTE*)&data; + break; + default: + return E_INVALIDARG; + } + + hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, pRegistryEntry->pszValueName, 0, pRegistryEntry->dwValueType, + lpData, size )); + RegCloseKey(hKey); + } + return hr; +} + +// +// Registers this COM server +// +STDAPI DllRegisterServer() +{ + HRESULT hr; + + WCHAR szModuleName[MAX_PATH]; + + if (!GetModuleFileNameW(g_hInst, szModuleName, ARRAYSIZE(szModuleName))) + { + hr = HRESULT_FROM_WIN32(GetLastError()); + } + else + { + const REGISTRY_ENTRY rgRegistryEntries[] = + { + // RootKey KeyName ValueName ValueType Data + {HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\" SZ_CLSID_BLENDTHUMBHANDLER, NULL, REG_SZ, SZ_BLENDTHUMBHANDLER}, + {HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\" SZ_CLSID_BLENDTHUMBHANDLER L"\\InProcServer32", NULL, REG_SZ, szModuleName}, + {HKEY_CURRENT_USER, L"Software\\Classes\\CLSID\\" SZ_CLSID_BLENDTHUMBHANDLER L"\\InProcServer32", L"ThreadingModel", REG_SZ, L"Apartment"}, + {HKEY_CURRENT_USER, L"Software\\Classes\\.blend\\", L"Treatment", REG_DWORD, 0}, // doesn't appear to do anything... + {HKEY_CURRENT_USER, L"Software\\Classes\\.blend\\ShellEx\\{e357fccd-a995-4576-b01f-234630154e96}", NULL, REG_SZ, SZ_CLSID_BLENDTHUMBHANDLER}, + }; + + hr = S_OK; + for (int i = 0; i < ARRAYSIZE(rgRegistryEntries) && SUCCEEDED(hr); i++) + { + hr = CreateRegKeyAndSetValue(&rgRegistryEntries[i]); + } + } + if (SUCCEEDED(hr)) + { + // This tells the shell to invalidate the thumbnail cache. This is important because any .blend files + // viewed before registering this handler would otherwise show cached blank thumbnails. + SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL); + } + return hr; +} + +// +// Unregisters this COM server +// +STDAPI DllUnregisterServer() +{ + HRESULT hr = S_OK; + + const PCWSTR rgpszKeys[] = + { + L"Software\\Classes\\CLSID\\" SZ_CLSID_BLENDTHUMBHANDLER, + L"Software\\Classes\\.blend\\ShellEx\\{e357fccd-a995-4576-b01f-234630154e96}" + }; + + // Delete the registry entries + for (int i = 0; i < ARRAYSIZE(rgpszKeys) && SUCCEEDED(hr); i++) + { + hr = HRESULT_FROM_WIN32(RegDeleteTreeW(HKEY_CURRENT_USER, rgpszKeys[i])); + if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) + { + // If the registry entry has already been deleted, say S_OK. + hr = S_OK; + } + } + return hr; +}