diff --git a/CMakeLists.txt b/CMakeLists.txt index f854d68802..711dbadb82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,10 +86,6 @@ endif(CMAKE_BUILD_TYPE STREQUAL Release) # be needed by users is optional defaulting to ON, other stuff (like e.g. # sound backends) is completely optional. -# TODO: wxWidgets: When building the Debug configuration, we should probably -# check if the debug wx libs are available and fall back to the bundled ones -# otherwise. - include(FindOpenGL REQUIRED) include_directories(${OPENGL_INCLUDE_DIR}) @@ -287,6 +283,12 @@ endif() if(WIN32) find_library(GLEW glew32s PATHS Externals/GLew) 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) endif() if(NOT APPLE) @@ -305,12 +307,9 @@ if(NOT DISABLE_WX) include(${wxWidgets_USE_FILE}) if(UNIX) - pkg_search_module(GTK2 REQUIRED gtk+-2.0) + check_lib(GTK2 gtk+-2.0 TRUE) if(GTK2_FOUND) include_directories(${GTK2_INCLUDE_DIRS}) - message("GTK 2 found") - else(GTK2_FOUND) - message("GTK 2 NOT found") endif(GTK2_FOUND) endif(UNIX) diff --git a/CMakeTests/CheckLib.cmake b/CMakeTests/CheckLib.cmake new file mode 100644 index 0000000000..f599f94ccd --- /dev/null +++ b/CMakeTests/CheckLib.cmake @@ -0,0 +1,19 @@ +macro(check_lib var lib required) + pkg_search_module(${var} ${lib}) + if(${var}_FOUND) + message("${lib} found") + else() + find_library(${var} ${lib}) + if(${var}) + message("${lib} found") + set(${var}_FOUND 1 CACHE INTERNAL "") + else() + if(${required}) + message(FATAL_ERROR "${lib} is required but not found") + else() + message("${lib} not found") + endif() + endif() + endif() +endmacro() + diff --git a/Source/Core/AudioCommon/Src/Mixer.cpp b/Source/Core/AudioCommon/Src/Mixer.cpp index d914f634c5..74afccc21a 100644 --- a/Source/Core/AudioCommon/Src/Mixer.cpp +++ b/Source/Core/AudioCommon/Src/Mixer.cpp @@ -74,12 +74,12 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples) s16 l1 = Common::swap16(m_buffer[m_indexR & INDEX_MASK]); //current s16 l2 = Common::swap16(m_buffer[m_indexR2 & INDEX_MASK]); //next - int sampleL = (l1 << 16) + (l2 - l1) * (u16)frac >> 16; + int sampleL = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16; samples[i] = sampleL; s16 r1 = Common::swap16(m_buffer[(m_indexR + 1) & INDEX_MASK]); //current s16 r2 = Common::swap16(m_buffer[(m_indexR2 + 1) & INDEX_MASK]); //next - int sampleR = (r1 << 16) + (r2 - r1) * (u16)frac >> 16; + int sampleR = ((r1 << 16) + (r2 - r1) * (u16)frac) >> 16; samples[i+1] = sampleR; frac += ratio; diff --git a/Source/Core/Common/Src/Log.h b/Source/Core/Common/Src/Log.h index efb9225c90..605596b5d6 100644 --- a/Source/Core/Common/Src/Log.h +++ b/Source/Core/Common/Src/Log.h @@ -95,7 +95,9 @@ extern "C" { #endif void GenericLogC(int level, int type, const char *file, int line, const char *fmt, ...); +#ifndef __cplusplus #define GenericLog GenericLogC +#endif #ifdef __cplusplus }; #endif diff --git a/Source/Core/Core/Src/HW/AudioInterface.cpp b/Source/Core/Core/Src/HW/AudioInterface.cpp index 1aceee6653..0eb61dc082 100644 --- a/Source/Core/Core/Src/HW/AudioInterface.cpp +++ b/Source/Core/Core/Src/HW/AudioInterface.cpp @@ -335,8 +335,8 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples r2 = pcm[pos * 2 + 1]; //next } - pcm_l = (l1 << 16) + (l2 - l1) * (u16)frac >> 16; - pcm_r = (l1 << 16) + (l2 - l1) * (u16)frac >> 16; + pcm_l = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16; + pcm_r = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16; pcm_l = (pcm_l * lvolume >> 8) + (int)(*_pDestBuffer); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index fb65bd6a39..d4eda63a06 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -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)); + wxT("Warning"), event.GetInt() ? wxYES_NO : wxOK), this); panic_event.Set(); break; #endif diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 5d0238b379..d3a458a510 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -457,7 +457,7 @@ bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style* #endif return wxYES == wxMessageBox(wxString::FromAscii(text), wxString::FromAscii(caption), - (yes_no) ? wxYES_NO : wxOK); + (yes_no) ? wxYES_NO : wxOK, main_frame); #ifdef __WXGTK__ else {