-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the cppargo wiki!
In order to create a new project, use the command
cppargo new <PATH>This will create a new directory at PATH. Relative or absolute paths are
accepted, and will be created accordingly. This directory will be considered
the root of the cppargo project.
Inside the project root directory, cppargo will also create a Cppargo.toml
manifest file akin to a Cargo.toml file used by cargo. Internally,
cppargo looks for such a file to determine the project root, or determine
that it is not within a cppargo project.
And finally, cppargo will create a src directory with a basic
src/main.cpp "Hello World!" C++ program. This is the directory where all of
the source files for the project should be included.
From inside a cppargo project, in order to build a project, use the command
cppargo buildFirstly, cppargo will look for a Cppargo.toml manifest file in the current
directory. If it doesn't find one, then it will check the parent directory's
contents recursively for it. If it fails to find a Cppargo.toml file, then it
exits with an error due to not being inside a cppargo project, as the
Cppargo.toml determines the root of any cppargo project.
From the project root, it will look for the PROJECT_ROOT/src directory to
find all of the .cpp files insde it. The file structure inside the src
directory is irrelevant to cppargo, since it will search exhaustively all
subdirectories to find all .cpp files.
Once gathered, all of the .cpp files are sent as arguments to g++
to be compiled. This means that cppargo does no linkage or compilation of its
own, nor does it check for any bad #include statements, or the lack thereof.
The compiled excecutable file is then stored within a PROJECT_ROOT/target
directory. cppargo first checks to ensure that the directory exists, and
creates it if it doesn't exist. The excecutable file's name is gathered from
the project manifest by reading the project's name. The compiled excecutable is
then placed at PROJECT_ROOT/target/PROJECT_NAME.
From inside a cppargo project, in order to run a project, use the command
cppargo runThis will first perform a cppargo build and then run the
PROJECT_ROOT/target/PATH file generated after a successful compilation. The
proper working directory for the excecutable will be the same as the one
cppargo was excecuted in. This should be kept in mind when the program
expects a certain file structure or a certain working directory.