shake-language-c: Utilities for cross-compiling with Shake

[ apache, development, library ] [ Propose Tags ] [ Report a vulnerability ]

This library provides Shake utilities for cross-compiling C, C++ and ObjC code for various target platforms. Currently supported target platforms are Android, iOS, Linux, MacOS X, Windows/MinGW and Google Portable Native Client (PNaCl). Supported host platforms are MacOS X, Linux and Windows.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.5.0, 0.6.2, 0.6.3, 0.6.4, 0.7.0, 0.7.1, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 0.8.6, 0.9.0, 0.9.1, 0.10.0, 0.10.1, 0.11.0, 0.12.0
Change log CHANGELOG.md
Dependencies base (>=4 && <5), data-default-class, fclabels (>=2), process, shake (>=0.14), split, unordered-containers [details]
License Apache-2.0
Copyright Copyright (c) 2012-2014 Samplecount S.L.
Author
Maintainer stefan@samplecount.com
Category Development
Home page https://github.com/samplecount/shake-language-c
Bug tracker https://github.com/samplecount/shake-language-c/issues
Source repo head: git clone https://github.com/samplecount/shake-language-c.git
Uploaded by StefanKersten at 2016-04-08T10:27:05Z
Distributions LTSHaskell:0.12.0, NixOS:0.12.0
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 13701 total (62 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-04-08 [all 1 reports]

Readme for shake-language-c-0.8.6

[back to package description]

shake-language-c

Hackage version Stackage LTS Stackage Nightly Build Status

shake-language-c is a cross-platform build system based on the Shake Haskell library. The focus is on cross-compilation of C, C++ and Objective C source code to various target platforms. Currently supported target platforms are iOS, Android NDK, Google Portable Native Client, MacOS X, Linux and Windows (MinGW). Supported host platforms are MacOS X, Linux and Windows.

Documentation

Please see the package documentation. Feel free to open an issue or send a pull request if there's anything missing that you want to see covered.

Examples

Here's an iOS example that compiles all .cpp files in the src directory. The resulting static library libexample.a can then be used e.g. from an XCode project.

import Control.Applicative
import Control.Arrow
import Development.Shake
import Development.Shake.FilePath
import Development.Shake.Language.C
import qualified Development.Shake.Language.C.Target.OSX as OSX

main :: IO ()
main = shakeArgs shakeOptions { shakeFiles = "build/" } $ do
  let target = OSX.target OSX.iPhoneOS (Arm Armv7s)
      toolChain = OSX.toolChain
                    <$> OSX.getSDKRoot
                    <*> (maximum <$> OSX.getPlatformVersions (targetPlatform target))
                    <*> pure target

  lib <- staticLibrary toolChain
          ("build" </> toBuildPrefix target </> "libexample.a")
          (return $
               append compilerFlags [(Just Cpp, ["-std=c++11"])]
           >>> append compilerFlags [(Nothing, ["-O3"])]
           >>> append userIncludes ["include"] )
          (getDirectoryFiles "" ["src//*.cpp"])

  want [lib]

A more complex build script is used by the Methcla sound engine library. It defines Shake rules for building the library on various platforms and also exports functions for transparently including the library into other build systems. The build script makes extensive use of Shake configuration files.