diff options
author | Patrick Mours <pmours@nvidia.com> | 2021-04-20 15:00:05 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2021-04-20 19:45:46 +0300 |
commit | 847579b422507917c4252ecc5c777bf5e0fc6f09 (patch) | |
tree | 6f9def3399bd8c01cb5e45d3e0eeab0406f47cca /build_files/build_environment/cmake | |
parent | f2626f14209e574eb23f115bf84a3452bfb9a89c (diff) |
Add support for building on Linux aarch64
Differential Revision: https://developer.blender.org/D10958
Diffstat (limited to 'build_files/build_environment/cmake')
-rw-r--r-- | build_files/build_environment/cmake/boost.cmake | 9 | ||||
-rw-r--r-- | build_files/build_environment/cmake/embree.cmake | 2 | ||||
-rw-r--r-- | build_files/build_environment/cmake/gmp.cmake | 26 | ||||
-rw-r--r-- | build_files/build_environment/cmake/harvest.cmake | 6 | ||||
-rw-r--r-- | build_files/build_environment/cmake/llvm.cmake | 2 | ||||
-rw-r--r-- | build_files/build_environment/cmake/opencolorio.cmake | 2 | ||||
-rw-r--r-- | build_files/build_environment/cmake/options.cmake | 8 | ||||
-rw-r--r-- | build_files/build_environment/cmake/png.cmake | 4 | ||||
-rw-r--r-- | build_files/build_environment/cmake/sse2neon.cmake | 22 | ||||
-rw-r--r-- | build_files/build_environment/cmake/ssl.cmake | 4 | ||||
-rw-r--r-- | build_files/build_environment/cmake/ssl.conf | 5 | ||||
-rw-r--r-- | build_files/build_environment/cmake/tbb.cmake | 4 | ||||
-rw-r--r-- | build_files/build_environment/cmake/versions.cmake | 23 | ||||
-rw-r--r-- | build_files/build_environment/cmake/x264.cmake | 18 |
14 files changed, 78 insertions, 57 deletions
diff --git a/build_files/build_environment/cmake/boost.cmake b/build_files/build_environment/cmake/boost.cmake index 8b36af7dc41..5170a3a123e 100644 --- a/build_files/build_environment/cmake/boost.cmake +++ b/build_files/build_environment/cmake/boost.cmake @@ -18,6 +18,12 @@ set(BOOST_ADDRESS_MODEL 64) +if(BLENDER_PLATFORM_ARM) + set(BOOST_ARCHITECTURE arm) +else() + set(BOOST_ARCHITECTURE x86) +endif() + if(WIN32) set(BOOST_TOOLSET toolset=msvc-14.1) set(BOOST_COMPILER_STRING -vc141) @@ -29,7 +35,6 @@ if(WIN32) if(BUILD_MODE STREQUAL Release) set(BOOST_HARVEST_CMD ${BOOST_HARVEST_CMD} && ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/boost/include/boost-${BOOST_VERSION_NODOTS_SHORT}/ ${HARVEST_TARGET}/boost/include/) endif() - elseif(APPLE) set(BOOST_CONFIGURE_COMMAND ./bootstrap.sh) set(BOOST_BUILD_COMMAND ./b2) @@ -93,7 +98,7 @@ ExternalProject_Add(external_boost UPDATE_COMMAND "" PATCH_COMMAND ${BOOST_PATCH_COMMAND} CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND} - BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=x86 address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install + BUILD_COMMAND ${BOOST_BUILD_COMMAND} ${BOOST_BUILD_OPTIONS} -j${MAKE_THREADS} architecture=${BOOST_ARCHITECTURE} address-model=${BOOST_ADDRESS_MODEL} link=static threading=multi ${BOOST_OPTIONS} --prefix=${LIBDIR}/boost install BUILD_IN_SOURCE 1 INSTALL_COMMAND "${BOOST_HARVEST_CMD}" ) diff --git a/build_files/build_environment/cmake/embree.cmake b/build_files/build_environment/cmake/embree.cmake index 4830630def0..cd693d766dc 100644 --- a/build_files/build_environment/cmake/embree.cmake +++ b/build_files/build_environment/cmake/embree.cmake @@ -47,7 +47,7 @@ else() set(EMBREE_BUILD_DIR) endif() -if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")) +if(BLENDER_PLATFORM_ARM) ExternalProject_Add(external_embree GIT_REPOSITORY ${EMBREE_ARM_GIT} GIT_TAG "blender-arm" diff --git a/build_files/build_environment/cmake/gmp.cmake b/build_files/build_environment/cmake/gmp.cmake index 323630a63aa..6ca81678a32 100644 --- a/build_files/build_environment/cmake/gmp.cmake +++ b/build_files/build_environment/cmake/gmp.cmake @@ -25,19 +25,12 @@ else() set(GMP_OPTIONS --enable-static --disable-shared ) endif() -if(APPLE) - if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64") - set(GMP_OPTIONS - ${GMP_OPTIONS} - --disable-assembly - ) - else() - set(GMP_OPTIONS - ${GMP_OPTIONS} - --with-pic - ) - endif() -elseif(UNIX) +if(APPLE AND NOT BLENDER_PLATFORM_ARM) + set(GMP_OPTIONS + ${GMP_OPTIONS} + --with-pic + ) +elseif(UNIX AND NOT APPLE) set(GMP_OPTIONS ${GMP_OPTIONS} --with-pic @@ -45,6 +38,13 @@ elseif(UNIX) ) endif() +if(BLENDER_PLATFORM_ARM) + set(GMP_OPTIONS + ${GMP_OPTIONS} + --disable-assembly + ) +endif() + ExternalProject_Add(external_gmp URL file://${PACKAGE_DIR}/${GMP_FILE} DOWNLOAD_DIR ${DOWNLOAD_DIR} diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 23d0dcbab7b..fc7e652a028 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -109,9 +109,9 @@ harvest(llvm/lib llvm/lib "libclang*.a") if(APPLE) harvest(openmp/lib openmp/lib "*") harvest(openmp/include openmp/include "*.h") - if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64") - harvest(sse2neon sse2neon "*.h") - endif() +endif() +if(BLENDER_PLATFORM_ARM) + harvest(sse2neon sse2neon "*.h") endif() harvest(ogg/lib ffmpeg/lib "*.a") harvest(openal/include openal/include "*.h") diff --git a/build_files/build_environment/cmake/llvm.cmake b/build_files/build_environment/cmake/llvm.cmake index f067267a416..cbb986410aa 100644 --- a/build_files/build_environment/cmake/llvm.cmake +++ b/build_files/build_environment/cmake/llvm.cmake @@ -16,7 +16,7 @@ # # ***** END GPL LICENSE BLOCK ***** -if(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64") +if(BLENDER_PLATFORM_ARM) set(LLVM_TARGETS AArch64$<SEMICOLON>ARM) else() set(LLVM_TARGETS X86) diff --git a/build_files/build_environment/cmake/opencolorio.cmake b/build_files/build_environment/cmake/opencolorio.cmake index bd03be5ebff..28c93973cf5 100644 --- a/build_files/build_environment/cmake/opencolorio.cmake +++ b/build_files/build_environment/cmake/opencolorio.cmake @@ -36,7 +36,7 @@ set(OPENCOLORIO_EXTRA_ARGS -Dyaml-cpp_ROOT=${LIBDIR}/yamlcpp ) -if(APPLE AND NOT("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "x86_64")) +if(BLENDER_PLATFORM_ARM) set(OPENCOLORIO_EXTRA_ARGS ${OPENCOLORIO_EXTRA_ARGS} -DOCIO_USE_SSE=OFF diff --git a/build_files/build_environment/cmake/options.cmake b/build_files/build_environment/cmake/options.cmake index 486b3d1a802..8930bd70fab 100644 --- a/build_files/build_environment/cmake/options.cmake +++ b/build_files/build_environment/cmake/options.cmake @@ -137,6 +137,10 @@ else() endif() set(OSX_SYSROOT ${XCODE_DEV_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk) + if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64") + set(BLENDER_PLATFORM_ARM ON) + endif() + set(PLATFORM_CFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}") set(PLATFORM_CXXFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -std=c++11 -stdlib=libc++ -arch ${CMAKE_OSX_ARCHITECTURES}") set(PLATFORM_LDFLAGS "-isysroot ${OSX_SYSROOT} -mmacosx-version-min=${OSX_DEPLOYMENT_TARGET} -arch ${CMAKE_OSX_ARCHITECTURES}") @@ -151,6 +155,10 @@ else() -DCMAKE_OSX_SYSROOT:PATH=${OSX_SYSROOT} ) else() + if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64") + set(BLENDER_PLATFORM_ARM ON) + endif() + set(PLATFORM_CFLAGS "-fPIC") set(PLATFORM_CXXFLAGS "-std=c++11 -fPIC") set(PLATFORM_LDFLAGS) diff --git a/build_files/build_environment/cmake/png.cmake b/build_files/build_environment/cmake/png.cmake index d9248b61c98..458d3a1fd98 100644 --- a/build_files/build_environment/cmake/png.cmake +++ b/build_files/build_environment/cmake/png.cmake @@ -22,8 +22,8 @@ set(PNG_EXTRA_ARGS -DPNG_STATIC=ON ) -if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")) - set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=on -DCMAKE_SYSTEM_PROCESSOR="aarch64") +if(BLENDER_PLATFORM_ARM) + set(PNG_EXTRA_ARGS ${PNG_EXTRA_ARGS} -DPNG_HARDWARE_OPTIMIZATIONS=ON -DPNG_ARM_NEON=ON -DCMAKE_SYSTEM_PROCESSOR="aarch64") endif() ExternalProject_Add(external_png diff --git a/build_files/build_environment/cmake/sse2neon.cmake b/build_files/build_environment/cmake/sse2neon.cmake index dca2d94f913..d7987fdfd2f 100644 --- a/build_files/build_environment/cmake/sse2neon.cmake +++ b/build_files/build_environment/cmake/sse2neon.cmake @@ -16,15 +16,13 @@ # # ***** END GPL LICENSE BLOCK ***** -if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")) - ExternalProject_Add(external_sse2neon - GIT_REPOSITORY ${SSE2NEON_GIT} - GIT_TAG ${SSE2NEON_GIT_HASH} - DOWNLOAD_DIR ${DOWNLOAD_DIR} - PREFIX ${BUILD_DIR}/sse2neon - CONFIGURE_COMMAND echo sse2neon - Nothing to configure - BUILD_COMMAND echo sse2neon - nothing to build - INSTALL_COMMAND mkdir -p ${LIBDIR}/sse2neon && cp ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon - INSTALL_DIR ${LIBDIR}/sse2neon - ) -endif() +ExternalProject_Add(external_sse2neon + GIT_REPOSITORY ${SSE2NEON_GIT} + GIT_TAG ${SSE2NEON_GIT_HASH} + DOWNLOAD_DIR ${DOWNLOAD_DIR} + PREFIX ${BUILD_DIR}/sse2neon + CONFIGURE_COMMAND echo sse2neon - Nothing to configure + BUILD_COMMAND echo sse2neon - nothing to build + INSTALL_COMMAND mkdir -p ${LIBDIR}/sse2neon && cp ${BUILD_DIR}/sse2neon/src/external_sse2neon/sse2neon.h ${LIBDIR}/sse2neon + INSTALL_DIR ${LIBDIR}/sse2neon +) diff --git a/build_files/build_environment/cmake/ssl.cmake b/build_files/build_environment/cmake/ssl.cmake index 4426cc876c6..615b88167ec 100644 --- a/build_files/build_environment/cmake/ssl.cmake +++ b/build_files/build_environment/cmake/ssl.cmake @@ -22,7 +22,9 @@ set(SSL_PATCH_CMD echo .) if(APPLE) set(SSL_OS_COMPILER "blender-darwin-${CMAKE_OSX_ARCHITECTURES}") else() - if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + if(BLENDER_PLATFORM_ARM) + set(SSL_OS_COMPILER "blender-linux-aarch64") + elseif("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") set(SSL_EXTRA_ARGS enable-ec_nistp_64_gcc_128) set(SSL_OS_COMPILER "blender-linux-x86_64") else() diff --git a/build_files/build_environment/cmake/ssl.conf b/build_files/build_environment/cmake/ssl.conf index 8a9c9dcab4c..fa59bcf2825 100644 --- a/build_files/build_environment/cmake/ssl.conf +++ b/build_files/build_environment/cmake/ssl.conf @@ -8,6 +8,11 @@ my %targets = ( inherit_from => [ "linux-x86_64" ], cflags => add("-fPIC"), }, + "blender-linux-aarch64" => { + inherit_from => [ "linux-aarch64" ], + cxxflags => add("-fPIC"), + cflags => add("-fPIC"), + }, "blender-darwin-x86_64" => { inherit_from => [ "darwin64-x86_64-cc" ], cflags => add("-fPIC"), diff --git a/build_files/build_environment/cmake/tbb.cmake b/build_files/build_environment/cmake/tbb.cmake index b006898e6fd..44307cd2afb 100644 --- a/build_files/build_environment/cmake/tbb.cmake +++ b/build_files/build_environment/cmake/tbb.cmake @@ -21,6 +21,7 @@ if(WIN32) -DTBB_BUILD_TBBMALLOC=On -DTBB_BUILD_TBBMALLOC_PROXY=On -DTBB_BUILD_STATIC=Off + -DTBB_BUILD_TESTS=Off ) set(TBB_LIBRARY tbb) set(TBB_STATIC_LIBRARY Off) @@ -30,6 +31,7 @@ else() -DTBB_BUILD_TBBMALLOC=On -DTBB_BUILD_TBBMALLOC_PROXY=Off -DTBB_BUILD_STATIC=On + -DTBB_BUILD_TESTS=Off ) set(TBB_LIBRARY tbb_static) set(TBB_STATIC_LIBRARY On) @@ -42,7 +44,7 @@ ExternalProject_Add(external_tbb URL_HASH ${TBB_HASH_TYPE}=${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/vs2013/version_string.ver ${BUILD_DIR}/tbb/src/external_tbb/src/tbb/version_string.ver && + ${CMAKE_COMMAND} -E copy ${BUILD_DIR}/tbb/src/external_tbb/build/vs2013/version_string.ver ${BUILD_DIR}/tbb/src/external_tbb/build/version_string.ver.in && ${PATCH_CMD} -p 1 -d ${BUILD_DIR}/tbb/src/external_tbb < ${PATCH_DIR}/tbb.diff 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/versions.cmake b/build_files/build_environment/cmake/versions.cmake index 97da5d54d48..83e438614b6 100644 --- a/build_files/build_environment/cmake/versions.cmake +++ b/build_files/build_environment/cmake/versions.cmake @@ -152,7 +152,7 @@ set(OPENCOLORIO_HASH 1a2e3478b6cd9a1549f24e1b2205e3f0) set(OPENCOLORIO_HASH_TYPE MD5) set(OPENCOLORIO_FILE OpenColorIO-${OPENCOLORIO_VERSION}.tar.gz) -if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")) +if(BLENDER_PLATFORM_ARM) # Newer version required by ISPC with arm support. set(LLVM_VERSION 11.0.1) set(LLVM_URI https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz) @@ -398,11 +398,20 @@ set(LZMA_HASH 5117f930900b341493827d63aa910ff5e011e0b994197c3b71c08a20228a42df) set(LZMA_HASH_TYPE SHA256) set(LZMA_FILE xz-${LZMA_VERSION}.tar.bz2) -set(SSL_VERSION 1.1.1g) -set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz) -set(SSL_HASH ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46) -set(SSL_HASH_TYPE SHA256) -set(SSL_FILE openssl-${SSL_VERSION}.tar.gz) +if(BLENDER_PLATFORM_ARM) + # Need at least 1.1.1i for aarch64 support (https://github.com/openssl/openssl/pull/13218) + set(SSL_VERSION 1.1.1i) + set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz) + set(SSL_HASH e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242) + set(SSL_HASH_TYPE SHA256) + set(SSL_FILE openssl-${SSL_VERSION}.tar.gz) +else() + set(SSL_VERSION 1.1.1g) + set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz) + set(SSL_HASH ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46) + set(SSL_HASH_TYPE SHA256) + set(SSL_FILE openssl-${SSL_VERSION}.tar.gz) +endif() set(SQLITE_VERSION 3.31.1) set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip) @@ -453,7 +462,7 @@ set(XR_OPENXR_SDK_HASH 0df6b2fd6045423451a77ff6bc3e1a75) set(XR_OPENXR_SDK_HASH_TYPE MD5) set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz) -if(APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")) +if(BLENDER_PLATFORM_ARM) # Unreleased version with macOS arm support. set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip) set(ISPC_HASH d382fea18d01dbd0cd05d9e1ede36d7d) diff --git a/build_files/build_environment/cmake/x264.cmake b/build_files/build_environment/cmake/x264.cmake index a32f119d184..08d698cc3ad 100644 --- a/build_files/build_environment/cmake/x264.cmake +++ b/build_files/build_environment/cmake/x264.cmake @@ -20,24 +20,16 @@ if(WIN32) set(X264_EXTRA_ARGS --enable-win32thread --cross-prefix=${MINGW_HOST}- --host=${MINGW_HOST}) endif() - -if(APPLE) - if("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64") - set(X264_EXTRA_ARGS ${X264_EXTRA_ARGS} "--disable-asm") - set(X264_CONFIGURE_ENV echo .) - else() - set(X264_CONFIGURE_ENV - export AS=${LIBDIR}/nasm/bin/nasm - ) - endif() -else() - set(X264_CONFIGURE_ENV echo .) +if(BLENDER_PLATFORM_ARM) + set(X264_EXTRA_ARGS ${X264_EXTRA_ARGS} "--disable-asm") endif() -if(UNIX AND NOT APPLE) +if((APPLE AND NOT BLENDER_PLATFORM_ARM) OR (UNIX AND NOT APPLE)) set(X264_CONFIGURE_ENV export AS=${LIBDIR}/nasm/bin/nasm ) +else() + set(X264_CONFIGURE_ENV echo .) endif() ExternalProject_Add(external_x264 |