Be really strict about dependencies.

The obtained binaries before and after this commit are identical (sha1sum)
when compiled in Debian/Ubuntu/Fedora/ArchLinux.
.
The linker will always pick the 32bit libraries the only thing this does is
make sure we have all the 32bit dependencies installed. Basically we avoid
detecting the 64bit libraries and telling the users the 32bit libraries were
found. We always link with 32bit libraries therefore this avoids having to
wait 5-10min to just be told -lXXX is missing.
.
The only thing really needed are
set(CMAKE_LIBRARY_ARCHITECTURE "../lib32")
set(CMAKE_LIBRARY_ARCHITECTURE ".")
.
which basically ensures we don't pick 64bit headers since
CMAKE_LIBRARY_ARCHITECTURE always gets tested first and for some reason
FindGTK2 test searches lib64 first then lib32/lib. These values are hardcoded.
Right now these arch specific headers are not used but can't say this will
always be true.
.
FIND_LIBRARY_USE_LIB64_PATHS is not needed for native builds and it's covered
by CMAKE_SYSTEM_IGNORE_PATH.
.
NOTE:
We filter out lib32 because multilib is not compatible with multiarch.
This commit is contained in:
Miguel A. Colón Vélez 2014-12-27 15:37:00 -05:00 committed by Gregory Hainaut
parent 553536f9cb
commit bed7a4f92e
2 changed files with 31 additions and 9 deletions

View File

@ -104,9 +104,6 @@ if(${PCSX2_TARGET_ARCHITECTURES} MATCHES "i386")
# - Only plugins. No package will link to them.
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
# Do not search library in /usr/lib64
SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
if (DISABLE_ADVANCE_SIMD)
set(ARCH_FLAG "-msse -msse2 -march=i686")
else()
@ -123,9 +120,6 @@ elseif(${PCSX2_TARGET_ARCHITECTURES} MATCHES "x86_64")
# x86_64 requires -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Search library in /usr/lib64 (Arch Linux)
SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
if (DISABLE_ADVANCE_SIMD)
set(ARCH_FLAG "-msse -msse2")
else()
@ -140,9 +134,6 @@ else()
# All but i386 requires -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# Do not search library in /usr/lib64
SET_PROPERTY(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS OFF)
message(FATAL_ERROR "Unsupported architecture: ${PCSX2_TARGET_ARCHITECTURES}")
endif()

View File

@ -7,6 +7,37 @@ set(CMAKE_SYSTEM_PROCESSOR i686)
set(CMAKE_C_COMPILER cc -m32)
set(CMAKE_CXX_COMPILER c++ -m32)
# cmake 2.8.5 correctly sets CMAKE_LIBRARY_ARCHITECTURE for Debian multiarch.
# Be really strict about what gets used.
if(EXISTS /usr/lib/i386-linux-gnu)
set(CMAKE_SYSTEM_IGNORE_PATH
/lib /lib64 /lib32
/usr/lib /usr/lib64 /usr/lib32
/usr/local/lib /usr/local/lib64 /usr/local/lib32)
list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib/i386-linux-gnu)
list(APPEND CMAKE_LIBRARY_PATH /usr/lib/i386-linux-gnu)
list(APPEND CMAKE_LIBRARY_PATH /lib/i386-linux-gnu)
elseif(EXISTS /usr/lib32)
set(CMAKE_SYSTEM_IGNORE_PATH
/lib /lib64
/usr/lib /usr/lib64
/usr/local/lib /usr/local/lib64)
set(CMAKE_LIBRARY_ARCHITECTURE "../lib32")
list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib32)
list(APPEND CMAKE_LIBRARY_PATH /usr/lib32)
list(APPEND CMAKE_LIBRARY_PATH /lib32)
else()
set(CMAKE_SYSTEM_IGNORE_PATH
/lib64
/usr/lib64
/usr/local/lib64)
set(CMAKE_LIBRARY_ARCHITECTURE ".")
list(APPEND CMAKE_LIBRARY_PATH /usr/local/lib)
list(APPEND CMAKE_LIBRARY_PATH /usr/lib)
list(APPEND CMAKE_LIBRARY_PATH /lib)
endif()
list(REMOVE_DUPLICATES CMAKE_LIBRARY_PATH)
# If given a CMAKE_FIND_ROOT_PATH then
# FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run)
# FIND_{LIBRARY,INCLUDE,PACKAGE} only uses the files in CMAKE_FIND_ROOT_PATH.