Skip to content

Commit

Permalink
GitLab CI: Add web build
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Jul 15, 2024
1 parent c63065a commit bd97ccd
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ Thumbs.db
/out/
/.vs/
/CMakeSettings.json

# GitLab CI
/public/
/.gitlab-ci-local/
22 changes: 22 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bd97ccd

Please sign in to comment.