Fix for issue 3507. Compile with old GLEW versions, support user-specified CFLAGS and link plugins to all the used libs.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6441 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Christian Morales Vega 2010-11-18 23:27:27 +00:00
parent 63aae7e5e0
commit 7632a5abd4
7 changed files with 47 additions and 24 deletions

View File

@ -49,7 +49,7 @@ endif(NO_UNUSED_RESULT)
CHECK_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden VISIBILITY_INLINES_HIDDEN) CHECK_CXX_COMPILER_FLAG(-fvisibility-inlines-hidden VISIBILITY_INLINES_HIDDEN)
if(VISIBILITY_INLINES_HIDDEN) if(VISIBILITY_INLINES_HIDDEN)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
endif(VISIBILITY_INLINES_HIDDEN) endif(VISIBILITY_INLINES_HIDDEN)
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
@ -242,16 +242,17 @@ include_directories(Externals/Bochs_disasm)
add_subdirectory(Externals/Lua) add_subdirectory(Externals/Lua)
include_directories(Externals/Lua) include_directories(Externals/Lua)
find_library(LZO lzo2) include(CheckLib)
find_path(LZO_INCLUDE lzo/lzo1x.h)
if(LZO AND LZO_INCLUDE) check_lib_and_header(LZO lzo2 lzo/lzo1x.h OPTIONAL)
if(LZO_FOUND)
message("Using shared lzo") message("Using shared lzo")
include_directories(${LZO_INCLUDE}) include_directories(${LZO_INCLUDE})
else() else()
message("Shared lzo not found, falling back to the static library") message("Shared lzo not found, falling back to the static library")
add_subdirectory(Externals/LZO) add_subdirectory(Externals/LZO)
include_directories(Externals/LZO) include_directories(Externals/LZO)
endif(LZO AND LZO_INCLUDE) endif()
include(FindSDL OPTIONAL) include(FindSDL OPTIONAL)
if(SDL_FOUND) if(SDL_FOUND)
@ -264,27 +265,25 @@ else(SDL_FOUND)
add_subdirectory(Externals/SDL) add_subdirectory(Externals/SDL)
endif(SDL_FOUND) endif(SDL_FOUND)
find_library(SFML_NETWORK sfml-network) check_lib_and_header(SFML sfml-network SFML/Network/Ftp.hpp OPTIONAL)
find_path(SFML_INCLUDE SFML/Network/Ftp.hpp) if(SFML_FOUND)
if(SFML_NETWORK AND SFML_INCLUDE)
message("Using shared sfml-network") message("Using shared sfml-network")
include_directories(${SFML_INCLUDE}) include_directories(${SFML_INCLUDE})
else() else()
message("Shared sfml-network not found, falling back to the static library") message("Shared sfml-network not found, falling back to the static library")
add_subdirectory(Externals/SFML) add_subdirectory(Externals/SFML)
include_directories(Externals/SFML/include) include_directories(Externals/SFML/include)
endif(SFML_NETWORK AND SFML_INCLUDE) endif()
find_library(SOIL SOIL) check_lib_and_header(SOIL SOIL SOIL/SOIL.h OPTIONAL)
find_path(SOIL_INCLUDE SOIL/SOIL.h) if(SOIL_FOUND)
if(SOIL AND SOIL_INCLUDE)
message("Using shared SOIL") message("Using shared SOIL")
include_directories(${SOIL_INCLUDE}) include_directories(${SOIL_INCLUDE})
else() else()
message("Shared SOIL not found, falling back to the static library") message("Shared SOIL not found, falling back to the static library")
add_subdirectory(Externals/SOIL) add_subdirectory(Externals/SOIL)
include_directories(Externals/SOIL) include_directories(Externals/SOIL)
endif(SOIL AND SOIL_INCLUDE) endif()
include(FindZLIB OPTIONAL) include(FindZLIB OPTIONAL)
if(ZLIB_FOUND) if(ZLIB_FOUND)
@ -300,11 +299,10 @@ if(WIN32)
find_library(GLEW glew32s PATHS Externals/GLew) find_library(GLEW glew32s PATHS Externals/GLew)
include_directories(Externals/GLew/include) include_directories(Externals/GLew/include)
else() else()
include(CheckLib)
check_lib(GLEW glew REQUIRED)
check_lib(GLU glu REQUIRED) check_lib(GLU glu REQUIRED)
check_lib(CG Cg REQUIRED) check_lib_and_header(GLEW GLEW GL/glew.h REQUIRED)
check_lib(CGGL CgGL REQUIRED) check_lib_and_header(CG Cg Cg/cg.h REQUIRED)
check_lib_and_header(CGGL CgGL Cg/cgGL.h REQUIRED)
endif() endif()
if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))

View File

