StickyEncoding uses cmake
for an underlying build system in order to facilitate targeting multiple platforms and integration of various tools and tasks that need to be done while building.
CMake makes it (relatively) easy for us to create a development environment we can count on. We've made the system fairly easy to use.
Note: CMake is not required to use StickyEncoding in other projects using the Swift Package Manager or CocoaPods. It's only required if you want to contribute to the code-line of StickyEncoding.
We like to use brew
to install CMake:
> brew install cmake
You can use any method you'd like of course. Please find other installation methods on the cmake.org site.
We highly recommend CMake 'out of source' builds for working with StickyEncoding.
To create an out of source build, you can do the following.
> cd project-root
> mkdir cmake-build-debug && cd cmake-build-debug
> cmake ../
Note: You may name the directory whatever you'd like. We chose
cmake-build-debug
because other tools use that directory by default when you open the project directory.
If all the dependent tools are installed, cmake will create the make files for development and any of the other tasks in this readme.
To build and test the code-line and run the appropriate tools, run the following commands.
Make sure you are in the same directory you ran cmake originally.
> make
If you want to build the code-line only, run:
> make build
Or to specifically target the tests, run:
> make tests
If you get stuck and need help, run:
> make help
Here is a list of common commands you can use (including the commands above):
make help
- prints out a list of make targets availablemake build
- builds the library without running the tests.make tests
- builds and tests the library.make generate-tests
- generates any tests from GYB files in the project.make documentation
- creates the complete Jazzy documentation set from the source.make linux-main
- regenerates the linux main and manifest files for Linux.make xcode-project
- will generate a complete Xcode project for development if you choose to use Xcode.
We primarily use VS Code for development since it is cross platform and works well with other tools and languages.
Since the Xcode project can easily be created on the fly, we chose not the include it. To generate it, simply execute this make command:
> make xcode-project
A complete project will be generated for you with the proper settings for the project.
We use GYB (Generate Your Boilerplate) extensively to facilitate generation of code that is repetitive. You will mainly see this in the tests. If a file was generated by GYB, do not edit it directly, look for a file of the same name with a .gyb
extension. You will see a header in generated files such as this.
/// =================================== NOTICE ========================================
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
///
/// Modify the *.swift.gyb file instead.
/// ===================================================================================
Note: GYB is installed in the project directory structure when you attempt to build the system and is run on all the GYB files to generate source.