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

View File

@ -17,3 +17,18 @@ macro(check_lib var lib required)
endif()
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})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC)
target_link_libraries(clrun ${CMAKE_DL_LIBS})
endif()

View File

@ -20,8 +20,12 @@ if(wxWidgets_FOUND)
set(SRCS ${SRCS} Src/ConfigDlg.cpp)
endif(wxWidgets_FOUND)
add_library(Plugin_DSP_HLE SHARED ${SRCS})
target_link_libraries(Plugin_DSP_HLE common audiocommon)
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)
endif(wxWidgets_FOUND)
install(TARGETS Plugin_DSP_HLE
LIBRARY DESTINATION ${plugindir}
RUNTIME DESTINATION ${plugindir})

View File

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

View File

@ -16,12 +16,15 @@ set(LIBS videocommon
SOIL
common
Cg
CgGL)
CgGL
${OPENGL_LIBRARIES}
${X11_LIBRARIES})
if(wxWidgets_FOUND)
set(SRCS ${SRCS}
Src/Debugger/Debugger.cpp)
set(LIBS videouicommon ${LIBS})
set(LIBS ${LIBS} ${wxWidgets_LIBRARIES})
endif(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)
endif()
add_library(Plugin_VideoOGL SHARED ${SRCS})
add_library(Plugin_VideoOGL MODULE ${SRCS})
target_link_libraries(Plugin_VideoOGL ${LIBS})
install(TARGETS Plugin_VideoOGL
LIBRARY DESTINATION ${plugindir}

View File

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