@ -17,3 +17,18 @@ macro(check_lib var lib required)
endif() endif()
endmacro() endmacro()
macro(check_lib_and_header var lib header required)
find_library(${var} ${lib})
find_path(${var}_INCLUDE ${header})
if(${var} AND ${var}_INCLUDE)
message("${lib} found")
set(${var}_FOUND 1 CACHE INTERNAL "")
else()
if(${required} STREQUAL "REQUIRED")
message(FATAL_ERROR "${lib} is required but not found")
else()
message("${lib} not found")
endif()
endif()
endmacro()

View File

@ -6,4 +6,5 @@ set(SRCS clrun/clrun.c
add_library(clrun STATIC ${SRCS}) add_library(clrun STATIC ${SRCS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC) add_definitions(-fPIC)
target_link_libraries(clrun ${CMAKE_DL_LIBS})
endif() endif()

View File

@ -20,8 +20,12 @@ if(wxWidgets_FOUND)
set(SRCS ${SRCS} Src/ConfigDlg.cpp) set(SRCS ${SRCS} Src/ConfigDlg.cpp)
endif(wxWidgets_FOUND) endif(wxWidgets_FOUND)
add_library(Plugin_DSP_HLE SHARED ${SRCS}) add_library(Plugin_DSP_HLE MODULE ${SRCS})
if(wxWidgets_FOUND)
target_link_libraries(Plugin_DSP_HLE common audiocommon ${wxWidgets_LIBRARIES})
else(wxWidgets_FOUND)
target_link_libraries(Plugin_DSP_HLE common audiocommon) target_link_libraries(Plugin_DSP_HLE common audiocommon)
endif(wxWidgets_FOUND)
install(TARGETS Plugin_DSP_HLE install(TARGETS Plugin_DSP_HLE
LIBRARY DESTINATION ${plugindir} LIBRARY DESTINATION ${plugindir}
RUNTIME DESTINATION ${plugindir}) RUNTIME DESTINATION ${plugindir})

View File

@ -15,10 +15,10 @@ if(wxWidgets_FOUND)
Src/DSPConfigDlgLLE.cpp Src/DSPConfigDlgLLE.cpp
Src/Debugger/DSPDebugWindow.cpp Src/Debugger/DSPDebugWindow.cpp
Src/Debugger/DSPRegisterView.cpp) Src/Debugger/DSPRegisterView.cpp)
set(LIBS ${LIBS} debugger_ui_util) set(LIBS ${LIBS} debugger_ui_util ${wxWidgets_LIBRARIES})
endif(wxWidgets_FOUND) endif(wxWidgets_FOUND)
add_library(Plugin_DSP_LLE SHARED ${SRCS}) add_library(Plugin_DSP_LLE MODULE ${SRCS})
target_link_libraries(Plugin_DSP_LLE ${LIBS}) target_link_libraries(Plugin_DSP_LLE ${LIBS})
install(TARGETS Plugin_DSP_LLE install(TARGETS Plugin_DSP_LLE
LIBRARY DESTINATION ${plugindir} LIBRARY DESTINATION ${plugindir}

View File

@ -16,12 +16,15 @@ set(LIBS videocommon
SOIL SOIL
common common
Cg Cg
CgGL) CgGL
${OPENGL_LIBRARIES}
${X11_LIBRARIES})
if(wxWidgets_FOUND) if(wxWidgets_FOUND)
set(SRCS ${SRCS} set(SRCS ${SRCS}
Src/Debugger/Debugger.cpp) Src/Debugger/Debugger.cpp)
set(LIBS videouicommon ${LIBS}) set(LIBS videouicommon ${LIBS})
set(LIBS ${LIBS} ${wxWidgets_LIBRARIES})
endif(wxWidgets_FOUND) endif(wxWidgets_FOUND)
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND) if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND)
@ -32,7 +35,7 @@ elseif(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
set(LIBS ${LIBS} clrun) set(LIBS ${LIBS} clrun)
endif() endif()
add_library(Plugin_VideoOGL SHARED ${SRCS}) add_library(Plugin_VideoOGL MODULE ${SRCS})
target_link_libraries(Plugin_VideoOGL ${LIBS}) target_link_libraries(Plugin_VideoOGL ${LIBS})
install(TARGETS Plugin_VideoOGL install(TARGETS Plugin_VideoOGL
LIBRARY DESTINATION ${plugindir} LIBRARY DESTINATION ${plugindir}

View File

@ -27,7 +27,9 @@ set(SRCS Src/BPMemLoader.cpp
set(LIBS videocommon set(LIBS videocommon
GLEW GLEW
SOIL SOIL
common) common
${OPENGL_LIBRARIES}
${X11_LIBRARIES})
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND) if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND)
set(SRCS ${SRCS} Src/cocoaGL.m) set(SRCS ${SRCS} Src/cocoaGL.m)