Comments (17)
I just pushed up 76e2038 which includes a static library build of Argument Parser.
If you were to do this yourself, what you would do is add the source files for ArgumentParser and CoreParse to your project and ensure that you add the -fno-objc-arc
flag to all the CoreParse files in Build Phases/Compile Sources.
Let me know if you have any further questions!
from argumentparser.
you rock!
from argumentparser.
Or actually I lied. The change set was 76e2038 (original comment has been updated). Today I learned that the ellipses in a Git push readout are not a contraction! (Specifically 92457b3..76e2038
means "went from 92457b3 to 76e2038").
from argumentparser.
:)
from argumentparser.
noob question n2: shouldn't the static library have a header file also?
from argumentparser.
In this case, the header file will be FSArguments.h
and you'll need to ensure that all the other .h
files are accessible.
from argumentparser.
you say I should copy all header files from your library (22 headers) onto my project? and the CoreParse files? I'm heavily lost :(
from argumentparser.
So when you build the static library it produces ArgumentParser-static.a
file, which is just a bunch of object code that needs to be compiled into your library. The .a
file itself doesn't have any information about the binary layout of itself. So there's really no way to tell where FSArgumentPackage
is or any nonsense like that. You need to provide a way to symbolicate the binary, and we do that with a header file.
Therefore, once you build the ArgumentParser.a
file, you copy the headers too which provides the information on how to use the .a
file.
A slightly easier approach is to drag the ArgumentParser Xcode project into your own project and then mark the static library target as a dependency of your own build target. That's a little Xcode-specific, however, and therefore you're probably better served finding a tutorial for it. A quick Bing search revealed that Apple has a tutorial, though depending on your level of comfort with Xcode and the legendary terseness of Apple's docs, that might not be all the tutorial you'll need.
from argumentparser.
thanks for the help, it's terse indeed! I'm advancing, but not yet quite there... I'll keep smashing my head a little more, it's usually a painful but fast way of learning things deeply. :)
from argumentparser.
Ok, I'm really stuck. I tried 3 different ways, 2 of them compile, but give runtime exceptions, luckily the same :)
setup: default xcode OSX command line tool application, replace main.m content with ArgumentParser/example/desc.m
demo app: https://github.com/ramiroaraujo/cli-test
ArgumentParser fork: https://github.com/ramiroaraujo/ArgumentParser
place both projects in the same parent folder to have linked dependencies working without config.
Below are the 3 options, with the description of the steps I took, although if you checkout the branches in the demo apps the steps are already done.
Option 1: Link untouched ArgumentParser project
reproduce it by using the link-project branch in cli-test, and master branch in ArgumentParser
- I linked the ArgumentParser code
- I added the linked project to header search paths
- I added libArgumentParser-Static.a to Build Phases -> Link Binary With Libraries
It doesn't compile, I get Match-O Linker errors, indicating Undefined symbols like OBJC_CLASS$_CPItem
Option 2: Link modified ArgumentParser project
reproduce it by using the link-project branch in cli-test, and static-dependencies branch in ArgumentParser
- cli-test project remains the same as Option 1
- I added missing implementation files from CoreParse in Build Phases -> Compile Sources in ArgumentParser project, and added the -fno-objc-arc flag to them. It had 47 items, it now has 58.
It compiles perfectly, it outputs text correctly with the -h flag, but then it shows:
https://gist.github.com/ramiroaraujo/8672441
Option 3: Add ArgumentParser and CoreParse sources to test-cli project
_reproduce it by using the copy-sources branch in cli-test. ArgumentParser project is not needed.
- I copied the ArgumentParser and CoreParse source code and header files into the cli-test project
- I added all ArgumentParser and CoreParse implementation files to Build Phases -> Compile Sources, and added the -fno-objc-arc flag to CoreParse files.
It compiles perfectly, it outputs text correctly with the -h flag, but then shows the exact same error as Option 2:
https://gist.github.com/ramiroaraujo/8672441
I think I've reached far beyond my skills here. Any more help or hints are highly appreciated!
Cheers!
from argumentparser.
follow up:
Using the same technique with https://github.com/barrelage/BRLOptionParser it worked just fine :)
Happy to have learned a lot, and anxious to see what went wrong with yours :)
from argumentparser.
It would appear that you're trying to use descriptionForLocale:indent:
on an FSArgumentSignature
instance. This method hasn't been implemented on that class (although I probably should).
If you instead use descriptionForHelp:terminalWidth:
it should function as expected.
from argumentparser.
I should also note that the first argument of descriptionForLocale:indent
is expecting either nil
or an instance of NSLocale
.
from argumentparser.
not sure I'm following. I copied examples/desc.m into main.m exactly. Also I don't see that code using descriptionForLocale
, although it does use descriptionWithLocale
from argumentparser.
So it would appear that there is a bug in my example file that I need to fix. It should be calling descriptionForHelp:terminalWidth:
(which I am now experiencing strange urges to rename descriptionForHelpWithIndent:terminalWidth:
).
from argumentparser.
The example has been fixed, as well as the method renamed to be more idiomatic. (See 4e2c7d9 and 43df3eb).
from argumentparser.
I have no idea why this was still open.
from argumentparser.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from argumentparser.