Skip to content

Commit

Permalink
test 1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
shipengcheng1230 committed Apr 15, 2021
1 parent f091ca1 commit d9c98d0
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment:
matrix:
- julia_version: 1.5
- julia_version: 1.6
- julia_version: nightly

platform:
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ os:
- linux
- osx
julia:
- 1.5
- 1.6
- nightly
notifications:
email: false
Expand All @@ -30,7 +30,7 @@ jobs:
fast_finish: true
include:
- stage: "Documentation"
julia: 1.5
julia: 1.6
os: linux
install:
# mkdocs-material isn't available at the default py2 on travis-ci for now
Expand Down
9 changes: 3 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
name = "GmshTools"
uuid = "82e2f556-b1bd-5f1a-9576-f93c0da5f0ee"
authors = ["Pengcheng Shi"]
version = "0.4.2"
version = "0.5.0"

[deps]
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
gmsh_jll = "630162c2-fc9b-58b3-9910-8442a8a132e6"

[compat]
Requires = "1.0"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[targets]
test = ["Test", "Pkg"]
test = ["Test"]
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,4 @@
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://shipengcheng1230.github.io/GmshTools.jl/stable/)
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://shipengcheng1230.github.io/GmshTools.jl/dev/)

To use [Gmsh](http://gmsh.info/) mesh program.

# Notice

- Users could set the environment variable `GMSH_LIB_PATH` to your source-compiled Gmsh library
directory and rebuild this package. For windows user, you need to create a link from `gmsh-*.*.dll` to `libgmsh.dll` since something has changed with `find_library` after Julia *v1.4*.

- Before Gmsh *v4.6.0*, if your Julia is compiled with [Intel MKL](https://github.com/JuliaComputing/MKL.jl), then it must be compiled with 32 integer interface (otherwise Julia will crash due to BLAS interface incompatibility), i.e. linking to **lp64** instead of **ipl64**. To do so, in `Make.inc`, change to
```makefile
export MKL_INTERFACE_LAYER := LP64
MKLLIB := $(MKLROOT)/lib/intel64
```

- Since *v0.4.0*, you will need to manually install [Gmsh_SDK_jll.jl](https://github.com/shipengcheng1230/Gmsh_SDK_jll.jl), which, due to some building issues, cannot fit into [JuliaBinaryWrappers](https://github.com/JuliaBinaryWrappers) for now. The building procedure is hosted at [GmshBuilder.jl](https://github.com/shipengcheng1230/GmshBuilder.jl).
To use [Gmsh](http://gmsh.info/) mesh program in a more convenient way.
88 changes: 45 additions & 43 deletions deps/build.jl
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
using Libdl
using Pkg
# Copied from https://github.com/gridap/GridapGmsh.jl/blob/master/deps/build.jl
# to use the new officially registered Gmsh JLL

const depsfile = joinpath(@__DIR__, "deps.jl")
gmsh_root = nothing

const libpath = get(ENV, "GMSH_LIB_PATH", nothing)

if libpath === nothing
open(depsfile, "w") do io
print(io,
raw"""
# This file is automatically generated
# Do not edit
using Gmsh_SDK_jll
check_deps() = nothing
include(joinpath(dirname(Gmsh_SDK_jll.libgmsh_path), "gmsh.jl"))
"""
)
end
if haskey(ENV,"GMSHROOT") && !isempty(ENV["GMSHROOT"])
gmsh_root = ENV["GMSHROOT"]
@info """
Using the gmsh installation found via the GMSHROOT environment variable.
GMSHROOT=$gmsh_root"""
else
# For windows, you must create a link from `gmsh-*.*.dll` to `libgmsh.dll`
libgmsh = find_library("libgmsh", [libpath])
if isempty(libgmsh)
@static if Sys.iswindows()
@info "You may create a link from `gmsh-*.*.dll` to `libgmsh.dll`."
end
error("libgmsh is not found in $libpath.")
end

libgmsh_size = filesize(dlpath())
using gmsh_jll
GMSH_FOUND = gmsh_jll.is_available()
if GMSH_FOUND
gmsh_root = gmsh_jll.artifact_dir
@info """
Using the gmsh installation installed via BinaryBuilder."""
end
end

open(depsfile, "w") do io
println(io,
"""
# This file is automatically generated
# Do not edit
function check_deps()
if libgmsh_size != filesize(Libdl.dlpath(libgmsh_size))
error("Gmsh library has changed, re-run Pkg.build(\\\"GmshTools\\\")")
end
end
include(joinpath(libpath, "gmsh.jl"))
"""
)
println(io, :(const libgmsh = $libgmsh))
println(io, :(const libgmsh_size = $libgmsh_size))
end
GMSH_FOUND = false
if gmsh_root != nothing
gmsh_bin = (Sys.iswindows() ? joinpath(gmsh_root,"bin","gmsh.exe") :
joinpath(gmsh_root,"bin","gmsh"))
if isfile(gmsh_bin)
GMSH_FOUND = true
@info "gmsh binary found in $gmsh_bin"
else
@warn """
gmsh binary not found in $gmsh_bin
Make sure that GMSHROOT points to a correct gmsh installation"""
end
gmsh_jl = joinpath(gmsh_root,"lib","gmsh.jl")
if isfile(gmsh_jl)
GMSH_FOUND = true
@info "Using the gmsh Julia API found in $gmsh_jl"
else
@warn """
gmsh Julia API not found in $gmsh_jl
Make sure that you have installed the full gmsh SDK"""
end
end

open("deps.jl","w") do f
println(f, "# This file is automatically generated")
println(f, "# Do not edit")
println(f)
println(f, :(const GMSH_FOUND = $GMSH_FOUND))
println(f, :(const gmsh_jl = $gmsh_jl))
end
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Install
```julia
(v1.4) pkg> add GmshTools
(v1.6) pkg> add GmshTools
```

## Use Existed Library
Expand All @@ -18,7 +18,7 @@ julia> Pkg.build("GmshTools")

## SDK Version

We switch to use [Gmsh_SDK_jll](https://github.com/shipengcheng1230/Gmsh_jll.jl/) after *v0.4.0*.
We switch to use [gmsh_jll](https://github.com/JuliaBinaryWrappers/gmsh_jll.jl) after *v0.5.0*.

## Basic Usage

Expand Down
38 changes: 25 additions & 13 deletions src/GmshTools.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
module GmshTools

using Requires
using Libdl

const depsfile = joinpath(@__DIR__, "..", "deps", "deps.jl")
# if isfile(depsfile)
# include(depsfile)
# else
# error("GmshTools is not properly installed. Please run Pkg.build(\"GmshTools\") ",
# "and restart Julia.")
# end
deps_jl = joinpath(@__DIR__, "..", "deps", "deps.jl")
if !isfile(deps_jl)
s = """
Package GmshTools not installed properly.
Run Pkg.build(\"GridapGmsh\"), restart Julia and try again.
"""
error(s)
end

include(deps_jl)

function __init__()
# check_deps()
@require Gmsh_SDK_jll="4abbd9bc-5e42-58f8-a031-9aef3230cdd8" begin
isfile(depsfile) || include(joinpath(dirname(@__DIR__), "deps", "build.jl"))
include(depsfile)
if GMSH_FOUND
include(gmsh_jl)
# Hack taken from MPI.jl
function __init__()
@static if Sys.isunix()
Libdl.dlopen(gmsh.lib, Libdl.RTLD_LAZY | Libdl.RTLD_GLOBAL)
end
end
else
s = """
Gmsh not found in system paths.
Install Gmsh or export path to Gmsh and rebuild the project.
Run Pkg.build(\"GmshTools\"), restart Julia and try again.
"""
@warn s
end

export
Expand Down
5 changes: 0 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using GmshTools
using Test
using Pkg

# temporary solution to bypass General registry
Pkg.add(PackageSpec(url="https://github.com/shipengcheng1230/Gmsh_SDK_jll.jl"))
using Gmsh_SDK_jll

try
gmsh.initialize()
Expand Down

0 comments on commit d9c98d0

Please sign in to comment.