diff --git a/CMakeLists.txt b/CMakeLists.txt index 37e4f14f5e..467aeca777 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -475,6 +475,12 @@ else() include_directories(Externals) endif(NOT CG_FOUND) check_lib(CGGL CgGL Cg/cgGL.h) + if(NOT CG_FOUND) + message("CG not found, Building without") + add_definitions(-DHAVE_CG=0) + else() + add_definitions(-DHAVE_CG=1) + endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt index 4c4bbbe649..2a43a85b92 100644 --- a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt @@ -23,7 +23,7 @@ if(wxWidgets_FOUND) set(LIBS ${LIBS} ${wxWidgets_LIBRARIES}) endif(wxWidgets_FOUND) -if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if(HAVE_CG AND (APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux")) set(LIBS ${LIBS} Cg CgGL) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") list(APPEND LIBS "${CMAKE_SOURCE_DIR}/Externals/Cg/Cg.framework") diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index bfde884ccd..db7cf822e4 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -113,10 +113,9 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line); #define GL_REPORT_PROGRAM_ERROR() (void)0 #endif -#if defined __APPLE__ || defined __linux__ || defined _WIN32 +#if HAVE_CG && (defined __APPLE__ || defined __linux__ || defined _WIN32) #include #include -#define HAVE_CG 1 extern CGcontext g_cgcontext; extern CGprofile g_cgvProf, g_cgfProf; #endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index da9ba40108..f4614294fd 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -438,6 +438,11 @@ Renderer::Renderer() cgGLSetOptimalOptions(g_cgfProf); } } +#else + // If we don't have Nvidia CG, we HAVE to use GLSL + g_Config.bUseGLSL = true; + + UpdateActiveConfig(); #endif // HAVE_CG int nenvvertparams, nenvfragparams, naddrregisters[2];