From 9baed432c97ac7a54ccf23c73a494a14ac4a3993 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 16 May 2010 00:36:42 +0000 Subject: [PATCH] cmake: A bunch of 32 bit/64 bit stuff. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3022 96395faa-99c1-11dd-bbfe-3dabce05a288 --- 3rdparty/SoundTouch/CMakeLists.txt | 2 ++ 3rdparty/bzip2/CMakeLists.txt | 2 ++ 3rdparty/liba52/CMakeLists.txt | 5 ++++- 3rdparty/zlib/CMakeLists.txt | 3 +++ CMakeLists.txt | 18 ++++++++++++++++++ cmake/SearchForStuff.cmake | 5 +++++ common/src/Utilities/CMakeLists.txt | 4 +++- common/src/x86emitter/CMakeLists.txt | 3 +++ pcsx2/CMakeLists.txt | 3 +++ plugins/CDVDiso/src/CMakeLists.txt | 2 +- plugins/CDVDnull/CMakeLists.txt | 3 +++ plugins/FWnull/CMakeLists.txt | 3 +++ plugins/GSnull/CMakeLists.txt | 3 +++ plugins/PadNull/CMakeLists.txt | 3 +++ plugins/SPU2null/CMakeLists.txt | 4 ++++ plugins/USBnull/CMakeLists.txt | 3 +++ plugins/dev9null/CMakeLists.txt | 3 +++ plugins/onepad/CMakeLists.txt | 3 +++ plugins/spu2-x/src/CMakeLists.txt | 3 ++- plugins/zerogs/opengl/CMakeLists.txt | 3 +++ plugins/zeropad/CMakeLists.txt | 2 +- plugins/zerospu2/CMakeLists.txt | 3 +++ plugins/zzogl-pg/opengl/CMakeLists.txt | 6 +++--- 23 files changed, 81 insertions(+), 8 deletions(-) diff --git a/3rdparty/SoundTouch/CMakeLists.txt b/3rdparty/SoundTouch/CMakeLists.txt index 13c24bdf29..1faefb3191 100644 --- a/3rdparty/SoundTouch/CMakeLists.txt +++ b/3rdparty/SoundTouch/CMakeLists.txt @@ -51,3 +51,5 @@ set(SoundTouchHeaders # add library add_library(${SoundTouchName} STATIC ${SoundTouchSources} ${SoundTouchHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${SoundTouchName} -m32) diff --git a/3rdparty/bzip2/CMakeLists.txt b/3rdparty/bzip2/CMakeLists.txt index 55bf0d4bc1..6a33cb1980 100644 --- a/3rdparty/bzip2/CMakeLists.txt +++ b/3rdparty/bzip2/CMakeLists.txt @@ -39,3 +39,5 @@ set(bzip2Headers # add library add_library(${bzip2Name} STATIC ${bzip2Sources} ${bzip2Headers}) +# Force the linker into 32 bits mode +target_link_libraries(${bzip2Name} -m32) diff --git a/3rdparty/liba52/CMakeLists.txt b/3rdparty/liba52/CMakeLists.txt index a7f3b77114..cf65b5d41c 100644 --- a/3rdparty/liba52/CMakeLists.txt +++ b/3rdparty/liba52/CMakeLists.txt @@ -42,4 +42,7 @@ set(a52Headers tendra.h) # add library -add_library(${a52Name} STATIC ${a52Sources} ${a52Headers}) +add_library(${a52Name} STATIC ${a52Sources} ${a52Headers}) + +# Force the linker into 32 bits mode +target_link_libraries(${a52Name} -m32) diff --git a/3rdparty/zlib/CMakeLists.txt b/3rdparty/zlib/CMakeLists.txt index 2eabf306a7..645b4564c7 100644 --- a/3rdparty/zlib/CMakeLists.txt +++ b/3rdparty/zlib/CMakeLists.txt @@ -56,3 +56,6 @@ inftrees.h ) # add library add_library(${zlibName} STATIC ${zlibSources} ${zlibHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${zlibName} -m32) + diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a29e6db87..ffc10b1937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,24 @@ project(Pcsx2) # need cmake version >=2.6 cmake_minimum_required(VERSION 2.6) +#------------------------------------------------------------------------------- +# Detect the 32bit/64bit and set the 32bit library path 32_LD_LIBRARY_PATH +#------------------------------------------------------------------------------- +if (UNIX) + if (CMAKE_SIZEOF_VOID_P MATCHES "8") + # 64 bits machine + if (EXISTS /usr/lib32) + # 32 bits library in /usr/lib32 + set(32_LD_LIBRARY_PATH /usr/lib32) + else (EXISTS /usr/lib32) + set(32_LD_LIBRARY_PATH /usr/lib) + endif (EXISTS /usr/lib32) + else (CMAKE_SIZEOF_VOID_P MATCHES "8") + # 32 bits machine + set(32_LD_LIBRARY_PATH /usr/lib) + endif (CMAKE_SIZEOF_VOID_P MATCHES "8") +endif (UNIX) + # set module path set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 64892fe0c4..8696f5c011 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -42,6 +42,11 @@ find_package(wxWidgets REQUIRED base core adv) # wx found if(wxWidgets_FOUND) + if(Linux) # Linux only + # Force the use of 32 bit library + STRING(REGEX REPLACE "/usr/lib/wx" "${32_LD_LIBRARY_PATH}/wx" + wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}") + endif(Linux) include(${wxWidgets_USE_FILE}) #else(wxWidgets_FOUND) # message(FATAL_ERROR "wxWidgets libraries and include files not found.\ diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index a2a6fead52..0a7c77f0b4 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -167,8 +167,10 @@ add_library(${UtilitiesName} STATIC ${UtilitiesSources} ${UtilitiesHeaders} ${Ut # link target with wx target_link_libraries(${UtilitiesName} ${wxWidgets_LIBRARIES}) - +# Force the linker into 32 bits mode +target_link_libraries(${UtilitiesName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${UtilitiesName} -s) diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt index c942b3102e..fa82e83f19 100644 --- a/common/src/x86emitter/CMakeLists.txt +++ b/common/src/x86emitter/CMakeLists.txt @@ -150,6 +150,9 @@ add_library(${x86emitterName} STATIC ${x86emitterSources} ${x86emitterHeaders}) # link target with wx target_link_libraries(${x86emitterName} ${wxWidgets_LIBRARIES}) +# Force the linker into 32 bits mode +target_link_libraries(${x86emitterName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${x86emitterName} -s) diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 2163460ab2..341ab592fe 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -644,6 +644,9 @@ else(projectZLIB) target_link_libraries(${pcsx2Name} ${ZLIB_LIBRARIES}) endif(projectZLIB) +# Force the linker into 32 bits mode +target_link_libraries(${pcsx2Name} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${pcsx2Name} -s) diff --git a/plugins/CDVDiso/src/CMakeLists.txt b/plugins/CDVDiso/src/CMakeLists.txt index 28e63d7b3c..9a161bd5f6 100644 --- a/plugins/CDVDiso/src/CMakeLists.txt +++ b/plugins/CDVDiso/src/CMakeLists.txt @@ -64,7 +64,7 @@ set_target_properties(${CDVDisoName} PROPERTIES # Link with bz2 target_link_libraries(${CDVDisoName} ${BZIP2_LIBRARIES}) -# Set link flags +# Force the linker into 32 bits mode target_link_libraries(${CDVDisoName} -m32) # Linker strip option diff --git a/plugins/CDVDnull/CMakeLists.txt b/plugins/CDVDnull/CMakeLists.txt index 5d588393c1..c61789e81d 100644 --- a/plugins/CDVDnull/CMakeLists.txt +++ b/plugins/CDVDnull/CMakeLists.txt @@ -62,6 +62,9 @@ add_library(${CDVDnullName} SHARED ${CDVDnullLinuxSources} ${CDVDnullLinuxHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${CDVDnullName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${CDVDnullName} -s) diff --git a/plugins/FWnull/CMakeLists.txt b/plugins/FWnull/CMakeLists.txt index d7508962d7..d8a43729a4 100644 --- a/plugins/FWnull/CMakeLists.txt +++ b/plugins/FWnull/CMakeLists.txt @@ -60,6 +60,9 @@ add_library(${FWnullName} SHARED ${FWnullLinuxSources} ${FWnullLinuxHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${FWnullName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${FWnullName} -s) diff --git a/plugins/GSnull/CMakeLists.txt b/plugins/GSnull/CMakeLists.txt index 11624b70f8..fbd33a8e5e 100644 --- a/plugins/GSnull/CMakeLists.txt +++ b/plugins/GSnull/CMakeLists.txt @@ -82,6 +82,9 @@ add_library(${GSnullName} SHARED ${GSnullLinuxSources} ${GSnullLinuxHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${GSnullName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${GSnullName} -s) diff --git a/plugins/PadNull/CMakeLists.txt b/plugins/PadNull/CMakeLists.txt index d5c917081c..66ef8c414b 100644 --- a/plugins/PadNull/CMakeLists.txt +++ b/plugins/PadNull/CMakeLists.txt @@ -68,6 +68,9 @@ add_library(${PadNullName} SHARED ${PadNullLinuxSources} ${PadNullLinuxHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${PadNullName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${PadNullName} -s) diff --git a/plugins/SPU2null/CMakeLists.txt b/plugins/SPU2null/CMakeLists.txt index e891e1f6ac..ade0c51e2f 100644 --- a/plugins/SPU2null/CMakeLists.txt +++ b/plugins/SPU2null/CMakeLists.txt @@ -64,6 +64,10 @@ add_library(${SPU2nullName} SHARED ${SPU2nullLinuxSources} ${SPU2nullLinuxHeaders}) + +# Force the linker into 32 bits mode +target_link_libraries(${SPU2nullName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${SPU2nullName} -s) diff --git a/plugins/USBnull/CMakeLists.txt b/plugins/USBnull/CMakeLists.txt index 9b5a58632c..f1f536dd6e 100644 --- a/plugins/USBnull/CMakeLists.txt +++ b/plugins/USBnull/CMakeLists.txt @@ -60,6 +60,9 @@ add_library(${USBnullName} SHARED ${USBnullLinuxSources} ${USBnullLinuxHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${USBnullName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${USBnullName} -s) diff --git a/plugins/dev9null/CMakeLists.txt b/plugins/dev9null/CMakeLists.txt index bd253c834e..76ea157bd9 100644 --- a/plugins/dev9null/CMakeLists.txt +++ b/plugins/dev9null/CMakeLists.txt @@ -57,6 +57,9 @@ add_library(${dev9nullName} SHARED ${dev9nullLinuxSources} ${dev9nullLinuxHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${dev9nullName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${dev9nullName} -s) diff --git a/plugins/onepad/CMakeLists.txt b/plugins/onepad/CMakeLists.txt index d178288ee7..73c6a0e067 100644 --- a/plugins/onepad/CMakeLists.txt +++ b/plugins/onepad/CMakeLists.txt @@ -71,6 +71,9 @@ add_library(${onepadName} SHARED ${onepadLinuxSources} ${onepadLinuxHeaders}) +# Force the linker into 32 bits mode +target_link_libraries(${onepadName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${onepadName} -s) diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt index 8ac620e48a..8f292039c2 100644 --- a/plugins/spu2-x/src/CMakeLists.txt +++ b/plugins/spu2-x/src/CMakeLists.txt @@ -127,8 +127,9 @@ endif(projectSoundTouch) # link target with A52 target_link_libraries(${spu2xName} a52) -target_link_libraries(${spu2xName} -m32) +# Force the linker into 32 bits mode +target_link_libraries(${spu2xName} -m32) # Linker strip option if (CMAKE_BUILD_STRIP) diff --git a/plugins/zerogs/opengl/CMakeLists.txt b/plugins/zerogs/opengl/CMakeLists.txt index 6187093a97..28689cebcb 100644 --- a/plugins/zerogs/opengl/CMakeLists.txt +++ b/plugins/zerogs/opengl/CMakeLists.txt @@ -130,6 +130,9 @@ target_link_libraries(${zerogsName} ${X11_LIBRARIES}) # link target with X11 videomod target_link_libraries(${zerogsName} ${X11_Xxf86vm_LIB}) +# Force the linker into 32 bits mode +target_link_libraries(${zerogsName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${zerogsName} -s) diff --git a/plugins/zeropad/CMakeLists.txt b/plugins/zeropad/CMakeLists.txt index 99508732d0..679a002a5f 100644 --- a/plugins/zeropad/CMakeLists.txt +++ b/plugins/zeropad/CMakeLists.txt @@ -79,7 +79,7 @@ set_target_properties(${zeropadName} PROPERTIES # link target with SDL target_link_libraries(${zeropadName} ${SDL_LIBRARY}) -# Set link flag +# Force the linker into 32 bits mode target_link_libraries(${zeropadName} -m32) # Linker strip option diff --git a/plugins/zerospu2/CMakeLists.txt b/plugins/zerospu2/CMakeLists.txt index 921eb98b42..b2ed22b1d5 100644 --- a/plugins/zerospu2/CMakeLists.txt +++ b/plugins/zerospu2/CMakeLists.txt @@ -101,6 +101,9 @@ else(projectSoundTouch) target_link_libraries(${zerospu2Name} ${SOUNDTOUCH_LIBRARIES}) endif(projectSoundTouch) +# Force the linker into 32 bits mode +target_link_libraries(${zerospu2Name} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${zerospu2Name} -s) diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt index a8b4fb712b..49e3131a74 100644 --- a/plugins/zzogl-pg/opengl/CMakeLists.txt +++ b/plugins/zzogl-pg/opengl/CMakeLists.txt @@ -154,10 +154,10 @@ target_link_libraries(${zzoglName} ${X11_LIBRARIES}) # link target with X11 videomod target_link_libraries(${zzoglName} ${X11_Xxf86vm_LIB}) - -# Set link flag -target_link_libraries(${zzoglName} -m32) +# Force the linker into 32 bits mode +target_link_libraries(${zzoglName} -m32) + # Linker strip option if (CMAKE_BUILD_STRIP) target_link_libraries(${zzoglName} -s)