Merge branch 'cmake-osx2'

This commit is contained in:
Maarten ter Huurne
2011-12-17 16:30:02 +01:00
12 changed files with 1602 additions and 82 deletions

View File

@ -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})

View File

@ -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>

View File

@ -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
}

View File

@ -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(wxWidgets_FOUND)
set(DOLPHIN_EXE dolphin-emu)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DOLPHIN_EXE_BASE Dolphin)
else()
set(DOLPHIN_EXE dolphin-emu-nogui)
set(DOLPHIN_EXE_BASE dolphin-emu)
endif()
if(wxWidgets_FOUND)
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE})
else()
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()

View File

@ -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>

View File

@ -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()