cmake: validate wx api

checks wx-config version is compatible with the one requested by the user (wx 2.8 or wx 3.0 with WX28_API option)
This commit is contained in:
Gregory Hainaut 2015-01-06 21:55:33 +01:00
parent 14d4b3fe7a
commit 678c8a5cd6
2 changed files with 12 additions and 16 deletions

View File

@ -59,3 +59,14 @@ function(WX_vs_GTK3)
endif()
endfunction()
function(WX_version)
EXECUTE_PROCESS(COMMAND ${wxWidgets_CONFIG_EXECUTABLE} --version OUTPUT_VARIABLE version)
STRING(STRIP ${version} version)
if (${version} MATCHES "3.0" AND WX28_API)
message(FATAL_ERROR "Mismatch between wx-config version (${version}) and requested WX API (2.8.x)")
endif()
if (${version} MATCHES "2.8" AND NOT WX28_API)
message(FATAL_ERROR "Mismatch between wx-config version (${version}) and requested WX API (3.0.x)")
endif()
endfunction()

View File

@ -134,22 +134,6 @@ if(SDL_FOUND AND NOT SDL2_API)
endif()
if(wxWidgets_FOUND)
if(Linux)
# Some people are trying to compile with wx 3.0 ...
### 3.0
# -I/usr/lib/i386-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread
# -L/usr/lib/i386-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0
### 2.8
# -I/usr/lib/i386-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
# -L/usr/lib/i386-linux-gnu -pthread -Wl,-z,relro -L/usr/lib/i386-linux-gnu -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
if ("${wxWidgets_INCLUDE_DIRS}" MATCHES "3.0" AND WX28_API)
message(WARNING "\nWxwidget 3.0 is installed on your system whereas PCSX2 required 2.8 !!!\nPCSX2 will try to use 2.8 but if it would be better to fix your setup.\n")
STRING(REGEX REPLACE "unicode" "unicode-release" 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}")
endif()
endif()
include(${wxWidgets_USE_FILE})
endif()
@ -174,3 +158,4 @@ include_directories(${CMAKE_SOURCE_DIR}/common/include
include(ApiValidation)
WX_vs_SDL()
WX_vs_GTK3()
WX_version()