Make Linux/MacOSX system checks correct in the cmake build. UNIX is true on both linux and osx. The cmake build probably still doesn't work on MacOSX though.

Also added an option to explicitly disable building with MPG framedumps.  To use it add -DENCODE_FRAMEDUMPS=OFF to cmake on the command line.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6429 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-11-17 01:03:39 +00:00
parent 0644295f3d
commit a279b391cc
15 changed files with 50 additions and 48 deletions

View File

@ -52,12 +52,12 @@ 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(UNIX AND NOT APPLE) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden VISIBILITY_HIDDEN) CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden VISIBILITY_HIDDEN)
if(VISIBILITY_HIDDEN) if(VISIBILITY_HIDDEN)
add_definitions(-fvisibility=hidden) add_definitions(-fvisibility=hidden)
endif(VISIBILITY_HIDDEN) endif(VISIBILITY_HIDDEN)
endif(UNIX AND NOT APPLE) endif()
if(WIN32) if(WIN32)
add_definitions(-D_SECURE_SCL=0) add_definitions(-D_SECURE_SCL=0)
@ -150,7 +150,7 @@ endif(OPENAL_FOUND)
# Note: We do not need to explicitly check for X11 as it is done in the cmake # Note: We do not need to explicitly check for X11 as it is done in the cmake
# FindOpenGL module on linux. # FindOpenGL module on linux.
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(X11_FOUND) if(X11_FOUND)
add_definitions(-DHAVE_X11=1) add_definitions(-DHAVE_X11=1)
include_directories(${X11_INCLUDE_DIR}) include_directories(${X11_INCLUDE_DIR})
@ -160,7 +160,7 @@ if(UNIX)
endif(X11_FOUND) endif(X11_FOUND)
else() else()
add_definitions(-DHAVE_X11=0) add_definitions(-DHAVE_X11=0)
endif(UNIX) endif()
pkg_search_module(XRANDR xrandr) pkg_search_module(XRANDR xrandr)
if(XRANDR_FOUND) if(XRANDR_FOUND)
@ -171,15 +171,18 @@ else()
message("Xrandr NOT found") message("Xrandr NOT found")
endif(XRANDR_FOUND) endif(XRANDR_FOUND)
pkg_search_module(AVCODEC libavcodec>=52.72.2) option(ENCODE_FRAMEDUMPS "Encode framedumps in MPG format" ON)
pkg_search_module(SWSCALE libswscale>=0.11.0) if(ENCODE_FRAMEDUMPS)
if(AVCODEC_FOUND AND SWSCALE_FOUND) pkg_search_module(AVCODEC libavcodec>=52.72.2)
message("avcodec found, enabling MPG frame dumps") pkg_search_module(SWSCALE libswscale>=0.11.0)
set(ENCODE_FRAMEDUMPS TRUE) if(AVCODEC_FOUND AND SWSCALE_FOUND)
add_definitions(-DHAVE_AVCODEC) message("avcodec found, enabling MPG frame dumps")
else() set(ENCODE_FRAMEDUMPS ON)
set(ENCODE_FRAMEDUMPS FALSE) add_definitions(-DHAVE_AVCODEC)
message("avcodec not found, disabling MPG frame dumps") else()
set(ENCODE_FRAMEDUMPS OFF)
message("avcodec not found, disabling MPG frame dumps")
endif()
endif() endif()
include(CheckCXXSourceRuns) include(CheckCXXSourceRuns)
@ -303,34 +306,33 @@ else()
check_lib(CGGL CgGL REQUIRED) check_lib(CGGL CgGL REQUIRED)
endif() endif()
if(NOT APPLE) if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
include_directories(Externals/CLRun/include) include_directories(Externals/CLRun/include)
add_subdirectory(Externals/CLRun) add_subdirectory(Externals/CLRun)
add_definitions(-DUSE_CLRUN) add_definitions(-DUSE_CLRUN)
endif(NOT APPLE) endif()
option(DISABLE_WX OFF "Disable wxWidgets (use CLI interface)") option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)
if(NOT DISABLE_WX) if(NOT DISABLE_WX)
include(FindwxWidgets OPTIONAL) include(FindwxWidgets OPTIONAL)
if(wxWidgets_FOUND) if(wxWidgets_FOUND)
add_definitions(-DHAVE_WX=1)
include(${wxWidgets_USE_FILE}) include(${wxWidgets_USE_FILE})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
check_lib(GTK2 gtk+-2.0 REQUIRED) check_lib(GTK2 gtk+-2.0 REQUIRED)
if(GTK2_FOUND) if(GTK2_FOUND)
include_directories(${GTK2_INCLUDE_DIRS}) include_directories(${GTK2_INCLUDE_DIRS})
endif(GTK2_FOUND) endif(GTK2_FOUND)
endif(UNIX) endif()
message("wxWidgets found, enabling GUI build") message("wxWidgets found, enabling GUI build")
else(wxWidgets_FOUND) else(wxWidgets_FOUND)
message("Shared wxWidgets not found, falling back to the static library") message("Shared wxWidgets not found, falling back to the static library")
add_definitions(-DHAVE_WX=1)
include_directories(Externals/wxWidgets/include) include_directories(Externals/wxWidgets/include)
add_subdirectory(Externals/wxWidgets) add_subdirectory(Externals/wxWidgets)
endif(wxWidgets_FOUND) endif(wxWidgets_FOUND)
add_definitions(-DHAVE_WX=1)
endif(NOT DISABLE_WX) endif(NOT DISABLE_WX)

