Change the cmake check_lib routine to use REQUIRED/OPTIONAL instead of TRUE/FALSE.

Add a check to see if -Wno-unused-result is supported by the compiler.
Fix some compiler warnings in the wiiuse code.
Fix a bug in the wxGTK panic alert code.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6399 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-11-13 22:07:27 +00:00
parent 02edf66b49
commit 17662d4ac6
5 changed files with 19 additions and 10 deletions

View File

@ -33,12 +33,20 @@ endif()
include(FindPkgConfig REQUIRED)
# Various compile flags
add_definitions(-msse2 -Wall -Wno-unused-result)
add_definitions(-msse2 -Wall)
# gcc uses some optimizations which might break stuff without this flag
add_definitions(-fno-strict-aliasing -fno-exceptions)
include(CheckCXXCompilerFlag)
# We call fread numerous times without checking return values. Hide the
# corresponding compiler warnings if the compiler supports doing so.
CHECK_CXX_COMPILER_FLAG(-Wno-unused-result NO_UNUSED_RESULT)
if(NO_UNUSED_RESULT)
add_definitions(-Wno-unused-result)
endif(NO_UNUSED_RESULT)
CHECK_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden VISIBILITY_INLINES_HIDDEN)
if(VISIBILITY_INLINES_HIDDEN)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden)
@ -275,10 +283,10 @@ if(WIN32)
include_directories(Externals/GLew/include)
else()
include(CheckLib)
check_lib(GLEW glew TRUE)
check_lib(GLU glu TRUE)
check_lib(CG Cg TRUE)
check_lib(CGGL CgGL TRUE)
check_lib(GLEW glew REQUIRED)
check_lib(GLU glu REQUIRED)
check_lib(CG Cg REQUIRED)
check_lib(CGGL CgGL REQUIRED)
endif()
if(NOT APPLE)
@ -296,7 +304,7 @@ if(NOT DISABLE_WX)
include(${wxWidgets_USE_FILE})
if(UNIX)
check_lib(GTK2 gtk+-2.0 TRUE)
check_lib(GTK2 gtk+-2.0 REQUIRED)
if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS})
endif(GTK2_FOUND)

View File

@ -8,7 +8,7 @@ macro(check_lib var lib required)
message("${lib} found")
set(${var}_FOUND 1 CACHE INTERNAL "")
else()
if(${required})
if(${required} STREQUAL "REQUIRED")
message(FATAL_ERROR "${lib} is required but not found")
else()
message("${lib} not found")

View File

@ -658,7 +658,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
#ifdef __WXGTK__
case IDM_PANIC:
bPanicResult = (wxYES == wxMessageBox(event.GetString(),
wxT("Warning"), event.GetInt() ? wxYES_NO : wxOK), this);
wxT("Warning"), event.GetInt() ? wxYES_NO : wxOK, this));
panic_event.Set();
break;
#endif

View File

@ -183,7 +183,8 @@ static int wiiuse_connect_single(struct wiimote_t* wm, char* address)
str2ba(address, &addr.l2_bdaddr);
else
{
if (bacmp(bdaddr, BDADDR_ANY) == 0)
bdaddr_t bdaddr_any = (bdaddr_t){{0, 0, 0, 0, 0, 0}};
if (bacmp(bdaddr, &bdaddr_any) == 0)
return 0;
// use address of device discovered
addr.l2_bdaddr = *bdaddr;

View File

@ -123,7 +123,7 @@ struct wiimote_t** wiiuse_init(int wiimotes) {
wm[i]->unid = i+1;
#if defined __linux__ && HAVE_BLUEZ
wm[i]->bdaddr = *BDADDR_ANY;
wm[i]->bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}};
wm[i]->out_sock = -1;
wm[i]->in_sock = -1;
#elif defined(_WIN32)