Skip to content

Commit

Permalink
Merge pull request #29 from JuliaWeb/32bit
Browse files Browse the repository at this point in the history
Add tests for x86
  • Loading branch information
JamesWrigley authored Oct 27, 2024
2 parents d9ce7ad + 3e6ffd7 commit ffe521c
Show file tree
Hide file tree
Showing 9 changed files with 6,150 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
- ubuntu-latest
arch:
- x64
- x86
exclude:
- os: macOS-latest
arch: x86
include:
- version: '1.9'
allow_failure: false
Expand Down
2 changes: 0 additions & 2 deletions codecov.yml

This file was deleted.

58 changes: 33 additions & 25 deletions gen/gen.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,31 +233,39 @@ function rewrite!(ctx)
end

cd(@__DIR__) do
# Load the doxygen tags
ctx_objects[:tags] = read_tags()

# Set the options
options = Clang.load_options(joinpath(@__DIR__, "generator.toml"))
options["general"]["callback_documentation"] = get_docs
ctx_objects[:codegen_options] = options["codegen"]

include_dir = normpath(libssh_jll.artifact_dir, "include")
headers = [joinpath(include_dir, "libssh", name) for name in
["libssh.h", "libssh_version.h", "sftp.h", "server.h", "callbacks.h"]]
args = Clang.get_default_args()
push!(args, "-I$include_dir", "-DWITH_SERVER=1")

# Generate the bindings
ctx = Clang.create_context(headers, args, options)
ctx_objects[:dag] = ctx.dag
Clang.build!(ctx, Clang.BUILDSTAGE_NO_PRINTING)

# Rewrite expressions
rewrite!(ctx)

Clang.build!(ctx, Clang.BUILDSTAGE_PRINTING_ONLY)

empty!(ctx_objects)
# There are some parts of the bindings where the difference in pointer size
# on 32bit/64bit platforms is important, like the generated getproperty()
# methods. Hence we generate 32bit and 64bit bindings for Linux only (they
# should only be architecture-dependent, not OS-dependent).
for target in ("x86_64-linux-gnu", "i686-linux-gnu")
# Load the doxygen tags
ctx_objects[:tags] = read_tags()

# Set the options
options = Clang.load_options(joinpath(@__DIR__, "generator.toml"))
options["general"]["callback_documentation"] = get_docs
options["general"]["output_file_path"] = joinpath(@__DIR__, "..", "lib", "$(target).jl")
ctx_objects[:codegen_options] = options["codegen"]

include_dir = normpath(libssh_jll.artifact_dir, "include")
headers = [joinpath(include_dir, "libssh", name) for name in
["libssh.h", "libssh_version.h", "sftp.h", "server.h", "callbacks.h"]]

args = Clang.get_default_args(target)
push!(args, "-I$include_dir", "-DWITH_SERVER=1")

# Generate the bindings
ctx = Clang.create_context(headers, args, options)
ctx_objects[:dag] = ctx.dag
Clang.build!(ctx, Clang.BUILDSTAGE_NO_PRINTING)

# Rewrite expressions
rewrite!(ctx)

Clang.build!(ctx, Clang.BUILDSTAGE_PRINTING_ONLY)

empty!(ctx_objects)
end

nothing
end
Loading

0 comments on commit ffe521c

Please sign in to comment.