View File

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

View File

@ -1,6 +1,6 @@
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-DLUA_USE_LINUX) add_definitions(-DLUA_USE_LINUX)
endif(UNIX) endif()
set(SRCS lapi.c set(SRCS lapi.c
lauxlib.c lauxlib.c

View File

@ -4,6 +4,6 @@ set(SRCS image_DXT.c
stb_image_aug.c) stb_image_aug.c)
add_library(SOIL STATIC ${SRCS}) add_library(SOIL STATIC ${SRCS})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC) add_definitions(-fPIC)
endif(UNIX) endif()

View File

@ -6,7 +6,7 @@ set(SRCS Src/AudioCommon.cpp
set(LIBS "") set(LIBS "")
if(APPLE) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SRCS ${SRCS} Src/CoreAudioSoundStream.cpp) set(SRCS ${SRCS} Src/CoreAudioSoundStream.cpp)
else() else()
if(ALSA_FOUND) if(ALSA_FOUND)
@ -37,6 +37,6 @@ endif()
add_library(audiocommon STATIC ${SRCS}) add_library(audiocommon STATIC ${SRCS})
target_link_libraries(audiocommon ${LIBS}) target_link_libraries(audiocommon ${LIBS})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC) add_definitions(-fPIC)
endif(UNIX) endif()

View File

@ -40,6 +40,6 @@ if(WIN32)
endif(WIN32) endif(WIN32)
add_library(common STATIC ${SRCS}) add_library(common STATIC ${SRCS})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC) add_definitions(-fPIC)
endif(UNIX) endif()

View File

@ -133,9 +133,9 @@ set(SRCS Src/ActionReplay.cpp
if(WIN32) if(WIN32)
set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Win32.cpp Src/stdafx.cpp) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Win32.cpp Src/stdafx.cpp)
elseif(APPLE) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Apple.cpp) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Apple.cpp)
elseif(UNIX) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Unix.cpp) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Unix.cpp)
endif() endif()

View File

@ -23,6 +23,6 @@ set(SRCS Src/assemble.cpp
Src/Jit/DSPJitMisc.cpp) Src/Jit/DSPJitMisc.cpp)
add_library(dspcore STATIC ${SRCS}) add_library(dspcore STATIC ${SRCS})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC) add_definitions(-fPIC)
endif(UNIX) endif()

View File

