diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-09 18:14:00 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-10-10 11:39:53 +0300 |
commit | 35c707684befb2fe823ab1bfa002b34785c31841 (patch) | |
tree | c9f950bc95f1edd6ef0e19494f8467a76a389628 /build_files/cmake/platform/platform_unix.cmake | |
parent | ea1174bde9edff7639b1b3de4989084987a29f1e (diff) |
CMake: Allow to use pre-compiled CentOS libraries
The goal is to make it able to use pre-compiled CentOS libraries on a
more modern system. Main issue was that it's possible that the compiler
on a newer version is defaulting to different C++11 ABI.
This change makes it so that if there is NO native libraries in the
lib folder and there IS pre-compiled CentOS folder, it will be used and
compiler will be forced to old ABI.
Differential Revision: https://developer.blender.org/D6031
Diffstat (limited to 'build_files/cmake/platform/platform_unix.cmake')
-rw-r--r-- | build_files/cmake/platform/platform_unix.cmake | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake index 1b3f9cf3fad..e655234eb34 100644 --- a/build_files/cmake/platform/platform_unix.cmake +++ b/build_files/cmake/platform/platform_unix.cmake @@ -22,14 +22,30 @@ # Detect precompiled library directory if(NOT DEFINED LIBDIR) + # Path to a locally compiled libraries. set(LIBDIR_NAME ${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}) string(TOLOWER ${LIBDIR_NAME} LIBDIR_NAME) - set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME}) -else() - message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}") + set(LIBDIR_NATIVE_ABI ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_NAME}) + + # Path to precompiled libraries with known CentOS 7 ABI. + set(LIBDIR_CENTOS7_ABI ${CMAKE_SOURCE_DIR}/../lib/linux_centos7_x86_64) + + # Choose the best suitable libraries. + if(EXISTS ${LIBDIR_NATIVE_ABI}) + set(LIBDIR ${LIBDIR_NATIVE_ABI}) + elseif(EXISTS ${LIBDIR_CENTOS7_ABI}) + set(LIBDIR ${LIBDIR_CENTOS7_ABI}) + set(WITH_CXX11_ABI OFF) + endif() + + # Avoid namespace pollustion. + unset(LIBDIR_NATIVE_ABI) + unset(LIBDIR_CENTOS7_ABI) endif() if(EXISTS ${LIBDIR}) + message(STATUS "Using pre-compiled LIBDIR: ${LIBDIR}") + file(GLOB LIB_SUBDIRS ${LIBDIR}/*) # NOTE: Make sure "proper" compiled zlib comes first before the one # which is a part of OpenCollada. They have different ABI, and we |