Distribution::Builder::Cmake

A zef builder to aid in binding CMake projects to Raku

Distribution::Builder::Cmake

A dead simple way to build a CMake project for FFI with Raku.

Synopsis

Installation

zef install Distribution::Builder::Cmake

Usage

Assuming your Raku project has keeps its CMake project in a folder called my-cmake-project, and your exported lib is my-lib. Note, the final .so file will be libmy-lib.so. In your META6.json you'll add the following:

{
    ...
    "builder": "Distribution::Builder::Cmake",
    "build": {
        "lib": "my-lib",
        "src-dir": "my-cmake-project"
    }
    ...
}

The typical CMake project will look like (assuming your lib is my-lib):

cmake_minimum_required(VERSION 3.9)
project(my-lib VERSION 1.0.0 DESCRIPTION "My lib!")
add_library(my-lib SHARED my-lib.cc)
set_target_properties(my-lib PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(my-lib PROPERTIES SOVERSION 1)
set_target_properties(my-lib PROPERTIES PUBLIC_HEADER my-lib.hh)
target_include_directories(my-lib PRIVATE .)
install(TARGETS my-lib
	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
	PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

You can see an example of this in action in this repo

(Obviously, you'll need Make and CMake installed)

Author

<Rawley Fowler>

COPYRIGHT AND LICENSE

Copyright 2023

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Distribution::Builder::Cmake v0.0.1

A zef builder to aid in binding CMake projects to Raku

Authors

  • Rawley Fowler

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Distribution::Builder::Cmake

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.