@ -3,6 +3,6 @@ set(SRCS Src/CodeView.cpp
Src/MemoryView.cpp) Src/MemoryView.cpp)
add_library(debugger_ui_util STATIC ${SRCS}) add_library(debugger_ui_util STATIC ${SRCS})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC) add_definitions(-fPIC)
endif(UNIX) endif()

View File

@ -63,9 +63,9 @@ endif(XRANDR_FOUND)
if(WIN32) if(WIN32)
set(SRCS ${SRCS} Src/stdafx.cpp) set(SRCS ${SRCS} Src/stdafx.cpp)
elseif(APPLE AND NOT wxWidgets_FOUND) elseif((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND)
# TODO # TODO
elseif(APPLE AND wxWidgets_FOUND) elseif((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND wxWidgets_FOUND)
# TODO # TODO
else() else()
set(SRCS ${SRCS} Src/X11Utils.cpp) set(SRCS ${SRCS} Src/X11Utils.cpp)

View File

@ -11,7 +11,7 @@ if(WIN32)
Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp
Src/ControllerInterface/SDL/SDL.cpp Src/ControllerInterface/SDL/SDL.cpp
Src/ControllerInterface/XInput/XInput.cpp) Src/ControllerInterface/XInput/XInput.cpp)
elseif(APPLE) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SRCS ${SRCS} set(SRCS ${SRCS}
Src/ControllerInterface/OSX/OSX.mm Src/ControllerInterface/OSX/OSX.mm
Src/ControllerInterface/OSX/OSXKeyboard.mm Src/ControllerInterface/OSX/OSXKeyboard.mm

View File

@ -40,10 +40,10 @@ if(ENCODE_FRAMEDUMPS OR WIN32)
endif() endif()
add_library(videocommon STATIC ${SRCS}) add_library(videocommon STATIC ${SRCS})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if(ENCODE_FRAMEDUMPS) if(ENCODE_FRAMEDUMPS)
target_link_libraries(videocommon avcodec swscale) target_link_libraries(videocommon avcodec swscale)
add_definitions(-D__STDC_CONSTANT_MACROS) add_definitions(-D__STDC_CONSTANT_MACROS)
endif() endif()
add_definitions(-fPIC) add_definitions(-fPIC)
endif(UNIX) endif()

View File

@ -1,6 +1,6 @@
set(SRCS Src/VideoConfigDiag.cpp) set(SRCS Src/VideoConfigDiag.cpp)
add_library(videouicommon STATIC ${SRCS}) add_library(videouicommon STATIC ${SRCS})
if(UNIX) if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-fPIC) add_definitions(-fPIC)
endif(UNIX) endif()

View File

@ -1,9 +1,9 @@
set(SRCS Src/ir.cpp set(SRCS Src/ir.cpp
Src/wiiuse.cpp) Src/wiiuse.cpp)
if(APPLE) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SRCS ${SRCS} Src/io_osx.m) set(SRCS ${SRCS} Src/io_osx.m)
elseif(UNIX AND BLUEZ_FOUND) elseif((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND BLUEZ_FOUND)
set(SRCS ${SRCS} Src/io_nix.cpp) set(SRCS ${SRCS} Src/io_nix.cpp)
set(LIBS ${LIBS} bluetooth) set(LIBS ${LIBS} bluetooth)
elseif(WIN32) elseif(WIN32)

View File

@ -25,11 +25,11 @@ if(wxWidgets_FOUND)
set(LIBS videouicommon ${LIBS}) set(LIBS videouicommon ${LIBS})
endif(wxWidgets_FOUND) endif(wxWidgets_FOUND)
if(APPLE 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)
elseif(WIN32) elseif(WIN32)
set(SRCS ${SRCS} Src/OS/Win32.cpp) set(SRCS ${SRCS} Src/OS/Win32.cpp)
elseif(NOT APPLE) elseif(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
set(LIBS ${LIBS} clrun) set(LIBS ${LIBS} clrun)
endif() endif()