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

Extensions in xcode #468

Merged
merged 65 commits into from
Aug 7, 2015
Merged

Extensions in xcode #468

merged 65 commits into from
Aug 7, 2015

Conversation

cmsj
Copy link
Member

@cmsj cmsj commented Aug 5, 2015

This is my WIP PR for switching extensions over to building in Xcode. Closes #34

@asmagill definitely needs to look at this and comment :D

(the good news is that I'm not changing the structure of the app bundle at all. I gave up trying to make it work, and am just using a script to copy the dylibs into the old places, with the old names, just with a .dylib extension instead of a .so)

@cmsj
Copy link
Member Author

cmsj commented Aug 5, 2015

Also I'd appreciate it if people take things a little easy on submitting C code for a couple of days, so I can get this conversion done and landed. It's hairy enough without a huge amount of rebasing!

@cmsj
Copy link
Member Author

cmsj commented Aug 5, 2015

I'd also note that so far this isn't doing anything with init.lua's, they are still being copied around by build_extensions.sh. That will need to change, but shouldn't be too hard to push into an xcode build phase script.

@asmagill
Copy link
Member

asmagill commented Aug 6, 2015

having problems compiling...

First, it fails to compile from the command line using just "make" (I forget the exact error, but will post a copy in here later)... fine, still in testing, the real test is in Xcode.

Within Xcode, I select Build from the Product menu (I've tried Scheme as both Build and Hammerspoon... no difference), and it gives out on target hammerspoon.h (

...

    /bin/sh -c /Users/amagill/Library/Developer/Xcode/DerivedData/Hammerspoon-hgvghytozltqbfaalzsrhqdwqvpd/Build/Intermediates/Hammerspoon.build/Release/Hammerspoon.build/Script-4FBE2D161B7268DF00407788.sh

cp: /Hammerspoon.app/Contents/Resources/extensions/hs//alert/internal.so: No such file or directory
cp: /Hammerspoon.app/Contents/Resources/extensions/hs//applescript/internal.so: No such file or directory
cp: /Hammerspoon.app/Contents/Resources/extensions/hs//application/internal.so: No such file or directory
cp: /Hammerspoon.app/Contents/Resources/extensions/hs//application/watcher.so: No such file or directory
cp: /Hammerspoon.app/Contents/Resources/extensions/hs//audiodevice/internal.so: No such file or directory
cp: /Hammerspoon.app/Contents/Resources/extensions/hs//base64/internal.so: No such file or directory
cp: /Hammerspoon.app/Contents/Resources/extensions/hs//battery/internal.so: No such file or directory
cp: /Hammerspoon.app/Contents/Resources/extensions/hs//battery/watcher.so: No such file or directory

So... what step or setting am I missing to get this to compile?

@cmsj
Copy link
Member Author

cmsj commented Aug 6, 2015

@asmagill try again with the latest code? If it still doesn't work, in the build log, could you right click and choose Expand All Transcripts and send me a dump of the failed bit? I think I've made it more robust since I last pushed, but I've lost track a bit!

@asmagill
Copy link
Member

asmagill commented Aug 6, 2015

That did it...

Oddly Smartgit tells me when a branch gets updated and allows me to pull it... not so for pull requests -- have to locally purge and repull them just to check... learn something new everyday... like, maybe I should breakdown and learn to use git from the terminal :-)

On Aug 6, 2015, at 10:50 AM, Chris Jones notifications@github.com wrote:

@asmagill https://github.com/asmagill try again with the latest code? If it still doesn't work, in the build log, could you right click and choose Expand All Transcripts and send me a dump of the failed bit? I think I've made it more robust since I last pushed, but I've lost track a bit!


Reply to this email directly or view it on GitHub #468 (comment).

cmsj added 24 commits August 6, 2015 19:42
our namespace. Revert a few libfoo symbols to foo_internal symbols. Add
hs.application{,.watcher} to xcode building
…loop over data, rather than lots of commands, and switch from .dylib to .so
…ode build scripts. Add support for Lua-only modules to the Xcode script for installing modules. Refactor build_extensions.sh to entirely skip migrated modules
@cmsj
Copy link
Member Author

cmsj commented Aug 7, 2015

@asmagill ok, assuming this passes Travis, we should be fully converted! Test away :)
I'm running it locally and all seems completely fine.

The last commit (GNU empty initializer extension removal) shouldn't really have snuck in here, but I forgot to make a child branch for cleaning up build warnings.

@cmsj
Copy link
Member Author

cmsj commented Aug 7, 2015

I think I'm just going to land this, but I'm not decided yet, whether I should merge the history, or squash it into a single, hilariously inscrutable commit.

cmsj added a commit that referenced this pull request Aug 7, 2015
Switch all extensions from using our scripted/hacky home grown build system, to being library targets in Hammerspoon.xcodeproj. Closes #34
@cmsj cmsj merged commit 92cafc1 into Hammerspoon:master Aug 7, 2015
@asmagill
Copy link
Member

What are the steps for adding a new extension to core to be included in this new process?

@cmsj
Copy link
Member Author

cmsj commented Aug 16, 2015

@asmagil yeah sorry I haven't updated CONTRIBUTING yet :/

First, for either pure Lua modules, or hybrid modules, add the source as a folder in extensions/ as normal. Then in the Xcode project browser (cmd-1) expand the Hammerspoon project to find the yellow extensions folder, right click it and choose New Group and then give it the new name and move it to the right point in the list. Right click the new group and choose Add files, select the C/Lua source/header files from the new extension and make sure Copy Files If Needed is unticked.

Then, for a pure Lua module, in the Xcode project browser column (left pane) choose the blue Hammerspoon project icon at the top, then choose the yellow Hammerspoon app target in the middle pane, go to Build Phases, expand Copy Extensions To Bundle and add the module name to HS_LUAONLY.

Or, for a hybrid module, go to the blue Hammerspoon project icon, right click on the "alert" target, choose Duplicate. Rename the new "alert copy" target. Click on the Scheme chooser on the Xcode toolbar, choose Manage Schemes, rename "alert copy" and tick the Shared box. Then back in the target for the new module, go to its Build Phases section, expand Compile Sources, remove alert's internal.m, click + and add the C source file(s) for the module. Add any frameworks it needs, to the Link Extensions build phase (note that you should add Fabric.framework, with the Add Other button, if you include hammerspoon.h). From the scheme chooser, select the new extension and cmd-b to make sure it builds/links. Then in the yellow Hammerspoon target, add the new module target to the Target Dependencies build phase, then in the Copy Extensions To Bundle phase, add it to HS_MODULES.

Simple! ;)

@asmagill asmagill mentioned this pull request Aug 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants