Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add iOS/tvOS support #61

Merged
merged 1 commit into from Aug 10, 2017
Merged

Add iOS/tvOS support #61

merged 1 commit into from Aug 10, 2017

Conversation

@blacktm
Copy link
Member

@blacktm blacktm commented Jul 6, 2017

No description provided.

@andrewhavens
Copy link
Contributor

@andrewhavens andrewhavens commented Jul 6, 2017

Nice! 👍

@blacktm blacktm changed the title WIP 🚧 Add iOS/tvOS support Add iOS/tvOS support Aug 3, 2017
@blacktm
Copy link
Member Author

@blacktm blacktm commented Aug 3, 2017

Whew! I think this is good to go.

@andrewhavens If you're feeling adventurous, feel free to give the branch a try:

  1. git clone --recursive https://github.com/simple2d/simple2d.git
  2. cd simple2d and git checkout add-ios-tvos-support
  3. make release to build Apple frameworks
  4. Open the iOS simulator, run make ios to build and run the triangle test app
  5. In the simulator, switch the hardware device to tvOS, run make tvos to build and run the same app
@andrewhavens
Copy link
Contributor

@andrewhavens andrewhavens commented Aug 3, 2017

Awesome! 👍 I'll try it out later today.

@andrewhavens
Copy link
Contributor

@andrewhavens andrewhavens commented Aug 3, 2017

@blacktm I think there might be a bug in the instructions you gave me:

$ git clone --recursive https://github.com/simple2d/simple2d.git
Cloning into 'simple2d'...
remote: Counting objects: 1675, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 1675 (delta 15), reused 25 (delta 15), pack-reused 1645
Receiving objects: 100% (1675/1675), 435.24 KiB | 0 bytes/s, done.
Resolving deltas: 100% (1058/1058), done.
Submodule 'deps' (https://github.com/simple2d/windows-deps.git) registered for path 'deps'
Submodule 'test/media' (https://github.com/simple2d/test_media.git) registered for path 'test/media'
Cloning into '.../simple2d/deps'...
remote: Counting objects: 182, done.        
remote: Total 182 (delta 0), reused 0 (delta 0), pack-reused 182        
Receiving objects: 100% (182/182), 7.50 MiB | 1.00 MiB/s, done.
Resolving deltas: 100% (58/58), done.
Cloning into '.../simple2d/test/media'...
remote: Counting objects: 41, done.        
remote: Total 41 (delta 0), reused 0 (delta 0), pack-reused 41        
Submodule path 'deps': checked out '39c037e25cdc6b836d07cfe794d79a512f8e696c'
Submodule path 'test/media': checked out 'fd57d1c22c11b1cc84b160236718b7e26c438a36'

$ cd simple2d

$ git checkout add-ios-tvos-support
M	deps
Branch add-ios-tvos-support set up to track remote branch add-ios-tvos-support from origin.
Switched to a new branch 'add-ios-tvos-support'

$ git status
On branch add-ios-tvos-support
Your branch is up-to-date with 'origin/add-ios-tvos-support'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   deps (new commits)

$ make release
# ...
==> Building iOS and tvOS release

cp -R deps/xcode/Simple2D.xcodeproj build
cp: deps/xcode/Simple2D.xcodeproj: No such file or directory
make: *** [release] Error 1
@blacktm
Copy link
Member Author

@blacktm blacktm commented Aug 3, 2017

Ah, maybe you have to run...

git submodule init
git submodule update --remote

...in the branch to get the new sub module contents.

@andrewhavens
Copy link
Contributor

@andrewhavens andrewhavens commented Aug 4, 2017

@blacktm By the way, I tried it again yesterday, using the new instructions and it worked! Really nice "build and launch simulator" experience!

@blacktm
Copy link
Member Author

@blacktm blacktm commented Aug 4, 2017

@andrewhavens Great to hear — thanks for giving it a go! Good to know about the submodule init/updating for future testing. Tried to make it super simple, so I'm glad you also liked the simulator experience! Took me quite a while to figure out all the xcrun simctl install/launch booted automation stuff. Apparently you can do open -a Simulator --args -CurrentDeviceUDID <UDID> to open a specific simulator, but you have to know the UDID in advance (wish I could choose "iPhone 7" instead). Another issue is that the simulator opens asynchronously, so the open command finishes before the simulator starts, and xcrun simctl returns "no simulator available", ugh. Wonder how RubyMotion handles all this 🤔

@blacktm
Copy link
Member Author

@blacktm blacktm commented Aug 4, 2017

Looks like Fastlane is written in Ruby and has figured all this stuff out. Might have to borrow stuff from device_manager.rb

@blacktm
Copy link
Member Author

@blacktm blacktm commented Aug 7, 2017

Well, I figured out the UDID and asyc simulator opening issues, and went a little crazy creating an all new simulator command and enhancing the build command for Xcode projects in 68c6734. See the simulator and build command usage. So much fun automating this stuff!

@blacktm blacktm force-pushed the add-ios-tvos-support branch from ac710b1 to b21d2e3 Aug 10, 2017
- Entire `src/` directory can now be compiled (no need to omit certain sources)
- 32-bit color is now enabled for OpenGL ES
- Adds `S2D_DISPLAY_WIDTH` and `S2D_DISPLAY_HEIGHT` to set window to dimensions of
the display
- Cleans up `S2D_Log`, now more `printf` like (no need to write to a char buffer with
`sprintf`)
- Now prints the current display mode when diagnostics are enabled
- Removes the `windows-deps` submodule and replaces it with the new `deps` submodule,
which contains new iOS and tvOS frameworks and Xcode assets
- Adds a new `release` make target to generate iOS and tvOS frameworks, and an
`install-frameworks` target to install them to `$(PREFIX)/Frameworks/Simple2D`
- Adds a new triangle test tailored for iOS and tvOS
- Adds `ios` and `tvos` make targets to build and run the triangle test for iOS and
tvOS automagically
- Adds a `simple2d simulator` command to interact with the iOS and tvOS device
simulators
- Updates the `simple2d build` command to now build Xcode projects
@blacktm blacktm force-pushed the add-ios-tvos-support branch from b21d2e3 to 210bbec Aug 10, 2017
@blacktm blacktm merged commit c407789 into master Aug 10, 2017
@blacktm blacktm deleted the add-ios-tvos-support branch Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.