Skip to content

Commit

Permalink
Merge pull request #23 from GLVis/ci-build
Browse files Browse the repository at this point in the history
Adding in CI for building. Moving font download to makefile. Updating readme. Adding OFL license info.
  • Loading branch information
justinlaughlin authored Aug 22, 2024
2 parents 1dba29c + 55c13dd commit 4152561
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 11 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# build.yml

name: Build

on:
workflow_dispatch:
inputs:
mfem-ref:
type: string
default: 'master'
glvis-ref:
type: string
default: 'master'
emscripten-version:
type: string
# We use 3.1.51 because later versions give compiler errors
# (possibly related to https://github.com/emscripten-core/emscripten/issues/21128)
default: '3.1.51'
pull_request:

jobs:
build:
runs-on: ubuntu-latest

env:
mfem-ref: ${{ github.event_name == 'pull_request' && 'master' || inputs.mfem-ref }}
glvis-ref: ${{ github.event_name == 'pull_request' && 'master' || inputs.glvis-ref }}
emscripten-version: ${{ github.event_name == 'pull_request' && '3.1.51' || inputs.emscripten-version }}

name: >-
build glvis-js |
mfem=${{ github.event_name == 'pull_request' && 'master' || inputs.mfem-ref }} |
glvis=${{ github.event_name == 'pull_request' && 'master' || inputs.glvis-ref }} |
emcc=${{ github.event_name == 'pull_request' && '3.1.51' || inputs.emscripten-version }}
steps:
# ---------------------------------------------------------------------------------
# Install glvis-js and dependencies
# ---------------------------------------------------------------------------------
- name: Checkout glvis-js
uses: actions/checkout@v4
with:
submodules: recursive
path: glvis-js

- name: Install glvis dependencies
run: |
sudo apt-get install libfontconfig1-dev libfreetype-dev libsdl2-dev \
libglew-dev libglm-dev libpng-dev
- name: Checkout emscripten
uses: actions/checkout@v4
with:
repository: emscripten-core/emsdk
path: emsdk

- name: Install emscripten
run: |
cd emsdk
./emsdk install ${{ env.emscripten-version }}
./emsdk activate ${{ env.emscripten-version }}
echo "${GITHUB_WORKSPACE}/emsdk" >> $GITHUB_PATH
echo "${GITHUB_WORKSPACE}/emsdk/upstream/emscripten" >> $GITHUB_PATH
- name: Checkout mfem
uses: actions/checkout@v4
with:
repository: mfem/mfem
ref: ${{ env.mfem-ref }}
path: mfem

- name: Checkout glvis
uses: actions/checkout@v4
with:
repository: glvis/glvis
ref: ${{ env.glvis-ref }}
path: glvis

- name: Install glvis-js (also installs mfem + glvis)
run: |
cd glvis-js
make install -j 4
# ---------------------------------------------------------------------------------
# Generate an artifact
# ---------------------------------------------------------------------------------
- name: Print artifact info
run: |
cat glvis-js/src/versions.js
sha256sum glvis-js/src/*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: glvis-js
path: glvis-js/src
retention-days: 1
88 changes: 88 additions & 0 deletions OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Copyright 2020 The Open Sans Project Authors (https://github.com/googlefonts/opensans)

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,14 @@ open basic.html
git submodule update --init --recursive
```

4. Get a copy of _OpenSans.ttf_ and put it in the GLVis root directory. For example

```
cd glvis-js
curl -s -o ../glvis/OpenSans.ttf https://raw.githubusercontent.com/google/fonts/master/apache/opensans/OpenSans-Regular.ttf
```

5. Build:
4. Build:

```
make realclean # or just clean if you don't want to rebuild mfem
make install -j
```

6. Patch glvis.js (temporary):
5. Patch glvis.js (temporary):

Edit src/glvis.js and add `return 0;` to the top of `_JSEvents_requestFullscreen` (see Known
Issues)
Expand Down
16 changes: 14 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ all: $(LIB_GLVIS_JS)

$(LIB_MFEM):
# ranlib causes problems
@$(MAKE) -C $(MFEM_DIR) CXX=$(EMCXX) MFEM_TIMER_TYPE=0 \
BUILD_DIR=$(MFEM_BUILD_DIR) serial AR=$(EMAR) ARFLAGS=rcs RANLIB=echo
@$(MAKE) -C $(MFEM_DIR) BUILD_DIR=$(MFEM_BUILD_DIR) config CXX=$(EMCXX) \
MFEM_TIMER_TYPE=0 AR=$(EMAR) ARFLAGS=rcs RANLIB=echo
$(MAKE) -C $(MFEM_BUILD_DIR) -j 4

$(LIB_GLVIS_JS): $(LIB_MFEM)
@$(MAKE) get_opensans
@$(MAKE) -C $(GLVIS_DIR) GLM_DIR=$(GLM_ROOT) MFEM_DIR=$(MFEM_BUILD_DIR) \
GLVIS_USE_LOGO=NO GLVIS_USE_LIBPNG=YES js

Expand Down Expand Up @@ -64,6 +66,16 @@ serve:
servelocal:
python3 -m http.server 8000 --bind 127.0.0.1

get_opensans:
@if [ ! -f "$(GLVIS_DIR)/OpenSans.ttf" ]; then \
curl -s "https://fonts.googleapis.com/css2?family=Open+Sans&display=swap" | \
grep -o "https://fonts.gstatic.com/[^)]*" | \
xargs -n 1 curl -s -o $(GLVIS_DIR)/OpenSans.ttf; \
echo "Downloaded OpenSans.ttf to $(GLVIS_DIR)"; \
else \
echo "GLVis already has OpenSans.ttf. Skipping download."; \
fi

realclean: clean
@test -d $(MFEM_BUILD_DUR) && rm -rf $(MFEM_BUILD_DIR)

Expand Down

0 comments on commit 4152561

Please sign in to comment.