Build your first application
Install Nexus with command-line integration selected. Open a new terminal so it receives the updated PATH. These steps use the installed compiler and build tools; they do not need a Nexus source checkout.
Create the source
In an empty application folder, save hello.pas:
program Hello;
{$mode objfpc}
begin
WriteLn('Hello from Nexus');
end.
Beside it, save Hello.nxproject:
dialect "projects/nxbuild/language/nxbuild.Language.nxscript";
module Tools "NXBuild.Environment.nxscript";
Project Hello {
Id: "Example.Hello";
NXPC Application (Tools.Defaults.Pascal) {
SourceFiles: ["hello.pas"];
OutputPath: "build/" + $TargetOS + "/" + $BuildConfiguration;
Debug Symbols BuildConfiguration[Debug] {
GenerateDebugInfo: Enabled;
}
}
}
The dialect is supplied under the installation's scripts directory.
The explicitly imported environment resolves beside Nexus Build when no local file
exists. The project inherits its Pascal compiler settings from that environment.
Build and run
From the application folder on Windows:
nxbuild /action=build /project=Hello.nxproject /targetos=win64 /targetcpu=x86_64 /buildconfiguration=Debug
./build/win64/Debug/hello.exe
On Ubuntu:
nxbuild /action=build /project=Hello.nxproject /targetos=linux /targetcpu=x86_64 /buildconfiguration=Debug
./build/linux/Debug/hello
Both print Hello from Nexus. The compiler chooses the executable filename;
Nexus Build passes the declared source and output directory.
Use /action=validate to check the project and its dependency graph without
building. Use /action=plan to inspect the planned operations. Neither is a
substitute for building and running the application.