In order to compile the underlying Pascal code, you need to install:
Setup R environment
Then, you need to be inside the package itself when developing. For this:
- Clone the project:
Open the project in RStudio or any other editor
Install development dependencies: install all necessary dependencies for development, including Lifelihood itself, by running:
install.packages(c("devtools", "testthat", "roxygen2", "pkgdown"))
remotes::install_local(dependencies = TRUE)
When developing an R package, you should not use
library(lifelihood)
, but rather:
devtools::load_all()
This allows to use the latest local version and not having re-install the package every time you make a change.
To check that everything worked as expected, run:
devtools::test()
This will run all unit tests inside the package. If everything is okay, it should print many things and ends with something like this:
Open project in Lazarus
Then, open Lazarus and select “Open project”. You should select the
file named lifelihood.lpi
that should be in
Lifelihood/source/lifelihood.lpi
.
Finally, we need to set the output directory for the compiled file.
You need to go in
Project > Project Options > Compiler Options > Paths
.
In the “Unit output directory (-FU)”, set the path to
Lifelihood/inst/bin/new/
. In my case the full path is:
/Users/josephbarbier/Desktop/Lifelihood/inst/bin/new/
.
This will output all files in this directory. Then, you need take the
compiled file in the new/
directory
(lifelihood.exe
if you compile on Windows,
lifelihood
if you compile on Mac.) Take that file, remove
the C2023
(which gives either lifelihood.exe
or lifelihood
) and put it inside
Lifelihood/inst/bin/
. You will need to remove/overwrite
previous compiled files.
You should now be able to compile the project with
Run > Compile
.