
gmsh = Sys.which("gmsh")

if gmsh === nothing
  s = """
  No gmsh installation found in the system.
  Install gmsh and make sure that the gmsh executable
  can be found via the PATH environment variable.
  """
  error(s)
end

gmsh_root = dirname(gmsh)[1:end-4]

gmsh_jl = joinpath(gmsh_root,"lib","gmsh.jl")
if ! isfile(gmsh_jl)
  error("File not found: $gmsh_jl")
end

@info "Using the gmsh Julia API found in $gmsh_jl"

open("deps.jl","w") do f
  println(f, "# This file is automatically generated")
  println(f, "# Do not edit")
  println(f)
  println(f, :(const gmsh_jl = $gmsh_jl))
end

