Setting up Cmajor compiler development environment

Requirements

1. Boost (C++ msvc)

Version

1.74

Location:

C:\boost

Sources

boost.org

Extract sources to C:\work\boost_1_74_0 directory. (For example place boost_1_74_0.7z package in C:\work directory and choose 7-Zip | Extract here)

Build

  1. Open x64 Native Tools Command Prompt for VS 2019 (can be found from the start menu in Visual Studio 2019 folder)
  2. Change to C:\work\boost_1_74_0 directory.
  3. Bootstrap:
            C:\work\boost_1_74_0> bootstrap
        
  4. Compilation:
            C:\work\boost_1_74_0> b2 toolset=msvc address-model=64 --build-dir=C:\boost-build-dir --prefix=C:\boost install
        
  5. After compiling C:\boost-build-dir ja C:\work\boost_1_74_0 can be removed.

2. Mingw-w64

Download

From the Download page select MingW-W64-builds.

Version

8.1.0

Installation

  1. Installation using these settings:

  2. Add C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin directory to PATH.

3. Boost (C++ mingw-w64)

Version

1.74

Location:

C:\mingw-boost

Sources

boost.org

Extract sources to C:\work\boost_1_74_0 directory.

Build

  1. Open Windows Terminal (wt.exe) to C:\work\boost_1_74_0 directory:
  2. It's assumed that mingw-w64's gcc can be found from PATH: gcc --version
  3. Bootstrap:
            C:\work\boost_1_74_0> bootstrap gcc
        
  4. Compilation:
            C:\work\boost_1_74_0> b2 toolset=gcc address-model=64 --build-dir=C:\mingw-boost-build-dir --prefix=C:\mingw-boost install
        
  5. After compiling C:\mingw-boost-build-dir ja C:\work\boost_1_74_0 can be removed.

4. LLVM binaries

Version

11.0.0

Location:

C:\Program Files\LLVM

Download

From the Download page select Windows (64-bit) link.

This is a direct link: LLVM-11.0.0-win64.exe

Installation

  1. After installation add C:\Program Files\LLVM\bin directory to PATH.

5. CMake

Version

3.18.4

Location:

C:\Program Files\CMake

Download

From the Download page select cmake-3.18.4-win64-x64.msi link.

This is a direct link: cmake-3.18.4-win64-x64.msi

Installation

  1. Installation using these settings:

6. Python

Version

3.9.0

Location

C:\Program Files\Python39

Download

From the Download page select Download Python 3.9.0.

Installation

Installation using these settings:

7. LLVM sources

Version

11.0.0

Location:

C:\llvm-11.0.0.src

Download

From the Download page select LLVM source code.

This is a direct link: llvm-11.0.0.src.tar.xz

Extract package to C:\llvm-11.0.0.src folder.

Compilation

  1. Open x64 Native Tools Command Prompt for VS 2019.
  2. Change to C:\llvm-11.0.0.src directory.
  3. Make directory build:
                C:\llvm-11.0.0.src>mkdir build
            
  4. Change to build directory:
                C:\llvm-11.0.0.src>cd build
            
  5. Run CMake:
                C:\llvm-11.0.0.src\build> cmake -G "Visual Studio 16 2019" -Thost=x64 -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_EH=On -DLLVM_ENABLE_RTTI=On ..
            
  6. Open C:\llvm-11.0.0.src\build\LLVM.sln solution in Visual Studio 2019.
  7. Build solution using Debug/x64 configuration.
  8. Build solution using Release/x64 configuration

8. Git for Windows

Versio

2.28.0

Download

Git for Windows

.

9. Cmajor compiler and C++ runtime

Location

C:\work\cmajorm

Download

From https://github.com/slaakko/cmajorm page select Code | https://github.com/slaakko/cmajorm.git
  1. Start Git Bash.
  2. Change to C:\work directory.
  3. Clone cmajorm repository:
    		git clone https://github.com/slaakko/cmajorm.git
    	
  4. Clones repository to cmajorm directory.

Installation

  1. Make subdirectory C:\work\cmajorm\cmajor\lib
  2. Make subdirectory C:\work\cmajorm\cmajor\lib\gcc
  3. Make subdirectory C:\work\cmajorm\cmajor\lib\vs
  4. Make subdirectory C:\work\cmajorm\cmajor\bin
  5. Make subdirectory C:\work\cmajorm\cmajor\rts\build\gcc\lib
  6. Make subdirectory C:\work\cmajorm\cmajor\rts\build\gcc\bin
  7. Add environment variable CMAJOR_ROOT with value C:\work\cmajorm\cmajor.
  8. Add C:\work\cmajorm\cmajor\bin directory to PATH.
  9. Open x64 Native Tools Command Prompt for VS 2019
  10. Change to C:\work\cmajorm\cmajor\system\ext\pdcurs36\build directory.
  11. Run build.bat.
  12. Change to C:\work\cmajorm\cmajor\system\ext\zlib-1.2.11\contrib\masmx64 directory
  13. Run bld_ml64.bat
  14. Open C:\work\cmajorm\cmajor\cmajor.sln in Visual Studio 2019.
  15. Select Debug/x64 configuration.
  16. Build solution.
  17. Select Release/x64 configuration.
  18. Build solution.
  19. Open Windows Terminal to C:\work\cmajorm\cmajor\bat directory.
  20. Run install.bat. Does not find all the files, but does not matter for now.
  21. Open Windows Terminal to C:\work\cmajorm\cmajor\rts\build\gcc directory.
  22. Run mingw32-make (assumed that can be found from PATH):
                C:\work\cmajorm\cmajor\rts\build\gcc> mingw32-make
            
  23. Run mingw32-make install:
                C:\work\cmajorm\cmajor\rts\build\gcc> mingw32-make install
            

