diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c6108669f..5a29e6db87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,21 @@ if(CMAKE_BUILD_TYPE STREQUAL "") endif(CMAKE_BUILD_TYPE STREQUAL "") #------------------------------------------------------------------------------- +#------------------------------------------------------------------------------- +# Set default strip option. Can be set with -DCMAKE_BUILD_STRIP=TRUE/FALSE +#------------------------------------------------------------------------------- +if(NOT DEFINED CMAKE_BUILD_STRIP) + if(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_BUILD_STRIP TRUE) + message(STATUS "Enable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!") + else(CMAKE_BUILD_TYPE STREQUAL "Release") + set(CMAKE_BUILD_STRIP FALSE) + message(STATUS "Disable the stripping by default in ${CMAKE_BUILD_TYPE} build !!!") + endif(CMAKE_BUILD_TYPE STREQUAL "Release") +endif(NOT DEFINED CMAKE_BUILD_STRIP) + + #------------------------------------------------------------------------------- + # add additional project-wide include directories include_directories(${PROJECT_SOURCE_DIR}/3rdparty ${PROJECT_SOURCE_DIR}/common/include diff --git a/common/src/Utilities/CMakeLists.txt b/common/src/Utilities/CMakeLists.txt index b0d953ca6d..a2a6fead52 100644 --- a/common/src/Utilities/CMakeLists.txt +++ b/common/src/Utilities/CMakeLists.txt @@ -35,10 +35,6 @@ set(DebugFlags -g -W) -# set linker flags -set(LinkerFlags - -s) - # set optimization flags set(OptimizationFlags -falign-functions @@ -98,7 +94,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} ${LinkerFlags}) + add_definitions(${CommonFlags} ${OptimizationFlags}) endif(CMAKE_BUILD_TYPE STREQUAL Release) # variable with all sources of this library @@ -172,3 +168,8 @@ add_library(${UtilitiesName} STATIC ${UtilitiesSources} ${UtilitiesHeaders} ${Ut # link target with wx target_link_libraries(${UtilitiesName} ${wxWidgets_LIBRARIES}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${UtilitiesName} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/common/src/x86emitter/CMakeLists.txt b/common/src/x86emitter/CMakeLists.txt index ceb10d1ca7..c942b3102e 100644 --- a/common/src/x86emitter/CMakeLists.txt +++ b/common/src/x86emitter/CMakeLists.txt @@ -35,10 +35,6 @@ set(DebugFlags -W -g) -# set linker flags -set(LinkerFlags - -s) - # set optimization flags set(OptimizationFlags -falign-functions @@ -80,7 +76,6 @@ set(OptimizationFlags -ftree-vrp -funit-at-a-time) - # Debug - Build if(CMAKE_BUILD_TYPE STREQUAL Debug) @@ -99,7 +94,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} ${LinkerFlags}) + add_definitions(${CommonFlags} ${OptimizationFlags}) endif(CMAKE_BUILD_TYPE STREQUAL Release) # variable with all sources of this library @@ -155,3 +150,7 @@ add_library(${x86emitterName} STATIC ${x86emitterSources} ${x86emitterHeaders}) # link target with wx target_link_libraries(${x86emitterName} ${wxWidgets_LIBRARIES}) +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${x86emitterName} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index 86fdb1ff3d..2163460ab2 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -32,10 +32,6 @@ set(DebugFlags -W -g) -# set linker flags -set(LinkerFlags - -s) - # set optimization flags set(OptimizationFlags -falign-functions @@ -104,7 +100,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Release) set(pcsx2Name pcsx2) # add defines - add_definitions(${CommonFlags} ${OptimizationFlags} ${LinkerFlags} -DWX_PRECOMP -DNDEBUG) + add_definitions(${CommonFlags} ${OptimizationFlags} -DWX_PRECOMP -DNDEBUG) endif(CMAKE_BUILD_TYPE STREQUAL Release) # you must have both svn client executable and a source that contains svn metadata @@ -648,3 +644,7 @@ else(projectZLIB) target_link_libraries(${pcsx2Name} ${ZLIB_LIBRARIES}) endif(projectZLIB) +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${pcsx2Name} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/plugins/CDVDiso/src/CMakeLists.txt b/plugins/CDVDiso/src/CMakeLists.txt index dd491712cb..28e63d7b3c 100644 --- a/plugins/CDVDiso/src/CMakeLists.txt +++ b/plugins/CDVDiso/src/CMakeLists.txt @@ -66,4 +66,8 @@ target_link_libraries(${CDVDisoName} ${BZIP2_LIBRARIES}) # Set link flags target_link_libraries(${CDVDisoName} -m32) - + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${CDVDisoName} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/plugins/CDVDnull/CMakeLists.txt b/plugins/CDVDnull/CMakeLists.txt index 8e01d16f5c..5d588393c1 100644 --- a/plugins/CDVDnull/CMakeLists.txt +++ b/plugins/CDVDnull/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -s) + add_definitions(-Wall -fPIC -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # CDVDnull sources @@ -61,6 +61,11 @@ add_library(${CDVDnullName} SHARED ${CDVDnullHeaders} ${CDVDnullLinuxSources} ${CDVDnullLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${CDVDnullName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${CDVDnullName} PROPERTIES diff --git a/plugins/FWnull/CMakeLists.txt b/plugins/FWnull/CMakeLists.txt index ce79b4d3e7..d7508962d7 100644 --- a/plugins/FWnull/CMakeLists.txt +++ b/plugins/FWnull/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -s) + add_definitions(-Wall -fPIC -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # FWnull sources @@ -59,6 +59,11 @@ add_library(${FWnullName} SHARED ${FWnullHeaders} ${FWnullLinuxSources} ${FWnullLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${FWnullName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${FWnullName} PROPERTIES diff --git a/plugins/GSnull/CMakeLists.txt b/plugins/GSnull/CMakeLists.txt index 994af8d957..11624b70f8 100644 --- a/plugins/GSnull/CMakeLists.txt +++ b/plugins/GSnull/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -msse2 -s) + add_definitions(-Wall -fPIC -m32 -O2 -msse2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # GSnull sources @@ -81,6 +81,11 @@ add_library(${GSnullName} SHARED ${GSnullnullHeaders} ${GSnullLinuxSources} ${GSnullLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${GSnullName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${GSnullName} PROPERTIES diff --git a/plugins/PadNull/CMakeLists.txt b/plugins/PadNull/CMakeLists.txt index dda341c132..d5c917081c 100644 --- a/plugins/PadNull/CMakeLists.txt +++ b/plugins/PadNull/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -s) + add_definitions(-Wall -fPIC -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # PadNull sources @@ -67,6 +67,11 @@ add_library(${PadNullName} SHARED ${PadNullHeaders} ${PadNullLinuxSources} ${PadNullLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${PadNullName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${PadNullName} PROPERTIES diff --git a/plugins/SPU2null/CMakeLists.txt b/plugins/SPU2null/CMakeLists.txt index 711a75f04a..e891e1f6ac 100644 --- a/plugins/SPU2null/CMakeLists.txt +++ b/plugins/SPU2null/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -s) + add_definitions(-Wall -fPIC -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # SPU2null sources @@ -63,6 +63,11 @@ add_library(${SPU2nullName} SHARED ${SPU2nullHeaders} ${SPU2nullLinuxSources} ${SPU2nullLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${SPU2nullName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${SPU2nullName} PROPERTIES diff --git a/plugins/USBnull/CMakeLists.txt b/plugins/USBnull/CMakeLists.txt index c5eb1837b8..9b5a58632c 100644 --- a/plugins/USBnull/CMakeLists.txt +++ b/plugins/USBnull/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -s) + add_definitions(-Wall -fPIC -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # USBnull sources @@ -59,6 +59,11 @@ add_library(${USBnullName} SHARED ${USBnullHeaders} ${USBnullLinuxSources} ${USBnullLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${USBnullName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${USBnullName} PROPERTIES diff --git a/plugins/dev9null/CMakeLists.txt b/plugins/dev9null/CMakeLists.txt index 2771ed7d13..bd253c834e 100644 --- a/plugins/dev9null/CMakeLists.txt +++ b/plugins/dev9null/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -s) + add_definitions(-Wall -fPIC -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # dev9null sources @@ -56,6 +56,11 @@ add_library(${dev9nullName} SHARED ${dev9nullHeaders} ${dev9nullLinuxSources} ${dev9nullLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${dev9nullName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${dev9nullName} PROPERTIES diff --git a/plugins/onepad/CMakeLists.txt b/plugins/onepad/CMakeLists.txt index 7d2acee5bb..d178288ee7 100644 --- a/plugins/onepad/CMakeLists.txt +++ b/plugins/onepad/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -O2 -s) + add_definitions(-Wall -fPIC -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # onepad sources @@ -70,6 +70,11 @@ add_library(${onepadName} SHARED ${onepadHeaders} ${onepadLinuxSources} ${onepadLinuxHeaders}) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${onepadName} -s) +endif (CMAKE_BUILD_STRIP) # set output directory set_target_properties(${onepadName} PROPERTIES diff --git a/plugins/spu2-x/src/CMakeLists.txt b/plugins/spu2-x/src/CMakeLists.txt index 8ccfa59a43..8ac620e48a 100644 --- a/plugins/spu2-x/src/CMakeLists.txt +++ b/plugins/spu2-x/src/CMakeLists.txt @@ -28,7 +28,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -msse2 -s -DNDEBUG) + add_definitions(-Wall -fPIC -m32 -msse2 -DNDEBUG) endif(CMAKE_BUILD_TYPE STREQUAL Release) # spu2x sources @@ -128,3 +128,9 @@ endif(projectSoundTouch) # link target with A52 target_link_libraries(${spu2xName} a52) target_link_libraries(${spu2xName} -m32) + + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${spu2xName} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/plugins/zerogs/opengl/CMakeLists.txt b/plugins/zerogs/opengl/CMakeLists.txt index 8af4c5e00b..6187093a97 100644 --- a/plugins/zerogs/opengl/CMakeLists.txt +++ b/plugins/zerogs/opengl/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -m32 -O2 -s) + add_definitions(-Wall -m32 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # zerogs sources @@ -129,4 +129,8 @@ target_link_libraries(${zerogsName} ${X11_LIBRARIES}) # link target with X11 videomod target_link_libraries(${zerogsName} ${X11_Xxf86vm_LIB}) - + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${zerogsName} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/plugins/zeropad/CMakeLists.txt b/plugins/zeropad/CMakeLists.txt index c1288903c4..99508732d0 100644 --- a/plugins/zeropad/CMakeLists.txt +++ b/plugins/zeropad/CMakeLists.txt @@ -81,3 +81,8 @@ target_link_libraries(${zeropadName} ${SDL_LIBRARY}) # Set link flag target_link_libraries(${zeropadName} -m32) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${zeropadName} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/plugins/zerospu2/CMakeLists.txt b/plugins/zerospu2/CMakeLists.txt index b5336c4ad2..921eb98b42 100644 --- a/plugins/zerospu2/CMakeLists.txt +++ b/plugins/zerospu2/CMakeLists.txt @@ -18,7 +18,7 @@ endif(CMAKE_BUILD_TYPE STREQUAL Devel) # Release - Build if(CMAKE_BUILD_TYPE STREQUAL Release) # add defines - add_definitions(-Wall -fPIC -m32 -msse2 -O2 -s) + add_definitions(-Wall -fPIC -m32 -msse2 -O2) endif(CMAKE_BUILD_TYPE STREQUAL Release) # zerospu2 sources @@ -100,4 +100,8 @@ if(projectSoundTouch) else(projectSoundTouch) target_link_libraries(${zerospu2Name} ${SOUNDTOUCH_LIBRARIES}) endif(projectSoundTouch) - + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${zerospu2Name} -s) +endif (CMAKE_BUILD_STRIP) diff --git a/plugins/zzogl-pg/opengl/CMakeLists.txt b/plugins/zzogl-pg/opengl/CMakeLists.txt index bc157cc0cb..a8b4fb712b 100644 --- a/plugins/zzogl-pg/opengl/CMakeLists.txt +++ b/plugins/zzogl-pg/opengl/CMakeLists.txt @@ -157,3 +157,8 @@ target_link_libraries(${zzoglName} ${X11_Xxf86vm_LIB}) # Set link flag target_link_libraries(${zzoglName} -m32) + +# Linker strip option +if (CMAKE_BUILD_STRIP) + target_link_libraries(${zzoglName} -s) +endif (CMAKE_BUILD_STRIP)