get osx app bundle working
This commit is contained in:
parent
492f1bf7b2
commit
c76bd2ae46
|
@ -1,11 +1,15 @@
|
|||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OSX deployment version" FORCE)
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "OSX target CPU architectures" FORCE)
|
||||
|
||||
cmake_minimum_required(VERSION 3.9)
|
||||
project(cgbwebcam)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# i think SDL should be setting this
|
||||
if(APPLE)
|
||||
# i think SDL should be setting this
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-framework AVFoundation")
|
||||
set(SDL_CPU_X64 ON)
|
||||
set(SDL_CPU_ARM64 ON)
|
||||
endif()
|
||||
|
||||
set(SDL_STATIC ON)
|
||||
|
@ -39,9 +43,26 @@ add_subdirectory(mgba)
|
|||
include_directories(SDL/include)
|
||||
include_directories(mgba/include)
|
||||
|
||||
#set_source_files_properties(main.c PROPERTIES COMPILE_FLAGS "-Wall -Werror -pedantic -std=c89")
|
||||
set_source_files_properties(main.c PROPERTIES COMPILE_FLAGS "-Wall -Werror -pedantic -std=c99 -Wno-extra-semi")
|
||||
|
||||
add_executable(cgbwebcam main.c)
|
||||
if(APPLE)
|
||||
set(cgbwebcam_ICON ${CMAKE_SOURCE_DIR}/cmake/cgbwebcam.icns)
|
||||
set_source_files_properties(${cgbwebcam_ICON} PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION "Resources")
|
||||
add_executable(cgbwebcam MACOSX_BUNDLE main.c ${cgbwebcam_ICON})
|
||||
set_target_properties(cgbwebcam PROPERTIES
|
||||
BUNDLE True
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "net.hell-labs.cgbwebcam"
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "cgbwebcam"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION "0.1"
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "0.1"
|
||||
MACOSX_BUNDLE_ICON_FILE cgbwebcam.icns
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/cmake/Templates/Info.plist
|
||||
# OSX_ARCHITECTURES "x86_64;arm64"
|
||||
)
|
||||
else()
|
||||
add_executable(cgbwebcam main.c)
|
||||
endif()
|
||||
target_link_libraries(cgbwebcam SDL3-static mgba)
|
||||
|
||||
include(CheckIPOSupported)
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?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>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE}</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>${MACOSX_BUNDLE_ICON}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>cgbwebcam requires access to your camera in order to simulate the Gameboy Camera's sensor.</string>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
3
main.c
3
main.c
|
@ -578,6 +578,9 @@ SDL_AppResult SDL_AppIterate(void* appstate) {
|
|||
SDL_SetTextureColorMod(st->textures[0], 255, 0, 0);
|
||||
SDL_SetTextureColorMod(st->textures[1], 0, 255, 0);
|
||||
SDL_SetTextureColorMod(st->textures[2], 0, 0, 255);
|
||||
|
||||
/* weird bug on OSX, shows file browser twice if unfocused when selecting camera */
|
||||
SDL_RaiseWindow(st->window);
|
||||
return SDL_APP_CONTINUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue