diff --git a/examples/common/entry/entry_ios.mm b/examples/common/entry/entry_ios.mm index 86eefb34..9a9a2d6a 100644 --- a/examples/common/entry/entry_ios.mm +++ b/examples/common/entry/entry_ios.mm @@ -60,13 +60,19 @@ namespace entry int32_t MainThreadEntry::threadFunc(void* _userData) { CFBundleRef mainBundle = CFBundleGetMainBundle(); - CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); - char path[PATH_MAX]; - if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX) ) + if ( mainBundle != nil ) { - chdir(path); + CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); + if ( resourcesURL != nil ) + { + char path[PATH_MAX]; + if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX) ) + { + chdir(path); + } + CFRelease(resourcesURL); + } } - CFRelease(resourcesURL); MainThreadEntry* self = (MainThreadEntry*)_userData; int32_t result = main(self->m_argc, self->m_argv); diff --git a/examples/common/entry/entry_osx.mm b/examples/common/entry/entry_osx.mm index 84358401..40d6d6a4 100644 --- a/examples/common/entry/entry_osx.mm +++ b/examples/common/entry/entry_osx.mm @@ -57,6 +57,21 @@ namespace entry static int32_t threadFunc(void* _userData) { + CFBundleRef mainBundle = CFBundleGetMainBundle(); + if ( mainBundle != nil ) + { + CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); + if ( resourcesURL != nil ) + { + char path[PATH_MAX]; + if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX) ) + { + chdir(path); + } + CFRelease(resourcesURL); + } + } + MainThreadEntry* self = (MainThreadEntry*)_userData; return main(self->m_argc, self->m_argv); } diff --git a/examples/runtime/iOS-Info.plist b/examples/runtime/iOS-Info.plist new file mode 100644 index 00000000..f5f3fc1a --- /dev/null +++ b/examples/runtime/iOS-Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.company.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UIStatusBarHidden + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/makefile b/makefile index 58656f5b..37c18240 100644 --- a/makefile +++ b/makefile @@ -24,7 +24,8 @@ all: $(GENIE) --with-tools --with-shared-lib --gcc=mingw-gcc gmake $(GENIE) --with-tools --with-shared-lib --gcc=linux-gcc gmake $(GENIE) --with-tools --with-shared-lib --gcc=osx gmake - $(GENIE) --with-tools --with-shared-lib xcode4 + $(GENIE) --with-tools --with-shared-lib --xcode=osx xcode4 + $(GENIE) --with-tools --with-shared-lib --xcode=ios xcode4 $(GENIE) --gcc=android-arm gmake $(GENIE) --gcc=android-mips gmake diff --git a/scripts/example-common.lua b/scripts/example-common.lua index 8e0c0dd8..1b02e8f9 100644 --- a/scripts/example-common.lua +++ b/scripts/example-common.lua @@ -34,10 +34,6 @@ project ("example-common") "$(DXSDK_DIR)/include", } - configuration { "xcode4" } - includedirs { - BX_DIR .. "include/compat/osx", - } configuration { "winphone8*"} linkoptions { diff --git a/scripts/genie.lua b/scripts/genie.lua index 8b26a7a9..0f9cf81a 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -29,12 +29,18 @@ solution "bgfx" "Release", } - platforms { - "x32", - "x64", --- "Xbox360", - "Native", -- for targets where bitness is not specified + if _ACTION == "xcode4" then + platforms { + "Universal", } + else + platforms { + "x32", + "x64", +-- "Xbox360", + "Native", -- for targets where bitness is not specified + } + end language "C++" startproject "example-00-helloworld" @@ -237,19 +243,6 @@ function exampleProject(_name) "OpenGL.framework", } - configuration { "xcode4" } - platforms { - "Universal" - } - files { - BGFX_DIR .. "examples/common/**.mm", - } - links { - "Cocoa.framework", - "Foundation.framework", - "OpenGL.framework", - } - configuration { "ios*" } kind "ConsoleApp" files { @@ -263,6 +256,12 @@ function exampleProject(_name) "-framework QuartzCore", } + configuration { "xcode4", "ios" } + kind "WindowedApp" + files { + BGFX_DIR .. "examples/runtime/iOS-Info.plist" + } + configuration { "qnx*" } targetextension "" links {