The Cmajor compiler with C++ backend, cppcmc, is a command-line compiler for Windows, Linux and Windows subsystem for Linux. It compiles Cmajor code to very primitive C++ and then launches the configured C++ compiler to compile to native machine code. The compiler also generates a debug information file, x.cmdb, associated with the executable x. The cmdb file is read by the Cmajor command-line debugger, cmdb. The compiler and the debugger are integrated in Cmajor Code, a graphical editor and development environment.
The Cmajor installation is described in this document.
C:\cmajor\system\platform\windows>cppcmc -u -v System.cmsThe -u flag tells the compiler to rebuild everything, strictly not necessary. The -v flag tells the compiler to be verbose, so you will see what's going on. If everything went fine, the last lines will say:
System libraries installed. Solution 'System' built successfully.The debug-mode libraries are installed to C:\cmajor\system\lib\cpp\gcc\debug directory.
C:\cmajor\system\platform\windows>cppcmc -u -v -c=release System.cmsThe -c=release option tells the compiler to build for release configuration (optimizations enabled). Again the last lines should say:
System libraries installed. Solution 'System' built successfully.The release-mode libraries are installed to C:\cmajor\system\lib\cpp\gcc\release directory.
slaakko@pluto:~/cmajor-3.6.0-src$ cd cmajor/rts/build/gcc
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/rts/build/gcc$ make
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/rts/build/gcc$ make install
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/system/platform/linux$ cppcmc -u -v System.cmsThe -u flag tells the compiler to rebuild everything, strictly not necessary. The -v flag tells the compiler to be verbose, so you will see what's going on. If everything went fine, the last lines will say:
System libraries installed. Solution 'System' built successfully.The debug-mode libraries are installed to cmajor/system/lib/cpp/gcc/debug directory.
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/system/platform/linux$ cppcmc -u -v -c=release System.cmsThe -c=release option tells the compiler to build for release configuration (optimizations enabled). Again the last lines should say:
System libraries installed. Solution 'System' built successfully.The release-mode libraries are installed to cmajor/system/lib/cpp/gcc/release directory.
To test that the system basically works, you may now compile a Hello world program using cppcmc:
C:\cmajor\projects\examples\Hello>cppcmc -u -v Hello.cmpIf everything went fine, the last line will say:
Project 'Hello' built successfully.The executable and the debug information file are generated to the bin\cpp\gcc\debug subdirectory. Now run it:
C:\cmajor\projects\examples\Hello>bin\cpp\gcc\debug\HelloAnd the program prints:
Hello, world!
C:\cmajor\projects\examples\Hello>cppcmc -u -v -c=release Hello.cmpThe executable and the debug information file are generated to the bin\cpp\gcc\release subdirectory. Now run it:
C:\cmajor\projects\examples\Hello>bin\cpp\gcc\release\HelloAnd the program says:
Hello, world!
slaakko@pluto:~/cmajor-3.6.0-src/cmajor$ cd projects/examples/HelloEnter the following command:
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/projects/examples/Hello$ cppcmc -u -v Hello.cmpIf everything went fine, the last line will say:
Project 'Hello' built successfully.The executable and the debug information file are generated to the bin/cpp/gcc/debug subdirectory. Now run it:
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/projects/examples/Hello$ bin/cpp/gcc/debug/HelloAnd the program prints:
Hello, world!
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/projects/examples/Hello$ cppcmc -u -v -c=release Hello.cmpThe executable and the debug information file are generated to the bin/cpp/gcc/release subdirectory. Now run it:
slaakko@pluto:~/cmajor-3.6.0-src/cmajor/projects/examples/Hello$ bin/cpp/gcc/release/HelloAnd the program says:
Hello, world!
Usage: cppcmc [options] { project.cmp | solution.cms }
Long option | Short option | Description |
---|---|---|
--help | -h | Print help and exit. |
--verbose | -v | Be verbose. |
--quiet | -q | Be quiet, only return exit code. |
--config=CONFIG | -c=CONFIG | Build usig CONFIG configuration. CONFIG can be "debug" or "release". Default optimization level for debug build is 0 and for release build is 2. |
‑‑optimization‑level=LEVEL | -O=LEVEL | Set optimization level to LEVEL (0-3). |
--clean | -e | Clean given projects and solutions. |
‑‑tool‑chain=TOOL_CHAIN | ‑tc=TOOL_CHAIN | Use tool chain TOOL_CHAIN.
Default is 'gcc'.
Tool chains:
|
--strict-nothrow | -s | Treat a nothrow violation as an error. |
--emit-asm | -f | Emit assembly code to .asm files while compiling. |
--gen-debug-info | -g | Generate debug info (on by default on debug configuration) |
--no-debug-info | -n | Don't generate debug info even for debug build |
--build-threads=N | -bt=N | Use N threads for building a solution. Default is 2 x C, where C is the number of cores. |
--disable-module-cache | -dm | Do not cache recently built modules. |
--single-threaded-compile | -st | Compile source files in a project using a single thread. |
--disable-codegen | -dg | Disable code generation. On by default for 'vs' tool-chain. |
--just-my-code | -j | Enable Just My Code debugging. Effective for 'vs' tool-chain. |
--all | -a | Build all dependencies. |
--repository | -rp | Build repository project. |