diff --git a/CMakeLists.txt b/CMakeLists.txt index 091ce5175a..d663a2a4a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ if(VISIBILITY_INLINES_HIDDEN) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") endif(VISIBILITY_INLINES_HIDDEN) -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if(UNIX AND NOT APPLE) CHECK_CXX_COMPILER_FLAG(-fvisibility=hidden VISIBILITY_HIDDEN) if(VISIBILITY_HIDDEN) add_definitions(-fvisibility=hidden) @@ -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(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +if(UNIX AND NOT APPLE) if(X11_FOUND) add_definitions(-DHAVE_X11=1) include_directories(${X11_INCLUDE_DIR}) @@ -270,7 +270,7 @@ if(SDL_FOUND) else(SDL_FOUND) # TODO: Use the prebuilt one on Windows message("Shared SDL not found, falling back to the static library") - include_directories(Externals/SDL/include) + include_directories(Externals/SDL Externals/SDL/include) add_subdirectory(Externals/SDL) endif(SDL_FOUND) @@ -309,11 +309,17 @@ if(WIN32) include_directories(Externals/GLew/include) else() check_lib(GLU glu 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) + check_lib_and_header(GLEW GLEW GL/glew.h OPTIONAL) + check_lib_and_header(CG Cg Cg/cg.h OPTIONAL) + check_lib_and_header(CGGL CgGL Cg/cgGL.h OPTIONAL) endif() +if(NOT GLEW_FOUND) + message("Shared GLEW not found, falling back to the static library") + add_subdirectory(Externals/GLew) + include_directories(Externals/GLew/include) +endif(NOT GLEW_FOUND) + if(NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) include_directories(Externals/CLRun/include) add_subdirectory(Externals/CLRun) @@ -327,7 +333,7 @@ if(NOT DISABLE_WX) if(wxWidgets_FOUND) include(${wxWidgets_USE_FILE}) - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + if(UNIX AND NOT APPLE) check_lib(GTK2 gtk+-2.0 REQUIRED) if(GTK2_FOUND) include_directories(${GTK2_INCLUDE_DIRS}) @@ -348,7 +354,7 @@ endif(NOT DISABLE_WX) # Pre-build events: Define configuration variables and write svnrev header # file(WRITE ${PROJECT_BINARY_DIR}/Source/Core/Common/Src/svnrev.h - "#define SVN_REV_STR \"" ${DOLPHIN_WC_REVISION} "-" ${CMAKE_BUILD_TYPE} "\"") + "#define SVN_REV_STR \"" ${DOLPHIN_WC_REVISION} "-" ${CMAKE_BUILD_TYPE} "\"\n") ######################################## # Start compiling our code diff --git a/Externals/GLew/CMakeLists.txt b/Externals/GLew/CMakeLists.txt new file mode 100644 index 0000000000..1ff0800529 --- /dev/null +++ b/Externals/GLew/CMakeLists.txt @@ -0,0 +1,7 @@ +include_directories(include) + +set(SRCS src/glew.c + src/glewinfo.c + src/visualinfo.c) + +add_library(GLEW STATIC ${SRCS}) diff --git a/Externals/SDL/CMakeLists.txt b/Externals/SDL/CMakeLists.txt index 64314222b1..33a42362e3 100644 --- a/Externals/SDL/CMakeLists.txt +++ b/Externals/SDL/CMakeLists.txt @@ -1,17 +1,18 @@ add_definitions(-DSDL_VIDEO_DISABLED=1) add_definitions(-DSDL_EVENTS_DISABLED=1) -set(SRCS src/SDL.c - src/SDL_error.c - src/SDL_fatal.c - src/joystick/SDL_joystick.c) - -# TODO: for BSD: add usbhid to libs, add joystick/bsd/SDL_sysjoystick.c, stdlib/SDL_malloc.c and stdlib/SDL_string.c to sources +set(SRCS src/SDL.c src/SDL_error.c src/SDL_fatal.c src/joystick/SDL_joystick.c) if(APPLE) set(SRCS ${SRCS} src/joystick/darwin/SDL_sysjoystick.c) -elseif(UNIX) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(SRCS ${SRCS} src/joystick/linux/SDL_sysjoystick.c) + set(SRCS ${SRCS} src/stdlib/SDL_string.c) +elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") + set(SRCS ${SRCS} src/joystick/bsd/SDL_sysjoystick.c) + set(SRCS ${SRCS} src/stdlib/SDL_malloc.c) + set(SRCS ${SRCS} src/stdlib/SDL_string.c) elseif(WIN32) set(SRCS ${SRCS} src/joystick/win32/SDL_mmjoystick.c) else() diff --git a/Externals/SFML/CMakeLists.txt b/Externals/SFML/CMakeLists.txt index 0021f7135f..86c086420d 100644 --- a/Externals/SFML/CMakeLists.txt +++ b/Externals/SFML/CMakeLists.txt @@ -8,7 +8,7 @@ set(SRCS src/SFML/Network/Ftp.cpp src/SFML/Network/SocketTCP.cpp src/SFML/Network/SocketUDP.cpp) -if(UNIX OR APPLE) +if(UNIX) set(SRCS ${SRCS} src/SFML/Network/Unix/SocketHelper.cpp) elseif(WIN32) set(SRCS ${SRCS} src/SFML/Network/Win32/SocketHelper.cpp) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index d97a9fa422..b5d25cc661 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -135,7 +135,7 @@ if(WIN32) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Win32.cpp Src/stdafx.cpp) elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Apple.cpp) -elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") +elseif(UNIX) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Unix.cpp) endif() diff --git a/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp b/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp index 3beb607417..151fc12abb 100644 --- a/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp +++ b/Source/Core/DSPCore/Src/Jit/DSPJitMisc.cpp @@ -321,7 +321,7 @@ void DSPEmitter::mrr(const UDSPInstruction opc) dsp_conditional_extend_accum(dreg); } -/* +#if 0 // LRI $D, #I // 0000 0000 100d dddd // iiii iiii iiii iiii @@ -332,15 +332,14 @@ void DSPEmitter::mrr(const UDSPInstruction opc) // register, has a different behaviour in S40 mode if loaded to AC0.M: The // value gets sign extended to the whole accumulator! This does not happen in // S16 mode. -/*void DSPEmitter::lri(const UDSPInstruction opc) +void DSPEmitter::lri(const UDSPInstruction opc) { u8 reg = opc & DSP_REG_MASK; u16 imm = dsp_fetch_code(); dsp_op_write_reg(reg, imm); dsp_conditional_extend_accum(reg); } -*/ - +#endif // LRIS $(0x18+D), #I // 0000 1ddd iiii iiii diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 50be4ae0c8..c8cbbb819e 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -16,10 +16,6 @@ set(LIBS core ${X11_LIBRARIES}) if(wxWidgets_FOUND) - set(MEMCARDSRCS Src/MemcardManager.cpp - Src/MemoryCards/GCMemcard.cpp - Src/WxUtils.cpp) - set(SRCS ${SRCS} Src/AboutDolphin.cpp Src/ARCodeAddEdit.cpp @@ -38,6 +34,8 @@ if(wxWidgets_FOUND) Src/LogWindow.cpp Src/LuaWindow.cpp Src/Main.cpp + Src/MemcardManager.cpp + Src/MemoryCards/GCMemcard.cpp Src/NetPlay.cpp Src/NetPlayClient.cpp Src/NetPlayServer.cpp @@ -45,12 +43,12 @@ if(wxWidgets_FOUND) Src/PatchAddEdit.cpp Src/UDPConfigDiag.cpp Src/WiimoteConfigDiag.cpp - Src/MemoryCards/WiiSaveCrypted.cpp) + Src/MemoryCards/WiiSaveCrypted.cpp + Src/WxUtils.cpp) set(WXLIBS debwx debugger_ui_util inputuicommon - memcard ${wxWidgets_LIBRARIES} ${GTK2_LIBRARIES}) @@ -70,11 +68,15 @@ else() set(SRCS ${SRCS} Src/X11Utils.cpp) endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") + set(LIBS ${LIBS} usbhid) +endif() + set(EXEGUI dolphin-emu) set(EXENOGUI dolphin-emu-nogui) if(wxWidgets_FOUND) - add_library(memcard STATIC ${MEMCARDSRCS}) add_executable(${EXEGUI} ${SRCS}) target_link_libraries(${EXEGUI} ${LIBS} ${WXLIBS}) install(TARGETS ${EXEGUI} RUNTIME DESTINATION ${bindir}) diff --git a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt index 8679e53353..e47aac4ac5 100644 --- a/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt +++ b/Source/Plugins/Plugin_VideoOGL/CMakeLists.txt @@ -15,8 +15,6 @@ set(LIBS videocommon GLEW SOIL common - Cg - CgGL ${OPENGL_LIBRARIES} ${X11_LIBRARIES}) @@ -30,10 +28,21 @@ 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 (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")) +endif() + +if(APPLE OR WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(LIBS ${LIBS} Cg CgGL) +endif() + +if(WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "Linux") set(LIBS ${LIBS} clrun) endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR + ${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") + set(LIBS ${LIBS} usbhid) +endif() + add_library(Plugin_VideoOGL MODULE ${SRCS}) target_link_libraries(Plugin_VideoOGL ${LIBS}) install(TARGETS Plugin_VideoOGL