diff --git a/.gitignore b/.gitignore index cf6473bc..5c786125 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,7 @@ Thumbs.db /out/ /.vs/ /CMakeSettings.json + +# GitLab CI +/public/ +/.gitlab-ci-local/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 922335f6..23b4f014 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -54,15 +54,37 @@ steamos: - cmake -Bbuild-steamos-release -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=0 -DJNGL_VIDEO=0 -DJNGL_BUILD_WEBP_FROM_SOURCE=1 -DBUILD_SHARED_LIBS=0 - cmake --build build-steamos-release +web: + image: emscripten/emsdk:3.1.61 + stage: build + script: + - emcmake cmake -Bbuild-web + - cp -r data build-web/ + - cd build-web + - make -j$(nproc) + - mkdir -p ../public/demo + - mv jngl-test.html ../public/demo + - mv jngl-test.wasm ../public/demo + - mv jngl-test.js ../public/demo + - mv jngl-test.data ../public/demo + artifacts: + paths: + - public/demo + pages: stage: deploy + dependencies: + - web script: - microdnf install -y doxygen cmake make tar xz git >/dev/null - cd doc - cmake . - make - doxygen + - mv ../public __tmp - mv html ../public + - mv __tmp/demo ../public + - rm -r __tmp artifacts: paths: - public diff --git a/CMakeLists.txt b/CMakeLists.txt index aec97272..a05f4780 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,14 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") string(APPEND CMAKE_C_FLAGS " -Wno-shorten-64-to-32") # ogg, vorbis, etc. are full of these endif() +if(${CMAKE_SYSTEM_NAME} MATCHES "Emscripten") + set(USE_FLAGS "-sUSE_SDL=2 -sUSE_FREETYPE=1 -sUSE_VORBIS=1") + string(APPEND CMAKE_CXX_FLAGS " ${USE_FLAGS} -sNO_DISABLE_EXCEPTION_CATCHING") + string(APPEND CMAKE_C_FLAGS " ${USE_FLAGS}") + string(APPEND CMAKE_EXE_LINKER_FLAGS " ${USE_FLAGS} -sASSERTIONS=1 --preload-file data") + set(CMAKE_EXECUTABLE_SUFFIX ".html") +endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") file(GLOB SRC src/*.cpp src/jngl/*.cpp