cmake: git compilation issue + useless warning message

* avoid compilation failure when git -C isn't supported
* don't print missing dependency when EXTRA_PLUGINS isn't activated
* sed /endif(.*)/endif/ because I don't like it
This commit is contained in:
Gregory Hainaut 2014-04-17 20:24:12 +02:00
parent e39db3f9ad
commit c37d9c10f7
6 changed files with 74 additions and 79 deletions

View File

@ -92,7 +92,7 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
# Set some default compiler flags # Set some default compiler flags
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
set(DEFAULT_WARNINGS "-Wno-write-strings -Wno-format -Wno-unused-parameter -Wno-unused-value -Wstrict-aliasing -Wno-unused-function -Wno-attributes -Wno-unused-result -Wno-missing-field-initializers -Wno-unused-local-typedefs -Wno-parentheses") set(DEFAULT_WARNINGS "-Wno-write-strings -Wno-format -Wno-unused-parameter -Wno-unused-value -Wstrict-aliasing -Wno-unused-function -Wno-attributes -Wno-unused-result -Wno-missing-field-initializers -Wno-unused-local-typedefs -Wno-parentheses")
set (HARDEING_OPT "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security") set(HARDEING_OPT "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
set(DEFAULT_GCC_FLAG "-m32 -msse -msse2 -march=i686 -pthread ${DEFAULT_WARNINGS} ${HARDEING_OPT}") set(DEFAULT_GCC_FLAG "-m32 -msse -msse2 -march=i686 -pthread ${DEFAULT_WARNINGS} ${HARDEING_OPT}")
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel") if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
set(DEFAULT_GCC_FLAG "-g ${DEFAULT_GCC_FLAG}") set(DEFAULT_GCC_FLAG "-g ${DEFAULT_GCC_FLAG}")

View File

@ -46,7 +46,12 @@ function(write_svnrev_h)
string(REGEX REPLACE "[%:\\-]" "" tmpvar_WC_INFO "${tmpvar_WC_INFO}") string(REGEX REPLACE "[%:\\-]" "" tmpvar_WC_INFO "${tmpvar_WC_INFO}")
string(REGEX REPLACE "([0-9]+) ([0-9]+).*" "\\1\\2" tmpvar_WC_INFO "${tmpvar_WC_INFO}") string(REGEX REPLACE "([0-9]+) ([0-9]+).*" "\\1\\2" tmpvar_WC_INFO "${tmpvar_WC_INFO}")
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${tmpvar_WC_INFO}ll \n#define SVN_MODS 0") if ("${tmpvar_WC_INFO}" STREQUAL "")
# For people with an older GIT version that migth not support '-C'
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV 0ll \n#define SVN_MODS 0")
else()
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${tmpvar_WC_INFO}ll \n#define SVN_MODS 0")
endif()
else() else()
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV_UNKNOWN\n#define SVN_REV 0ll \n#define SVN_MODS 0") file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV_UNKNOWN\n#define SVN_REV 0ll \n#define SVN_MODS 0")
endif() endif()

View File

@ -18,11 +18,11 @@ if(Linux)
set(GTK2_INCLUDE_DIRS "${GDK_PIXBUF_INCLUDE_DIRS}" "${GTK2_INCLUDE_DIRS}") set(GTK2_INCLUDE_DIRS "${GDK_PIXBUF_INCLUDE_DIRS}" "${GTK2_INCLUDE_DIRS}")
# Remove duplicates when cmake will be fixed # Remove duplicates when cmake will be fixed
list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS) list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
endif (GDK_PIXBUF_INCLUDE_DIRS) endif()
endif(GTK2_FOUND) endif()
find_package(X11) find_package(X11)
endif(Linux) endif()
## Use cmake package to find module ## Use cmake package to find module
find_package(ALSA) find_package(ALSA)
@ -54,7 +54,7 @@ include(FindAio)
## Include cg because of zzogl-cg and zerogs ## Include cg because of zzogl-cg and zerogs
#if(NOT GLSL_API) #if(NOT GLSL_API)
include(FindCg) include(FindCg)
#endif(NOT GLSL_API) #endif()
include(FindEGL) include(FindEGL)
include(FindGLES2) include(FindGLES2)
include(FindGlew) include(FindGlew)
@ -80,12 +80,12 @@ include(FindSparseHash)
if(Linux) if(Linux)
if(GTK2_FOUND) if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS}) include_directories(${GTK2_INCLUDE_DIRS})
endif(GTK2_FOUND) endif()
if(X11_FOUND) if(X11_FOUND)
include_directories(${X11_INCLUDE_DIR}) include_directories(${X11_INCLUDE_DIR})
endif(X11_FOUND) endif()
endif(Linux) endif()
if(AIO_FOUND) if(AIO_FOUND)
include_directories(${AIO_INCLUDE_DIR}) include_directories(${AIO_INCLUDE_DIR})
@ -93,15 +93,15 @@ endif()
if(ALSA_FOUND) if(ALSA_FOUND)
include_directories(${ALSA_INCLUDE_DIRS}) include_directories(${ALSA_INCLUDE_DIRS})
endif(ALSA_FOUND) endif()
if(BZIP2_FOUND) if(BZIP2_FOUND)
include_directories(${BZIP2_INCLUDE_DIR}) include_directories(${BZIP2_INCLUDE_DIR})
endif(BZIP2_FOUND) endif()
if(CG_FOUND) if(CG_FOUND)
include_directories(${CG_INCLUDE_DIRS}) include_directories(${CG_INCLUDE_DIRS})
endif(CG_FOUND) endif()
if (EGL_FOUND) if (EGL_FOUND)
include_directories(${EGL_INCLUDE_DIR}) include_directories(${EGL_INCLUDE_DIR})
@ -109,11 +109,11 @@ endif()
if(JPEG_FOUND) if(JPEG_FOUND)
include_directories(${JPEG_INCLUDE_DIR}) include_directories(${JPEG_INCLUDE_DIR})
endif(JPEG_FOUND) endif()
if(GLEW_FOUND) if(GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIR}) include_directories(${GLEW_INCLUDE_DIR})
endif(GLEW_FOUND) endif()
if(GLESV2_FOUND) if(GLESV2_FOUND)
include_directories(${GLESV2_INCLUDE_DIR}) include_directories(${GLESV2_INCLUDE_DIR})
@ -121,28 +121,23 @@ endif()
if(OPENGL_FOUND) if(OPENGL_FOUND)
include_directories(${OPENGL_INCLUDE_DIR}) include_directories(${OPENGL_INCLUDE_DIR})
endif(OPENGL_FOUND) endif()
if(PORTAUDIO_FOUND) if(PORTAUDIO_FOUND)
include_directories(${PORTAUDIO_INCLUDE_DIR}) include_directories(${PORTAUDIO_INCLUDE_DIR})
endif(PORTAUDIO_FOUND) endif()
if(SDL_FOUND) if(SDL_FOUND)
include_directories(${SDL_INCLUDE_DIR}) include_directories(${SDL_INCLUDE_DIR})
endif(SDL_FOUND) endif()
if(SOUNDTOUCH_FOUND) if(SOUNDTOUCH_FOUND)
include_directories(${SOUNDTOUCH_INCLUDE_DIR}) include_directories(${SOUNDTOUCH_INCLUDE_DIR})
endif(SOUNDTOUCH_FOUND) endif()
if(SPARSEHASH_FOUND) if(SPARSEHASH_FOUND)
include_directories(${SPARSEHASH_INCLUDE_DIR}) include_directories(${SPARSEHASH_INCLUDE_DIR})
endif(SPARSEHASH_FOUND) endif()
if(SPARSEHASH_NEW_FOUND)
include_directories(${SPARSEHASH_NEW_INCLUDE_DIR})
# allow to build parts that depend on sparsehash
set(SPARSEHASH_FOUND TRUE)
endif(SPARSEHASH_NEW_FOUND)
if(wxWidgets_FOUND) if(wxWidgets_FOUND)
if(Linux) if(Linux)
@ -163,7 +158,7 @@ if(wxWidgets_FOUND)
endif (EXISTS "/usr/lib/wx") endif (EXISTS "/usr/lib/wx")
# Multiarch ubuntu/debian # Multiarch ubuntu/debian
STRING(REGEX REPLACE "/usr/lib/x86_64-linux-gnu" "/usr/lib/i386-linux-gnu" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}") STRING(REGEX REPLACE "/usr/lib/x86_64-linux-gnu" "/usr/lib/i386-linux-gnu" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
endif(CMAKE_SIZEOF_VOID_P MATCHES "8") endif()
# Some people are trying to compile with wx 3.0 ... # Some people are trying to compile with wx 3.0 ...
### 3.0 ### 3.0
@ -178,11 +173,11 @@ if(wxWidgets_FOUND)
STRING(REGEX REPLACE "3\\.0" "2.8" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}") STRING(REGEX REPLACE "3\\.0" "2.8" wxWidgets_INCLUDE_DIRS "${wxWidgets_INCLUDE_DIRS}")
STRING(REGEX REPLACE "3\\.0" "2.8" wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}") STRING(REGEX REPLACE "3\\.0" "2.8" wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}")
endif() endif()
endif(Linux) endif()
include(${wxWidgets_USE_FILE}) include(${wxWidgets_USE_FILE})
endif(wxWidgets_FOUND) endif()
if(ZLIB_FOUND) if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS}) include_directories(${ZLIB_INCLUDE_DIRS})
endif(ZLIB_FOUND) endif()

