Git Product home page Git Product logo

cosim-demo-app_extensions's Introduction

Cosim Demo Application

cosim-demo-app CI

This repository contains a server-client demo application for libcosim. The server is written in Go and the client in clojurescript

Server

Required tools

  • Conan v1.59 (currently v2 is not supported)
  • Go dev tools: Golang >= 1.11
  • Compiler: MinGW-w64 (Windows), GCC >= 9 (Linux)
  • Package managers: Conan and Go Modules

Throughout this guide, we will use Conan to manage C++ dependencies. However, you can also install the C++ dependencies manually.

Note: About the installation of MinGW-w64 (Windows)

An easier way to install it is to download the Mingw-w64 automated installer from here and follow the steps in the wizard. It is essential that the installation path does not contain any spaces. Install a current version and specify win32 as thread when requested. Additionally, choose the architecture x86_64.

After installing it, you need to add it to the PATH environment variable (add the path where your MinGW-w64 has been installed to e.g., C:\mingw\mingw64\bin).

Alternatively, MinGW can also be installed via chocolatey. Once chocolatey is installed, simply run the following command (as admin) to install MinGW:

choco install mingw

Step 1: Configure Conan

First, add the OSP Conan repository as a remote and configure the username and password to access it:

conan remote add osp https://osp.jfrog.io/artifactory/api/conan/conan-local

Step 2: Build and run

You can do this in two ways:

Alternative 1: Using Conan

From the cosim-demo-app source directory, get C/C++ dependencies using Conan:

conan install . -u -s build_type=Release -g virtualrunenv
source activate_run.sh # or run activate_run.bat in windows
go build

To run the application on Windows:

activate_run.bat (activate_run.ps1 in PowerShell)
cosim-demo-app.exe
deactivate_run.bat when done (deactivate_run.ps1 in PowerShell)

To run the application on Linux:

source activate_run.sh
./cosim-demo-app
./deactivate_run.sh when done

Open a browser at http://localhost:8000/status to verify that it's running (you should see some JSON).

Alternative 2: Manually handle libcosimc dependencies

You will have to define CGO environment variables with arguments pointing to your libcosimc headers and libraries. An example for Windows can be:

set CGO_CFLAGS=-IC:\dev\libcosimc\include
set CGO_LDFLAGS=-LC:\dev\libcosimc\bin -lcosim -lcosimc
go build

To run the application on Windows you need to also update the path to point to your libraries:

set PATH=C:\dev\libcosimc\bin;%PATH%
cosim-demo-app.exe

To run the application on Linux you need to update the LD_LIBRARY_PATH:

LD_LIBRARY_PATH=~dev/libcosimc/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
./cosim-demo-app

Open a browser at http://localhost:8000/status to verify that it's running (you should see some JSON).

Client

Providing a web user interface.

Development mode

You now have a framework running for live reloading of client code.

Building the client

  • Run lein cljsbuild once min
  • The client application will be compiled to /resources/js/compiled

Create distribution with built-in client

To package the application with the client you can use packr. You can install packr and build distributable with:

go get -u github.com/gobuffalo/packr/packr
packr build

cosim-demo-app_extensions's People

Contributors

eidekrist avatar ingesolvoll avatar ljamt avatar cesarcarc avatar restenb avatar hplatou avatar flakstad avatar kyllingstad avatar markaren avatar davidhjp01 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.