cmake: emscripten experimental support
This commit is contained in:
22
.github/workflows/amd64_web.yml
vendored
Normal file
22
.github/workflows/amd64_web.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# ref: https://github.com/docker-library/official-images
|
||||
name: amd64 Web
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
Distros:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Check docker
|
||||
run: |
|
||||
docker info
|
||||
docker buildx ls
|
||||
- name: Build env image
|
||||
run: make --directory=cmake web_env
|
||||
- name: Build devel project
|
||||
run: make --directory=cmake web_devel
|
||||
- name: Build project
|
||||
run: make --directory=cmake web_build
|
||||
- name: Test project
|
||||
run: make --directory=cmake web_test
|
||||
@@ -392,6 +392,46 @@ $(foreach stage,$(TOOLCHAIN_STAGES),$(eval $(call toolchain-stage-target,$(stage
|
||||
clean_toolchains: $(addprefix clean_toolchain_, $(TOOLCHAIN_STAGES))
|
||||
-rmdir $(addprefix cache/, $(TOOLCHAIN_TARGETS))
|
||||
|
||||
#########
|
||||
## WEB ##
|
||||
#########
|
||||
WEB_STAGES := env devel build test
|
||||
|
||||
define make-web-stage-target =
|
||||
#$$(info STAGE: $1)
|
||||
#$$(info Create target: web_$1.)
|
||||
.PHONY: web_$1
|
||||
web_$1: docker/web/Dockerfile
|
||||
#@docker image rm -f ${IMAGE}:web_$1 2>/dev/null
|
||||
${DOCKER_BUILD_CMD} --target=$1 --tag ${IMAGE}:web_$1 -f $$< ..
|
||||
|
||||
#$$(info Create target: save_web_$1 (debug).)
|
||||
.PHONY: save_web_$1
|
||||
save_web_$1: cache/web/docker_$1.tar
|
||||
cache/web/docker_$1.tar: web_$1
|
||||
@rm -f $$@
|
||||
mkdir -p cache/web
|
||||
docker save ${IMAGE}:web_$1 -o $$@
|
||||
|
||||
#$$(info Create target: sh_web_$1 (debug).)
|
||||
.PHONY: sh_web_$1
|
||||
sh_web_$1: web_$1
|
||||
${DOCKER_RUN_CMD} -it --name ${IMAGE}_web_$1 ${IMAGE}:web_$1
|
||||
|
||||
#$$(info Create target: clean_web_$1.)
|
||||
.PHONY: clean_web_$1
|
||||
clean_web_$1:
|
||||
docker image rm -f ${IMAGE}:web_$1 2>/dev/null
|
||||
rm -f cache/web/docker_$1.tar
|
||||
endef
|
||||
|
||||
$(foreach stage,$(WEB_STAGES),$(eval $(call make-web-stage-target,$(stage))))
|
||||
|
||||
## MERGE ##
|
||||
.PHONY: clean_web
|
||||
clean_web: $(addprefix clean_web_, $(WEB_STAGES))
|
||||
rm -f cache/web
|
||||
|
||||
#############
|
||||
## VAGRANT ##
|
||||
#############
|
||||
@@ -451,7 +491,7 @@ $(clean_glop_targets): clean_glop_%
|
||||
###########
|
||||
## CLEAN ##
|
||||
###########
|
||||
targets = $(addprefix clean_, $(DISTROS))
|
||||
targets = $(addprefix clean_, $(DISTROS)) clean_web
|
||||
vms = $(addprefix clean_, $(VMS))
|
||||
glops = $(addprefix clean_glop_, $(STAGES))
|
||||
.PHONY: clean $(targets)
|
||||
|
||||
31
cmake/docker/web/Dockerfile
Normal file
31
cmake/docker/web/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
# Create a virtual environment with all tools installed
|
||||
# ref: https://hub.docker.com/_/archlinux/
|
||||
FROM archlinux:latest AS env
|
||||
# Install system build dependencies
|
||||
ENV PATH=/usr/local/bin:$PATH
|
||||
RUN pacman -Syu --noconfirm git base-devel cmake
|
||||
RUN cmake -version
|
||||
RUN pacman -Syu --noconfirm nodejs emscripten
|
||||
ENV PATH=/usr/lib/emscripten:$PATH
|
||||
RUN emcc -v
|
||||
|
||||
# Add the library src to our build env
|
||||
FROM env AS devel
|
||||
WORKDIR /home/project
|
||||
COPY . .
|
||||
|
||||
FROM devel AS build
|
||||
RUN emcmake cmake -S. -Bbuild \
|
||||
-DCMAKE_BUILD_TYPE=Release -DBUILD_DEPS=ON \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DUSE_COINOR=OFF \
|
||||
-DUSE_GLPK=OFF \
|
||||
-DUSE_HIGHS=OFF \
|
||||
-DUSE_PDLP=OFF \
|
||||
-DUSE_SCIP=OFF
|
||||
RUN cmake --build build --target all -v
|
||||
#RUN cmake --build build --target install -v
|
||||
|
||||
FROM build AS test
|
||||
#RUN CTEST_OUTPUT_ON_FAILURE=1 cmake --build build --target test
|
||||
RUN cd build && ctest -V
|
||||
@@ -47,7 +47,7 @@ int64_t GetProcessMemoryUsage() {
|
||||
int64_t resident_memory = t_info.resident_size;
|
||||
return resident_memory;
|
||||
}
|
||||
#elif defined(__GNUC__) && !defined(__FreeBSD__) // LINUX
|
||||
#elif defined(__GNUC__) && !defined(__FreeBSD__) && !defined(__EMSCRIPTEN__) // LINUX
|
||||
int64_t GetProcessMemoryUsage() {
|
||||
unsigned size = 0;
|
||||
char buf[30];
|
||||
|
||||
Reference in New Issue
Block a user