diff options
| author | Maarten ter Huurne <maarten@treewalker.org> | 2011-12-17 16:30:02 +0100 |
|---|---|---|
| committer | Maarten ter Huurne <maarten@treewalker.org> | 2011-12-17 16:30:02 +0100 |
| commit | ed1bfdf29360ec96bf8333b373dd526b7483d869 (patch) | |
| tree | 138a9b326f1c5292d675a275e33f88f7350a7910 /Source/Core | |
| parent | a58c46be814398fa44bdbe92453d547f0becced4 (diff) | |
| parent | 83bf5790a66363d445b4e4e53cba91c260781e75 (diff) | |
Merge branch 'cmake-osx2'
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/AudioCommon/CMakeLists.txt | 50 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/aldlist.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/Common/Src/CPUDetect.cpp | 18 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/CMakeLists.txt | 106 | ||||
| -rw-r--r-- | Source/Core/DolphinWX/Info.plist.in | 63 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/CMakeLists.txt | 4 |
6 files changed, 200 insertions, 44 deletions
diff --git a/Source/Core/AudioCommon/CMakeLists.txt b/Source/Core/AudioCommon/CMakeLists.txt index 51476a6ea6..be8c58d14a 100644 --- a/Source/Core/AudioCommon/CMakeLists.txt +++ b/Source/Core/AudioCommon/CMakeLists.txt @@ -6,33 +6,33 @@ set(SRCS Src/AudioCommon.cpp set(LIBS "") +if(ALSA_FOUND) + set(SRCS ${SRCS} Src/AlsaSoundStream.cpp) + set(LIBS ${LIBS} ${ALSA_LIBRARIES}) +endif(ALSA_FOUND) + +if(AO_FOUND) + set(SRCS ${SRCS} Src/AOSoundStream.cpp) + set(LIBS ${LIBS} ${AO_LIBRARIES}) +endif(AO_FOUND) + +if(OPENAL_FOUND) + set(SRCS ${SRCS} Src/OpenALStream.cpp Src/aldlist.cpp) + set(LIBS ${LIBS} ${OPENAL_LIBRARY}) +endif(OPENAL_FOUND) + +if(PULSEAUDIO_FOUND) + set(SRCS ${SRCS} Src/PulseAudioStream.cpp) + set(LIBS ${LIBS} ${PULSEAUDIO_LIBRARIES}) +endif(PULSEAUDIO_FOUND) + +if(WIN32) + set(SRCS ${SRCS} Src/DSoundStream.cpp) + set(SRCS ${SRCS} Src/XAudio2Stream.cpp) +endif(WIN32) + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(SRCS ${SRCS} Src/CoreAudioSoundStream.cpp) -else() - if(ALSA_FOUND) - set(SRCS ${SRCS} Src/AlsaSoundStream.cpp) - set(LIBS ${LIBS} ${ALSA_LIBRARIES}) - endif(ALSA_FOUND) - - if(AO_FOUND) - set(SRCS ${SRCS} Src/AOSoundStream.cpp) - set(LIBS ${LIBS} ${AO_LIBRARIES}) - endif(AO_FOUND) - - if(OPENAL_FOUND) - set(SRCS ${SRCS} Src/OpenALStream.cpp Src/aldlist.cpp) - set(LIBS ${LIBS} openal) - endif(OPENAL_FOUND) - - if(PULSEAUDIO_FOUND) - set(SRCS ${SRCS} Src/PulseAudioStream.cpp) - set(LIBS ${LIBS} ${PULSEAUDIO_LIBRARIES}) - endif(PULSEAUDIO_FOUND) - - if(WIN32) - set(SRCS ${SRCS} Src/DSoundStream.cpp) - set(SRCS ${SRCS} Src/XAudio2Stream.cpp) - endif(WIN32) endif() add_library(audiocommon STATIC ${SRCS}) diff --git a/Source/Core/AudioCommon/Src/aldlist.cpp b/Source/Core/AudioCommon/Src/aldlist.cpp index 2008842486..69d42148ae 100644 --- a/Source/Core/AudioCommon/Src/aldlist.cpp +++ b/Source/Core/AudioCommon/Src/aldlist.cpp @@ -27,6 +27,9 @@ #ifdef _WIN32 #include "../../../../Externals/OpenAL/include/al.h" #include "../../../../Externals/OpenAL/include/alc.h" +#elif defined(__APPLE__) +#include <al.h> +#include <alc.h> #else #include <AL/al.h> #include <AL/alc.h> diff --git a/Source/Core/Common/Src/CPUDetect.cpp b/Source/Core/Common/Src/CPUDetect.cpp index 7c231b0a69..99e43f5c46 100644 --- a/Source/Core/Common/Src/CPUDetect.cpp +++ b/Source/Core/Common/Src/CPUDetect.cpp @@ -43,29 +43,27 @@ static inline void do_cpuid(unsigned int *eax, unsigned int *ebx, // Note: EBX is reserved on Mac OS X and in PIC on Linux, so it has to // restored at the end of the asm block. __asm__ ( - "mov %%rbx,%%rdi;" + "pushq %%rbx;" "cpuid;" "movl %%ebx,%1;" - "mov %%rdi,%%rbx;" + "popq %%rbx;" : "=a" (*eax), - "=g" (*ebx), + "=S" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) - : "rdi", "rbx" ); #else - __asm__( - "movl %%ebx,%%edi;" + __asm__ ( + "pushl %%ebx;" "cpuid;" - "movl %%ebx,%1;" - "movl %%edi,%%ebx;" + "movl %%ebx,%1;" + "popl %%ebx;" : "=a" (*eax), - "=g" (*ebx), + "=S" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (*eax) - : "edi", "ebx" ); #endif } diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 438ee9ce82..2d7ed7e0ce 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -1,5 +1,5 @@ set(LIBS core - lzo2 + ${LZO} discio bdisasm inputcommon @@ -8,7 +8,7 @@ set(LIBS core z sfml-network SDL - GL + ${OPENGL_LIBRARIES} ${XRANDR_LIBRARIES} ${X11_LIBRARIES}) @@ -71,10 +71,28 @@ endif() if(WIN32) set(SRCS ${SRCS} Src/stdafx.cpp) -elseif((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND NOT wxWidgets_FOUND) - # TODO -elseif((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND wxWidgets_FOUND) - # TODO +elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + # Link against OS X system frameworks. + list(APPEND LIBS + ${APPKIT_LIBRARY} + ${AU_LIBRARY} + ${COREAUDIO_LIBRARY} + ${COREFUND_LIBRARY} + ${CORESERV_LIBRARY} + ${IOB_LIBRARY} + ${IOK_LIBRARY} + ) + if(wxWidgets_FOUND) + list(APPEND LIBS + ${APPSERV_LIBRARY} + ${COCOA_LIBRARY} + ) + endif() + # Add resource files to application bundle. + set(RESOURCES resources/Dolphin.icns) + list(APPEND SRCS ${RESOURCES}) + set_source_files_properties(${RESOURCES} PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) else() set(SRCS ${SRCS} Src/X11Utils.cpp) endif() @@ -84,13 +102,83 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR set(LIBS ${LIBS} usbhid) endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(DOLPHIN_EXE_BASE Dolphin) +else() + set(DOLPHIN_EXE_BASE dolphin-emu) +endif() if(wxWidgets_FOUND) - set(DOLPHIN_EXE dolphin-emu) + set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}) else() - set(DOLPHIN_EXE dolphin-emu-nogui) + set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}-nogui) endif() add_executable(${DOLPHIN_EXE} ${SRCS}) target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS}) -install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + include(BundleUtilities) + set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) + + # Ask for an application bundle. + set_target_properties(${DOLPHIN_EXE} PROPERTIES + MACOSX_BUNDLE true + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in + ) + + # Install Cg framework into application bundle. + copy_resolved_framework_into_bundle( + # Our framework in "Externals" does not have "Versions/Current/" in + # its path; work around the missing directory levels using "././". + "${CMAKE_SOURCE_DIR}/Externals/Cg/Cg.framework/././Cg" + "${BUNDLE_PATH}/Contents/Frameworks/Cg.framework/././Cg" + ) + + # Fix up the bundle after it is finished. + # There does not seem to be an easy way to run CMake commands post-build, + # so we invoke CMake again on a generated script. + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake " + include(BundleUtilities) + message(\"Fixing up application bundle: ${BUNDLE_PATH}\") + fixup_bundle(\"${BUNDLE_PATH}\" \"\" \"\") + ") + add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD + COMMAND ${CMAKE_COMMAND} -P postprocess_bundle.cmake + ) + + # Copy data files into application bundle. + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/copy_data_into_bundle.cmake " + file(INSTALL ${CMAKE_SOURCE_DIR}/Data/Sys ${CMAKE_SOURCE_DIR}/Data/User + DESTINATION ${BUNDLE_PATH}/Contents/Resources + ) + file(GLOB TRANSLATION_FILES RELATIVE ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}/*.gmo + ) + foreach(TRANSLATION_FILE \${TRANSLATION_FILES}) + string(REPLACE \".gmo\" \".lproj\" TRANSLATION_DIR + \${TRANSLATION_FILE} + ) + # It would be better to copy to the new name as a single action, + # but I can't figure out a way to let CMake do that. + file(COPY ${CMAKE_BINARY_DIR}/\${TRANSLATION_FILE} + DESTINATION ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR} + NO_SOURCE_PERMISSIONS + ) + file(RENAME + ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR}/\${TRANSLATION_FILE} + ${BUNDLE_PATH}/Contents/Resources/\${TRANSLATION_DIR}/dolphin-emu.mo + ) + endforeach(TRANSLATION_FILE) + ") + add_custom_target(CopyDataIntoBundle ALL + COMMAND ${CMAKE_COMMAND} -P copy_data_into_bundle.cmake + VERBATIM + ) + + # Install bundle into systemwide /Applications directory. + install(DIRECTORY ${BUNDLE_PATH} DESTINATION /Applications + USE_SOURCE_PERMISSIONS + ) +else() + install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) +endif() diff --git a/Source/Core/DolphinWX/Info.plist.in b/Source/Core/DolphinWX/Info.plist.in new file mode 100644 index 0000000000..9a05a972c8 --- /dev/null +++ b/Source/Core/DolphinWX/Info.plist.in @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDocumentTypes</key> + <array> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>ciso</string> + <string>dol</string> + <string>elf</string> + <string>gcm</string> + <string>gcz</string> + <string>iso</string> + <string>wad</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>Dolphin.icns</string> + <key>CFBundleTypeName</key> + <string>Nintendo GC/Wii file</string> + <key>CFBundleTypeRole</key> + <string>Viewer</string> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>Dolphin</string> + <key>CFBundleIconFile</key> + <string>Dolphin.icns</string> + <key>CFBundleIdentifier</key> + <string>com.dolphin-emulator.dolphin</string> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleLocalizations</key> + <array> + <string>ar</string> + <string>el</string> + <string>en</string> + <string>es</string> + <string>fr</string> + <string>hu</string> + <string>pt</string> + <string>pt_BR</string> + <string>tr</string> + </array> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>${DOLPHIN_WC_DESCRIBE}</string> + <key>CFBundleLongVersionString</key> + <string>${DOLPHIN_WC_REVISION}</string> + <key>CFBundleVersion</key> + <string>${DOLPHIN_VERSION_MAJOR}.${DOLPHIN_VERSION_MINOR}</string> + <key>NSHumanReadableCopyright</key> + <string>Licensed under GPL version 2</string> + <key>LSMinimumSystemVersion</key> + <string>${OSX_MIN_VERSION}</string> + <key>LSRequiresCarbon</key> + <true/> + <key>CSResourcesFileMapped</key> + <true/> +</dict> +</plist> diff --git a/Source/Core/VideoCommon/CMakeLists.txt b/Source/Core/VideoCommon/CMakeLists.txt index 481ced250a..d0e28f571c 100644 --- a/Source/Core/VideoCommon/CMakeLists.txt +++ b/Source/Core/VideoCommon/CMakeLists.txt @@ -40,6 +40,10 @@ set(SRCS Src/BPFunctions.cpp Src/memcpy_amd.cpp) set(LIBS core) +if(NOT ${CL} STREQUAL CL-NOTFOUND) + list(APPEND LIBS ${CL}) +endif() + if(wxWidgets_FOUND AND WIN32) set(SRCS ${SRCS} Src/EmuWindow.cpp) endif() |
