From a279b391ccc1487bb3f06579515c27d5497385f1 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 17 Nov 2010 01:03:39 +0000 Subject: [PATCH] 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 --- CMakeLists.txt | 42 ++++++++++--------- Externals/CLRun/CMakeLists.txt | 4 +- Externals/Lua/CMakeLists.txt | 4 +- Externals/SOIL/CMakeLists.txt | 4 +- Source/Core/AudioCommon/CMakeLists.txt | 6 +-- Source/Core/Common/CMakeLists.txt | 4 +- Source/Core/Core/CMakeLists.txt | 4 +- Source/Core/DSPCore/CMakeLists.txt | 4 +- Source/Core/DebuggerUICommon/CMakeLists.txt | 4 +- Source/Core/DolphinWX/CMakeLists.txt | 4 +- Source/Core/InputCommon/CMakeLists.txt | 2 +- Source/Core/VideoCommon/CMakeLists.txt | 4 +- Source/Core/VideoUICommon/CMakeLists.txt | 4 +- Source/Core/wiiuse/CMakeLists.txt | 4 +- Source/Plugins/Plugin_VideoOGL/CMakeLists.txt | 4 +- 15 files changed, 50 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d0bb291b95..aa2e0f5d00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,12 +52,12 @@ if(VISIBILITY_INLINES_HIDDEN) set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fvisibility-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) if(VISIBILITY_HIDDEN) add_definitions(-fvisibility=hidden) endif(VISIBILITY_HIDDEN) -endif(UNIX AND NOT APPLE) +endif() if(WIN32) 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 # FindOpenGL module on linux. -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(X11_FOUND) add_definitions(-DHAVE_X11=1) include_directories(${X11_INCLUDE_DIR}) @@ -160,7 +160,7 @@ if(UNIX) endif(X11_FOUND) else() add_definitions(-DHAVE_X11=0) -endif(UNIX) +endif() pkg_search_module(XRANDR xrandr) if(XRANDR_FOUND) @@ -171,15 +171,18 @@ else() message("Xrandr NOT found") endif(XRANDR_FOUND) -pkg_search_module(AVCODEC libavcodec>=52.72.2) -pkg_search_module(SWSCALE libswscale>=0.11.0) -if(AVCODEC_FOUND AND SWSCALE_FOUND) - message("avcodec found, enabling MPG frame dumps") - set(ENCODE_FRAMEDUMPS TRUE) - add_definitions(-DHAVE_AVCODEC) -else() - set(ENCODE_FRAMEDUMPS FALSE) - message("avcodec not found, disabling MPG frame dumps") +option(ENCODE_FRAMEDUMPS "Encode framedumps in MPG format" ON) +if(ENCODE_FRAMEDUMPS) + pkg_search_module(AVCODEC libavcodec>=52.72.2) + pkg_search_module(SWSCALE libswscale>=0.11.0) + if(AVCODEC_FOUND AND SWSCALE_FOUND) + message("avcodec found, enabling MPG frame dumps") + set(ENCODE_FRAMEDUMPS ON) + add_definitions(-DHAVE_AVCODEC) + else() + set(ENCODE_FRAMEDUMPS OFF) + message("avcodec not found, disabling MPG frame dumps") + endif() endif() include(CheckCXXSourceRuns) @@ -303,34 +306,33 @@ else() check_lib(CGGL CgGL REQUIRED) endif() -if(NOT APPLE) +if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) include_directories(Externals/CLRun/include) add_subdirectory(Externals/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) include(FindwxWidgets OPTIONAL) if(wxWidgets_FOUND) - add_definitions(-DHAVE_WX=1) include(${wxWidgets_USE_FILE}) - if(UNIX) + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") check_lib(GTK2 gtk+-2.0 REQUIRED) if(GTK2_FOUND) include_directories(${GTK2_INCLUDE_DIRS}) endif(GTK2_FOUND) - endif(UNIX) + endif() message("wxWidgets found, enabling GUI build") else(wxWidgets_FOUND) message("Shared wxWidgets not found, falling back to the static library") - add_definitions(-DHAVE_WX=1) include_directories(Externals/wxWidgets/include) add_subdirectory(Externals/wxWidgets) endif(wxWidgets_FOUND) + add_definitions(-DHAVE_WX=1) endif(NOT DISABLE_WX) diff --git a/Externals/CLRun/CMakeLists.txt b/Externals/CLRun/CMakeLists.txt index 7228fb86d2..0a5ee41427 100644 --- a/Externals/CLRun/CMakeLists.txt +++ b/Externals/CLRun/CMakeLists.txt @@ -4,6 +4,6 @@ set(SRCS clrun/clrun.c clrun/genclgl.c) add_library(clrun STATIC ${SRCS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Externals/Lua/CMakeLists.txt b/Externals/Lua/CMakeLists.txt index 0665cc6686..fa6a1672f6 100644 --- a/Externals/Lua/CMakeLists.txt +++ b/Externals/Lua/CMakeLists.txt @@ -1,6 +1,6 @@ -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-DLUA_USE_LINUX) -endif(UNIX) +endif() set(SRCS lapi.c lauxlib.c diff --git a/Externals/SOIL/CMakeLists.txt b/Externals/SOIL/CMakeLists.txt index 6291f9a0a4..4a3a889847 100644 --- a/Externals/SOIL/CMakeLists.txt +++ b/Externals/SOIL/CMakeLists.txt @@ -4,6 +4,6 @@ set(SRCS image_DXT.c stb_image_aug.c) add_library(SOIL STATIC ${SRCS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Source/Core/AudioCommon/CMakeLists.txt b/Source/Core/AudioCommon/CMakeLists.txt index 1b639c4c14..91d1f432a0 100644 --- a/Source/Core/AudioCommon/CMakeLists.txt +++ b/Source/Core/AudioCommon/CMakeLists.txt @@ -6,7 +6,7 @@ set(SRCS Src/AudioCommon.cpp set(LIBS "") -if(APPLE) +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(SRCS ${SRCS} Src/CoreAudioSoundStream.cpp) else() if(ALSA_FOUND) @@ -37,6 +37,6 @@ endif() add_library(audiocommon STATIC ${SRCS}) target_link_libraries(audiocommon ${LIBS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index e573f32d05..e1d9ed3889 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -40,6 +40,6 @@ if(WIN32) endif(WIN32) add_library(common STATIC ${SRCS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 59c3caef74..d97a9fa422 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -133,9 +133,9 @@ set(SRCS Src/ActionReplay.cpp if(WIN32) 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) -elseif(UNIX) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Unix.cpp) endif() diff --git a/Source/Core/DSPCore/CMakeLists.txt b/Source/Core/DSPCore/CMakeLists.txt index 79a7c588e7..8ea572c808 100644 --- a/Source/Core/DSPCore/CMakeLists.txt +++ b/Source/Core/DSPCore/CMakeLists.txt @@ -23,6 +23,6 @@ set(SRCS Src/assemble.cpp Src/Jit/DSPJitMisc.cpp) add_library(dspcore STATIC ${SRCS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Source/Core/DebuggerUICommon/CMakeLists.txt b/Source/Core/DebuggerUICommon/CMakeLists.txt index 45455c93b1..0f4d9ac30e 100644 --- a/Source/Core/DebuggerUICommon/CMakeLists.txt +++ b/Source/Core/DebuggerUICommon/CMakeLists.txt @@ -3,6 +3,6 @@ set(SRCS Src/CodeView.cpp Src/MemoryView.cpp) add_library(debugger_ui_util STATIC ${SRCS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index f1102b2bb9..b6da129709 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -63,9 +63,9 @@ endif(XRANDR_FOUND) if(WIN32) set(SRCS ${SRCS} Src/stdafx.cpp) -elseif(APPLE AND NOT wxWidgets_FOUND) +elseif((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND) # TODO -elseif(APPLE AND wxWidgets_FOUND) +elseif((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND wxWidgets_FOUND) # TODO else() set(SRCS ${SRCS} Src/X11Utils.cpp) diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index a7322e8676..59c6d09175 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -11,7 +11,7 @@ if(WIN32) Src/ControllerInterface/DInput/DInputKeyboardMouse.cpp Src/ControllerInterface/SDL/SDL.cpp Src/ControllerInterface/XInput/XInput.cpp) -elseif(APPLE) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(SRCS ${SRCS} Src/ControllerInterface/OSX/OSX.mm Src/ControllerInterface/OSX/OSXKeyboard.mm diff --git a/Source/Core/VideoCommon/CMakeLists.txt b/Source/Core/VideoCommon/CMakeLists.txt index ae3db64119..4b5b39dfce 100644 --- a/Source/Core/VideoCommon/CMakeLists.txt +++ b/Source/Core/VideoCommon/CMakeLists.txt @@ -40,10 +40,10 @@ if(ENCODE_FRAMEDUMPS OR WIN32) endif() add_library(videocommon STATIC ${SRCS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(ENCODE_FRAMEDUMPS) target_link_libraries(videocommon avcodec swscale) add_definitions(-D__STDC_CONSTANT_MACROS) endif() add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Source/Core/VideoUICommon/CMakeLists.txt b/Source/Core/VideoUICommon/CMakeLists.txt index 8c71be91c2..c49211662a 100644 --- a/Source/Core/VideoUICommon/CMakeLists.txt +++ b/Source/Core/VideoUICommon/CMakeLists.txt @@ -1,6 +1,6 @@ set(SRCS Src/VideoConfigDiag.cpp) add_library(videouicommon STATIC ${SRCS}) -if(UNIX) +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") add_definitions(-fPIC) -endif(UNIX) +endif() diff --git a/Source/Core/wiiuse/CMakeLists.txt b/Source/Core/wiiuse/CMakeLists.txt index adfefe6ae0..069e77142c 100644 --- a/Source/Core/wiiuse/CMakeLists.txt +++ b/Source/Core/wiiuse/CMakeLists.txt @@ -1,9 +1,9 @@ set(SRCS Src/ir.cpp Src/wiiuse.cpp) -if(APPLE) +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") 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(LIBS ${LIBS} bluetooth) elseif(WIN32) diff --git a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt index 0452b0f1b1..7536ba7476 100644 --- a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt @@ -25,11 +25,11 @@ if(wxWidgets_FOUND) set(LIBS videouicommon ${LIBS}) 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) elseif(WIN32) set(SRCS ${SRCS} Src/OS/Win32.cpp) -elseif(NOT APPLE) +elseif(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) set(LIBS ${LIBS} clrun) endif()