Skip to content

Commit

Permalink
Merge pull request #7 from trixi-framework/msl/add-jll-dependency
Browse files Browse the repository at this point in the history
Use smesh_jll
  • Loading branch information
sloede authored Jan 26, 2024
2 parents 4645d6b + 613297a commit 0e9ef7e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 92 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# BEGIN - Build smesh locally - remove once JLL package is available
- name: Get smesh
uses: actions/checkout@v4
with:
repository: trixi-framework/smesh
path: smesh
- name: Build smesh (Linux)
run: |
mkdir smesh/build && cd smesh/build
cmake .. -DCMAKE_INSTALL_PREFIX=../install
cmake --build .
cmake --install .
cd ../../docs
cat << EOF > LocalPreferences.toml
[Smesh]
libsmesh = "$(pwd)/smesh/install/lib/libsmesh.so"
EOF
# END - Build smesh locally - remove once JLL package is available
- uses: julia-actions/setup-julia@v1
with:
version: '1'
Expand Down
54 changes: 5 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,57 +47,13 @@ jobs:
- ubuntu-latest
- macOS-latest
- windows-latest
exclude:
- os: macOS-latest
version: 1.8
- os: macOS-latest
version: 1.9
steps:
- uses: actions/checkout@v4
# BEGIN - Build smesh locally - remove once JLL package is available
- uses: msys2/setup-msys2@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
update: true
install: git base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
- name: Get smesh
uses: actions/checkout@v4
with:
repository: trixi-framework/smesh
path: smesh
- name: Build smesh (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
mkdir smesh/build && cd smesh/build
cmake .. -DCMAKE_INSTALL_PREFIX=../install
cmake --build .
cmake --install .
cd ../..
cat << EOF > LocalPreferences.toml
[Smesh]
libsmesh = "$(pwd)/smesh/install/lib/libsmesh.so"
EOF
- name: Build smesh (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: |
mkdir smesh/build && cd smesh/build
FC=gfortran-13 cmake .. -DCMAKE_INSTALL_PREFIX=../install
cmake --build .
cmake --install .
cd ../..
cat << EOF > LocalPreferences.toml
[Smesh]
libsmesh = "$(pwd)/smesh/install/lib/libsmesh.dylib"
EOF
- name: Build smesh
if: ${{ matrix.os == 'windows-latest' }}
run: |
mkdir smesh/build && cd smesh/build
FC=gfortran cmake .. -DCMAKE_INSTALL_PREFIX=../install
cmake --build .
cmake --install .
cd ../..
cat << EOF > LocalPreferences.toml
[Smesh]
libsmesh = "D:\\\\a\\\\Smesh.jl\\\\Smesh.jl\\\\smesh\\\\install\\\\bin\\\\libsmesh.dll"
EOF
shell: 'msys2 {0}'
# END - Build smesh locally - remove once JLL package is available
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "0.1.0"

[deps]
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
smesh_jll = "e8c45408-479c-54df-ae5b-4501057d3a5a"

[compat]
Preferences = "1"
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ operating system](https://julialang.org/downloads/platform/).
[Smesh.jl](https://github.com/trixi-framewor/Smesh.jl) works with Julia v1.8
and later on Linux, macOS and Windows platforms.

To use Smesh.jl, you currently need to manually install the underlying Fortran package smesh
(note that this is subject to change in the near future). For installation instructions,
please follow the README in the [smesh](https://github.com/trixi-framework/smesh)
repository.
*Note: On pre-Apple Silicon systems with macOS, Julia v1.10 or later is required.*

### Installation
Since Smesh.jl is a not registered Julia package yet, you can install it by executing
Expand All @@ -31,9 +28,10 @@ the following commands in the Julia REPL:
julia> import Pkg; Pkg.add("https://github.com/trixi-framework/Smesh.jl")
```

To make use of the local smesh build, you need to tell Smesh.jl where to find the library.
For this, create a `LocalPreferences.toml` file next to your `Project.toml` for the project
in which you use Smesh.jl. It should have the following content:
By default, Smesh.jll uses pre-compiled binaries of the smesh package that will get
automatically installed when obtaining Smesh.jl. However, you can also make use of a local
smesh build. For this, create a `LocalPreferences.toml` file next to your `Project.toml`
for the project in which you use Smesh.jl. It should have the following content:

* On Linux:
```toml
Expand Down
20 changes: 2 additions & 18 deletions src/Smesh.jl
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
module Smesh

using Preferences: @load_preference, @has_preference
using smesh_jll: smesh_jll

export build_delaunay_triangulation

if !@has_preference("libsmesh")
error("""
Missing preference `libsmesh` for package Smesh.jl. Please add a
`LocalPreferences.toml` file to your current Julia project with the following
content, where `path/to/libsmesh.{ext}` is the path to your local build of
libsmesh and `{ext}` is the appropriate extension for shared libraries on your
system (e.g., `so` on Linux, `dylib` on macOS, `dll` on Windows). Afterwards,
you need to restart Julia.
Content of `LocalPreferences.toml` (between the '```' marks):
```
[Smesh]
libsmesh = "path/to/libsmesh.{ext}"
```
""")
end
const libsmesh = @load_preference("libsmesh")
const libsmesh = @load_preference("libsmesh", smesh_jll.libsmesh)


"""
Expand Down

0 comments on commit 0e9ef7e

Please sign in to comment.