Module Fang_cmake
Tools for interacting with CMake.
val create_project : ?tiger_compile_options:Bos.Cmd.t -> ?c_compile_options:Bos.Cmd.t -> ?link_options:Bos.Cmd.t -> ?rt_dir:Fpath.t -> ?build_dir:Fpath.t -> ?name:string -> Fpath.t -> (Fpath.t * string, system_error) Stdlib.result
create_project path
defines a CMake project on the file-system for compiling the Tiger file with pathpath
. The result is the path of the CMake build directory and the CMake project name.If everything is successful, when the resulting CMake project is built it produces an executable
$build_dir/$name
.By default, the build directory is
$(working_dir)/_fangbuild
but may be selected viabuild_dir
.By default, the CMake project name is derived from the path of the Tiger file. For example, if the path is
my_tiger_file.tig
then the name will bemy_tiger_file
.The CMake project needs to know the location of Fang's runtime source code. By default, the location is identified based on the path of the
fangc
executable. If this heuristic fails, then the location can be manually specified viart_dir
.tiger_compile_options
are options forwarded tofangc
for compiling the Tiger source file into assembly.c_compile_options
are are options forwarded to the C compiler for compiling Fang's runtime and the assembly file produced byfangc
.link_options
are the options forwarded to the C compiler for linking the runtime library to the object file to produce an executable program.
val with_configure_cmd : ?cmake_options:Bos.Cmd.t -> build_dir:Fpath.t -> (Bos.Cmd.t -> ('a, system_error) Stdlib.result) -> ('a, system_error) Stdlib.result
with_configure_cmd ~build_dir f
invokesf
with a command that configures the CMake project with build-directorybuild_dir
.
val with_build_cmd : build_dir:Fpath.t -> (Bos.Cmd.t -> ('a, system_error) Stdlib.result) -> ('a, system_error) Stdlib.result
with_build_cmd ~build_dir f
invokesf
with a command that builds the CMake project with build-directorybuild_dir
.