From 682ce421a52d4dd1069a67ea0e5320e9fc816157 Mon Sep 17 00:00:00 2001 From: Alex Bates Date: Fri, 31 May 2024 18:42:58 +0100 Subject: [PATCH] add make example --- examples/cmake/README.md | 2 +- examples/make/.gitignore | 2 ++ examples/make/Makefile | 15 +++++++++++++++ examples/make/README.md | 9 +++++++++ examples/make/main.cpp | 3 +++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 examples/make/.gitignore create mode 100644 examples/make/Makefile create mode 100644 examples/make/README.md create mode 100644 examples/make/main.cpp diff --git a/examples/cmake/README.md b/examples/cmake/README.md index efb17e4..fb36faf 100644 --- a/examples/cmake/README.md +++ b/examples/cmake/README.md @@ -1,4 +1,4 @@ -# Minimal Cheerp CMake example +# Cheerp + CMake [![Discord server](https://img.shields.io/discord/988743885121548329?color=%237289DA&logo=discord&logoColor=ffffff)](https://discord.gg/3UfTSbWdYy) diff --git a/examples/make/.gitignore b/examples/make/.gitignore new file mode 100644 index 0000000..8fa7eb9 --- /dev/null +++ b/examples/make/.gitignore @@ -0,0 +1,2 @@ +*.js +*.wasm diff --git a/examples/make/Makefile b/examples/make/Makefile new file mode 100644 index 0000000..9b93317 --- /dev/null +++ b/examples/make/Makefile @@ -0,0 +1,15 @@ +ifeq ($(OS),Windows_NT) + CHEERP ?= C:/cheerp +else + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) + CHEERP ?= /opt/cheerp + else ifeq ($(UNAME_S),Darwin) + CHEERP ?= /Applications/cheerp + endif +endif + +%.js: %.cpp + ${CHEERP}/bin/clang++ $< -o $@ + +main.js: diff --git a/examples/make/README.md b/examples/make/README.md new file mode 100644 index 0000000..3b14de4 --- /dev/null +++ b/examples/make/README.md @@ -0,0 +1,9 @@ +# Cheerp + Make + +This example shows how to use Make and Cheerp together. + +## Usage + +```sh +$ make +``` diff --git a/examples/make/main.cpp b/examples/make/main.cpp new file mode 100644 index 0000000..e83dde4 --- /dev/null +++ b/examples/make/main.cpp @@ -0,0 +1,3 @@ +void webMain() { + // ... +}