Setting up Metacall development environment on Windows

To learn about metacall checkout my previous articles here

MetaCall allows you inter-connect any programming language with a simple syntax. It was created with user experience and high performance applications in mind.

MetaCall is open-sourced under Apache 2.0 license. Let's switch gears and setup our windows system to build and develop metacall locally.

  1. Clone the metacall core repository from here https://github.com/metacall/core/

    git clone https://github.com/metacall/core
    
  2. Download and install Visual Studio 2019

    • Under Workloads select Desktop development with C++ Workload selection
    • Make sure all the components are selected as in above image.
    • After setup restart your system.
  3. Open the core repo in Visual Studio code or your editor of choice.

  4. The metacall build step comprises of three steps

    • Environment setup
    • Configuring cmake
    • Building the project using cmake

    Environment setup

    Setting up the environment is a one time step, this is done to install various dependencies and other important configuration for the runtimes. For example setting up Python, Nodejs, Java, etc for metacall.

    # open command prompt and run 
    powershell .\tools\metacall-environment.ps1 python nodejs
    

    This script will setup the environment for python, nodejs . We can also pass other runtimes that we want to build for metacall

    powershell .\tools\metacall-environment.ps1 python nodejs typescript java
    

    Configure step

    This set prepare the build directory and sets up CMAKE for building metacall along with its various components

    cd build
    powershell ..\tools\metacall-configure.ps1 debug scripts ports tests python
    

    In this example we are configuring CMAKE to build metacall in debug mode along with its scripts, ports, tests and support for python.

    We can include other components as we did in above step

    powershell ..\tools\metacall-configure.ps1 debug scripts ports tests python nodejs typescript java
    

    Finally build metacall

    To build metacall on debug mode run the following command inside the build directory

    powershell ..\tools\metacall-build.ps1 debug
    

    We can also run the test suite by providing the tests argument to the above command

    powershell ..\tools\metacall-build.ps1 debug tests
    

Few Notes

  • Windows is notoriously hard to develop and troubleshoot low level stuff, you might face few issues with the setup.
  • Make sure you don't have other compilers like MinGW conflicting with MSVC else you will get build errors.
  • Also make sure to use the Visual Studio 2019 along if you have other versions installed than you will need to manually pass the generator flag to CMAKE
# update this line in metacall-environment.ps1
cmd.exe  /c "cmake $CustomFlags $BUILD_STRING -G ""Visual Studio 15 2019"" .."

Feel free to reach out in comments if you have any questions or join the metacall discord/telegram