View File

@ -13,7 +13,7 @@ if(GLSL_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, pcsx2 common libs") set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, pcsx2 common libs")
else(GLSL_API) else(GLSL_API)
set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, nvidia-cg-toolkit (>=2.1), pcsx2 common libs") set(msg_dep_zzogl "check these libraries -> glew (>=1.6), jpeg (>=6.2), opengl, X11, nvidia-cg-toolkit (>=2.1), pcsx2 common libs")
endif(GLSL_API) endif()
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Pcsx2 core & common libs # Pcsx2 core & common libs
@ -31,11 +31,11 @@ if(wxWidgets_FOUND AND SPARSEHASH_FOUND)
set(common_libs TRUE) set(common_libs TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/common/src") elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/common/src")
set(common_libs FALSE) set(common_libs FALSE)
else(wxWidgets_FOUND AND SPARSEHASH_FOUND) else()
set(common_libs FALSE) set(common_libs FALSE)
message(STATUS "Skip build of common libraries: miss some dependencies") message(STATUS "Skip build of common libraries: miss some dependencies")
message(STATUS "${msg_dep_common_libs}") message(STATUS "${msg_dep_common_libs}")
endif(wxWidgets_FOUND AND SPARSEHASH_FOUND) endif()
#--------------------------------------- #---------------------------------------
# Pcsx2 core # Pcsx2 core
@ -76,7 +76,7 @@ endif()
#--------------------------------------- #---------------------------------------
if(GTK2_FOUND) if(GTK2_FOUND)
set(CDVDnull TRUE) set(CDVDnull TRUE)
endif(GTK2_FOUND) endif()
#--------------------------------------- #---------------------------------------
#--------------------------------------- #---------------------------------------
@ -85,21 +85,23 @@ endif(GTK2_FOUND)
# requires: -BZip2 # requires: -BZip2
# -gtk2 (linux) # -gtk2 (linux)
#--------------------------------------- #---------------------------------------
if(BZIP2_FOUND AND GTK2_FOUND AND EXTRA_PLUGINS) if(EXTRA_PLUGINS)
set(CDVDiso TRUE) if(BZIP2_FOUND AND GTK2_FOUND)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/CDVDiso") set(CDVDiso TRUE)
set(CDVDiso FALSE) elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/CDVDiso")
else() set(CDVDiso FALSE)
set(CDVDiso FALSE) else()
message(STATUS "Skip build of CDVDiso: miss some dependencies") set(CDVDiso FALSE)
message(STATUS "${msg_dep_cdvdiso}") message(STATUS "Skip build of CDVDiso: miss some dependencies")
message(STATUS "${msg_dep_cdvdiso}")
endif()
endif() endif()
#--------------------------------------- #---------------------------------------
# CDVDlinuz # CDVDlinuz
#--------------------------------------- #---------------------------------------
if(EXTRA_PLUGINS) if(EXTRA_PLUGINS)
set(CDVDlinuz TRUE) set(CDVDlinuz TRUE)
endif() endif()
#--------------------------------------- #---------------------------------------
@ -107,7 +109,7 @@ endif()
#--------------------------------------- #---------------------------------------
if(GTK2_FOUND) if(GTK2_FOUND)
set(dev9null TRUE) set(dev9null TRUE)
endif(GTK2_FOUND) endif()
#--------------------------------------- #---------------------------------------
#--------------------------------------- #---------------------------------------
@ -115,7 +117,7 @@ endif(GTK2_FOUND)
#--------------------------------------- #---------------------------------------
if(GTK2_FOUND) if(GTK2_FOUND)
set(FWnull TRUE) set(FWnull TRUE)
endif(GTK2_FOUND) endif()
#--------------------------------------- #---------------------------------------
#--------------------------------------- #---------------------------------------
@ -136,11 +138,11 @@ if(OPENGL_FOUND AND X11_FOUND AND EGL_FOUND)
set(GSdx TRUE) set(GSdx TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/GSdx") elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/GSdx")
set(GSdx FALSE) set(GSdx FALSE)
else(OPENGL_FOUND AND X11_FOUND AND EGL_FOUND) else()
set(GSdx FALSE) set(GSdx FALSE)
message(STATUS "Skip build of GSdx: miss some dependencies") message(STATUS "Skip build of GSdx: miss some dependencies")
message(STATUS "${msg_dep_gsdx}") message(STATUS "${msg_dep_gsdx}")
endif(OPENGL_FOUND AND X11_FOUND AND EGL_FOUND) endif()
#--------------------------------------- #---------------------------------------
#--------------------------------------- #---------------------------------------
@ -151,14 +153,16 @@ endif(OPENGL_FOUND AND X11_FOUND AND EGL_FOUND)
# -X11 # -X11
# -CG # -CG
#--------------------------------------- #---------------------------------------
if(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND AND EXTRA_PLUGINS) if(EXTRA_PLUGINS)
set(zerogs TRUE) if(GLEW_FOUND AND OPENGL_FOUND AND X11_FOUND AND CG_FOUND)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerogs") set(zerogs TRUE)
set(zerogs FALSE) elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerogs")
else() set(zerogs FALSE)
set(zerogs FALSE) else()
message(STATUS "Skip build of zerogs: miss some dependencies") set(zerogs FALSE)
message(STATUS "${msg_dep_zerogs}") message(STATUS "Skip build of zerogs: miss some dependencies")
message(STATUS "${msg_dep_zerogs}")
endif()
endif() endif()
#--------------------------------------- #---------------------------------------
@ -209,11 +213,11 @@ if(SDL_FOUND)
set(onepad TRUE) set(onepad TRUE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad") elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/onepad")
set(onepad FALSE) set(onepad FALSE)
else(SDL_FOUND) else()
set(onepad FALSE) set(onepad FALSE)
message(STATUS "Skip build of onepad: miss some dependencies") message(STATUS "Skip build of onepad: miss some dependencies")
message(STATUS "${msg_dep_onepad}") message(STATUS "${msg_dep_onepad}")
endif(SDL_FOUND) endif()
#--------------------------------------- #---------------------------------------
#--------------------------------------- #---------------------------------------
@ -251,17 +255,19 @@ endif()
# -ALSA # -ALSA
# -PortAudio # -PortAudio
#--------------------------------------- #---------------------------------------
if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerospu2" AND SOUNDTOUCH_FOUND AND ALSA_FOUND AND EXTRA_PLUGINS) if(EXTRA_PLUGINS)
set(zerospu2 TRUE) if(EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerospu2" AND SOUNDTOUCH_FOUND AND ALSA_FOUND)
# Comment the next line, if you want to compile zerospu2 set(zerospu2 TRUE)
set(zerospu2 FALSE) # Comment the next line, if you want to compile zerospu2
message(STATUS "Don't build zerospu2. It is super-seeded by spu2x") set(zerospu2 FALSE)
elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerospu2") message(STATUS "Don't build zerospu2. It is super-seeded by spu2x")
set(zerospu2 FALSE) elseif(NOT EXISTS "${CMAKE_SOURCE_DIR}/plugins/zerospu2")
else() set(zerospu2 FALSE)
set(zerospu2 FALSE) else()
message(STATUS "Skip build of zerospu2: miss some dependencies") set(zerospu2 FALSE)
message(STATUS "${msg_dep_zerospu2}") message(STATUS "Skip build of zerospu2: miss some dependencies")
message(STATUS "${msg_dep_zerospu2}")
endif()
endif() endif()
#--------------------------------------- #---------------------------------------
@ -270,7 +276,7 @@ endif()
#--------------------------------------- #---------------------------------------
if(GTK2_FOUND) if(GTK2_FOUND)
set(USBnull TRUE) set(USBnull TRUE)
endif(GTK2_FOUND) endif()
#--------------------------------------- #---------------------------------------
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -20,10 +20,6 @@ set(CommonFlags
-pipe -pipe
-Wunused-variable) -Wunused-variable)
if (SPARSEHASH_NEW_FOUND)
set(CommonFlags "${CommonFlags} -DSPARSEHASH_NEW_INCLUDE_DIR ")
endif (SPARSEHASH_NEW_FOUND)
# set warning flags # set warning flags
set(DebugFlags set(DebugFlags
-g -g

View File

@ -22,10 +22,6 @@ set(CommonFlags
-std=c++0x -std=c++0x
-pipe) -pipe)
if (SPARSEHASH_NEW_FOUND)
set(CommonFlags "${CommonFlags} -DSPARSEHASH_NEW_INCLUDE_DIR ")
endif (SPARSEHASH_NEW_FOUND)
# set warning flags # set warning flags
set(DebugFlags set(DebugFlags
-W -W
@ -684,10 +680,7 @@ foreach(res_file IN ITEMS
ConfigIcon_Appearance ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard ConfigIcon_Appearance ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard
ConfigIcon_Paths ConfigIcon_Plugins ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive) ConfigIcon_Paths ConfigIcon_Plugins ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive)
add_custom_command(OUTPUT "${res_bin}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_src}/${res_file}.png" "${res_bin}/${res_file}" ) add_custom_command(OUTPUT "${res_bin}/${res_file}.h" COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${res_src}/${res_file}.png" "${res_bin}/${res_file}" )
endforeach(res_file IN ITEMS endforeach()
AppIcon16 AppIcon32 AppIcon64 BackgroundLogo ButtonIcon_Camera
ConfigIcon_Appearance ConfigIcon_Cpu ConfigIcon_Gamefixes ConfigIcon_MemoryCard
ConfigIcon_Paths ConfigIcon_Plugins ConfigIcon_Speedhacks ConfigIcon_Video Breakpoint_Active Breakpoint_Inactive)
# Suppress all the system-specific predefined macros outside the reserved namespace. # Suppress all the system-specific predefined macros outside the reserved namespace.
# Needed when stringifying macros. # Needed when stringifying macros.