Skip to content
This repository has been archived by the owner on Jan 12, 2022. It is now read-only.

Tolc-Software/bootstrap-tolc-cmake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bootstrap tolc with CMake

Ubuntu MacOS

# to influence the development of tolc

CMake downloader for the C++ language bindings generator tolc.

This CMake module allows you to download the beta release of tolc to then generate bindings from headers and CMake targets.

Installation

Clone and use add_subdirectory(path/to/bootstrap) within your project.

You can also download it automatically via CMake:

include(FetchContent)
FetchContent_Declare(
  tolc_bootstrap
  GIT_REPOSITORY https://github.com/Tolc-Software/bootstrap-tolc-cmake
  GIT_TAG        main
)

FetchContent_MakeAvailable(tolc_bootstrap)

Usage

The bootstrap script only provides the function get_tolc() which downloads the latest release of tolc.

A full example:

cmake_minimum_required(VERSION 3.15)

project(bootstrap-tolc-cmake)

# Some library to generate bindings from
add_library(bootstrap src/Boot/bootstrap.cpp)
target_include_directories(bootstrap PUBLIC include)

include(FetchContent)
FetchContent_Declare(
  tolc_bootstrap
  GIT_REPOSITORY https://github.com/Tolc-Software/bootstrap-tolc-cmake
  GIT_TAG        main
)

FetchContent_MakeAvailable(tolc_bootstrap)
# Download and uses find_package to locate tolc
get_tolc()

# This function comes from the tolc package itself
# Creates the target bootstrap_python that can be imported and used from python
tolc_create_translation(
  # Target to translate from
  TARGET bootstrap
  # Language to target
  LANGUAGE python
  # Where to put the bindings
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/python-bindings
)