To build the Cangjie Runtime, please refer to Build Cangjie Runtime.
Before building, you need to set up the compilation environment according to the target output. For details, please refer to the Cangjie SDK Integration and Build Guide.
$ git clone https://gitcode.com/Cangjie/cangjie_runtime.git;For standalone builds, please run the build.py script, which supports three functions: build, install, and clean.
The build command is used to independently construct the Cangjie runtime environment and supports multiple configurable options:
--target <value>specifies the build target. Defaultvalue:native. Available options:native-- refers to compiling and building from Linux/macOS to the native platform;windows-x86_64-- refers to cross-compiling and building from Linux to the Windows-x86_64 platform;ohos-aarch64-- refers to cross-compiling and building from Linux to the ohos-aarch64 platform;ohos-x86_64-- refers to cross-compiling and building from Linux to the ohos-x86_64 platform.
-t, --build-type <value>specifies the build configuration. Valid values:release, debug, relwithdebinfo. Default:release.-v, --version <value>sets the version number for the Cangjie runtime. Default:0.0.1.--prefix <value>defines the installation path for build outputs. Defaults toruntime/output/common. If bothbuildandinstallspecify paths, install takes precedence.-hwasanenables Hardware-Assisted Address Sanitizer (HWASAN).--target-toolchain <value>specifies the toolchain for cross-compilation. Required for cross-compilation builds. See Build Preparation for toolchain configuration details.--cjlib-sanitizer-support: Build runtime with sanitizer support, which runs sanitizer version of cangjie binary. Valid values:asan,tsanorhwasan.
Example:
$ python3 build.py build --target native --build-type release -v 0.0.1The install command can install the compiled output to the desired location. There is an optional parameter:
--prefix <value>specifies the installation path for build outputs. If not provided, outputs will be installed to the path specified by thebuildcommand. Otherwise, they will be installed to the path specified by this parameter.
Example:
$ python3 build.py installThe clean command can be executed to remove all build outputs and intermediate files.
Example:
$ python3 build.py clean/runtime
└─ output
├─ common # Default installation path for compiled outputs
| └─ <target_platform><build_type><target_arch> # outputs descriptor
| ├─ bin # Executable files
| ├─ include # Header files
| ├─ lib # Static libraries, etc.
| └─ runtime # Dynamic libraries, etc.
└─ temp # Temporary outputs path