10. Unicode

Download

Download Unicode 12.1 Character Database: ucd.all.flat.zip and extract it to C:\work\cmajorm\cmajor\unicode directory.

Installation

  1. Open Windows Terminal to C:\work\cmajorm\cmajor\unicode directory.
  2. Run makecmajorucd. Makes cmajor_ucd.bin Unicode database for Cmajor:
                C:\work\cmajorm\cmajor\unicode> makecmajorucd
            

11. Cmajor system libraries

Installation

  1. Open Windows Terminal to C:\work\cmajorm\cmajor\system\platform\windows directory.
  2. Build System library using the debug configuration (LLVM):
                C:\work\cmajorm\cmajor\system\platform\windows> cmc -u -v System.cms
            
  3. Build System library using the release configuration (LLVM):
                C:\work\cmajorm\cmajor\system\platform\windows> cmc -u -v -c=release System.cms
            
  4. Build System library using the debug configuration (C++):
                C:\work\cmajorm\cmajor\system\platform\windows> cppcmc -st -u -v System.cms
            
  5. Build System library using the releaseconfiguration (C++):
                C:\work\cmajorm\cmajor\system\platform\windows> cppcmc -st -u -v -c=release System.cms
            

12. Cmajor Visual Studio extension

  1. Open C:\work\cmajorm\cmajor\task\task.sln in Visual Studio 2019
  2. Select Debug|Any CPU -konfiguraaatio
  3. Build solution
  4. Select Release|Any CPU -konfiguraaatio
  5. Build solution
  6. Open Windows Terminal to C:\work\cmajorm\cmajor\bat directory.
  7. Run install.bat: copies C:\work\cmajorm\cmajor\task\bin\Release\CmajorTasks.dll to bin directory.
  8. Change to C:\work\cmajorm\cmajor\vs\2019 directory.
  9. Run CreateCmajorCPS.exe:
    			C:\work\cmajorm\cmajor\vs\2019>CreateCmajorCPS
    		
  10. Close Windows Terminal
  11. Right click C:\work\cmajorm\cmajor\vs\2019\cmajor.vsix and select install.

13. Cmajor tools

  1. Open Windows Terminal to C:\work\cmajorm\cmajor\projects\cm directory.
  2. Compile Cm.cms solution using debug config:
    			C:\work\cmajorm\cmajor\projects\cm>cmc -u -v Cm.cms
    		
  3. Compile Cm.cms solution using release config:
    			C:\work\cmajorm\cmajor\projects\cm>cmc -u -v -c=release Cm.cms
    		
  4. Change to C:\work\cmajorm\cmajor\projects\tools\soulcm\scmlg directory.
  5. Compile scmlg.cmp project using debug config:
    cmc -u -v scmlg.cmp
  6. Compile scmlg.cmp project using release config:
    cmc -u -v -c=release scmlg.cmp
  7. Change to C:\work\cmajorm\cmajor\projects\tools\soulcm\scmpg directory.
  8. Compile scmpg.cmp project using debug config:
    cmc -u -v scmpg.cmp
  9. Compile scmpg.cmp project using release config:
    cmc -u -v -c=release scmpg.cmp
  10. Change to C:\work\cmajorm\cmajor\projects\tools\soulcm\scm2html directory.
  11. Compile scm2html.cmp project using debug config:
    cmc -u -v scm2html.cmp
  12. Compile scm2html.cmp project using release config:
    cmc -u -v -c=release scm2html.cmp
  13. Change to C:\work\cmajorm\cmajor\projects\tools\spring directory.
  14. Compile spring.cmp project using debug config:
    cmc -u -v spring.cmp
  15. Compile spring.cmp project using release config:
    cmc -u -v -c=release spring.cmp
  16. Change to C:\work\cmajorm\cmajor\projects\tools\supd directory.
  17. Compile supd.cmp project using debug config:
    cmc -u -v supd.cmp
  18. Compile supd.cmp project using release config:
    cmc -u -v -c=release supd.cmp

14. Cmajor examples

  1. Open Windows Terminal to C:\work\cmajorm\cmajor\projects\examples directory.
  2. Compile examples.cms solution using debug config:
    			C:\work\cmajorm\cmajor\projects\examples>cmc -u -v examples.cms
    		
  3. Compile examples.cms solution using release config:
    			C:\work\cmajorm\cmajor\projects\examples>cmc -u -v -c=release examples.cms
    		

15. System X

  1. Open Windows Terminal to C:\work\cmajorm\cmajor\projects\cmsx directory.
  2. Compile cmsx.cms solution using debug config:
    			C:\work\cmajorm\cmajor\projects\cmsx> cmc -u -v cmsx.cms
    		
  3. Compile cmsx.cms solution using release config:
    			C:\work\cmajorm\cmajor\projects\cmsx> cmc -u -v -c=release cmsx.cms
    		

16. Installation

  1. Open Windows Terminal to C:\work\cmajorm\cmajor\bat directory.
  2. Run install.bat. Changed files are copied to C:\work\cmajorm\cmajor\bin and C:\work\cmajorm\cmajor\lib directories. All except cmajor.vsix and cmsxpg.exe should now be found.