Skip to content
masagroupPublic

About

An EMF Ecore library for Cpp

Topics

Resources

Contributing

Stars

2 stars

Watchers

3 watching

Forks

Repository files navigation

soft.cpp

C++ port of the Eclipse EMF Ecore runtime (reflective metamodel, notifications, resources, XMI/XML load and save), partly generated by soft.generator.cpp from soft.models/ecore.ecore; it is the C++ member of the SOFT (Sword Object Facilities) family and has no known consumer among the SWORD C++ repositories.

Family Ecore / esync stack (SOFT family)
Languages C++17, CMake, Apache Ant (build.xml), Ecore XMI (test data)
Build systems Ant (build.xml at the repository root) · CMake + Ninja / Visual Studio generators · vcpkg (downloaded by Ant). No Docker Compose profile, no Go, no npm

Architecture · Contributing · known issues and open questions · repository on GitHub

Overview

soft.cpp is the C++17 implementation of the EMF Ecore runtime: EObject, EClass, EPackage, notifications and adapters, resources and resource sets, XMI and XML load and save. It builds the ecore shared library and the ecore.static static library, packaged as a CPack ZIP with a CMake package Ecore. The Ecore metaclasses are generated by soft.generator.cpp (the v1 generator image, see soft.gen) from soft.models; collections, notifications and resources are hand-written. The build is Windows and MSVC only.

Where to start

You want to... Read
set up a Windows workstation Dev environment on Windows
build the library Build below
understand how it is made ARCHITECTURE.md
contribute CONTRIBUTING.md

Build

A fresh clone cannot be compiled before the generator has run: only EObject.hpp and MockEObject.hpp are versioned under src-gen. ant all does it in the right order.

Windows (Ant)

Initialise the MSVC environment first, in the same console (see Build on Windows). Beyond the Ant and JDK of the workstation, it needs Docker (to run the generator image masagroup/soft.generator.cpp), network access (Ant downloads aria2, CMake, Ninja and vcpkg), and a checkout of soft.models at ../models (models.dir in build.xml).

cmd /c '"C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\Tools\VsDevCmd.bat" -arch=amd64 -vcvars_ver=14.0 -winsdk=10.0.19041.0 && ant all'

Single steps, from the repository root, in the same environment:

ant configure                       # installs aria2, cmake and ninja into bin/ and vcpkg into out/vcpkg
ant ecore.generate                  # regenerate src-gen (Docker and ../models)
ant ecore.configure.ninja.release ecore.build.release   # Ninja, RelWithDebInfo; use .debug for the debug build
ant library                         # generate, configure, build and test the sample "library" model
ant ecore.package ecore.dist        # dist/ecore-<version>-win64.zip (zips the debug and release CPack packages: build both first)
ant ecore.configure.vs2022          # Visual Studio solution (vs2015, vs2017 and vs2019 also exist)
ant clean                           # git clean -xfd on the whole repository

${user.home}/build.properties overrides build.properties (root.dir, bin.dir, out.dir, vcpkg.dir, dist.dir).

CMake (Windows)

Without Ant, once vcpkg is installed at %VCPKG_ROOT% and the sources are generated:

cmake -S ecore -B out/ecore-rel -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVCPKG_ROOT=%VCPKG_ROOT%
cmake --build out/ecore-rel

Use it

find_package(Ecore)    # from the CPack ZIP; targets Ecore::ecore (shared) and Ecore::ecore.static

Test

ant ecore.tests.release                # ecore.tests, through ctest (ant ecore.tests.debug for the debug build)
ant library.tests.release              # tests of the generated sample "library" model
ctest --test-dir out/ecore-rel --output-on-failure
ctest --test-dir out/ecore-rel -R <regex>   # a subset of the tests

Documentation and guides

About

An EMF Ecore library for Cpp

Topics

Resources

Contributing

Stars

2 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages