Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scripts for Clang v0.17 #532

Merged
merged 9 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Clang = "40e3b903-d033-50b4-a0cc-940c62c95e31"

[compat]
Clang = "0.12"
Clang = "0.17"
48 changes: 0 additions & 48 deletions scripts/clang.jl

This file was deleted.

24 changes: 24 additions & 0 deletions scripts/gen.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2015 Dahua Lin, Miles Lubin, Joey Huchette, Iain Dunning, and
# contributors
#
# Use of this source code is governed by an MIT-style license that can be found
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.

# !!! note
#
# Run this script as `julia --project=. gen.jl`
#
# When updating, you must:
#
# * modify the `gurobi_c` constant to point to the correct filename
# * modify the `output_folder`

using Clang.Generators

const gurobi_c = "/Library/gurobi1003/macos_universal2/include/gurobi_c.h"
const output_folder = "gen100"

options = load_options(joinpath(@__DIR__, "generate.toml"))
options["general"]["output_file_path"] =
joinpath(@__DIR__, "..", "src", output_folder, "libgrb_api.jl")
build!(create_context([gurobi_c], get_default_args(), options))
30 changes: 30 additions & 0 deletions scripts/generate.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[general]
library_name = "libgurobi"
prologue_file_path = "prologue.jl"
output_file_path = "../src/gen100/libgrb_api.jl" # adjusted by gen.jl
print_using_CEnum = false
extract_c_comment_style = "doxygen"
output_ignorelist = [
"THREADCREATECB_ARGS",
"THREADJOINCB_ARGS",
"MALLOCCB_ARGS",
"CALLOCCB_ARGS",
"REALLOCCB_ARGS",
"FREECB_ARGS",
"CB_ARGS",
"LOGCB_ARGS",
"GRB_LESS_EQUAL",
"GRB_GREATER_EQUAL",
"GRB_EQUAL",
"GRB_CONTINUOUS",
"GRB_BINARY",
"GRB_INTEGER",
"GRB_SEMICONT",
"GRB_SEMIINT"
]

[codegen]
opaque_as_mutable_struct = false

[codegen.macro]
ignore_header_guards_with_suffixes = ["__stdcall"]
22 changes: 22 additions & 0 deletions scripts/prologue.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2015 Dahua Lin, Miles Lubin, Joey Huchette, Iain Dunning, and
# contributors
#
# Use of this source code is governed by an MIT-style license that can be found
# in the LICENSE.md file or at https://opensource.org/licenses/MIT.

# !format: off

# ============================ start of prologue.jl ============================
# These constants are handled explicitly in the prologue.jl to avoid them being
# automatically parsed as `const GRB_LESS_EQUAL = Cchar('<')`. There's probably
# a better way to handle this, but it works for now, and they won't be changing
# in future releases.
const GRB_LESS_EQUAL = '<'
const GRB_GREATER_EQUAL = '>'
const GRB_EQUAL = '='
const GRB_CONTINUOUS = 'C'
const GRB_BINARY = 'B'
const GRB_INTEGER = 'I'
const GRB_SEMICONT = 'S'
const GRB_SEMIINT = 'N'
# ============================= end of prologue.jl =============================
1 change: 0 additions & 1 deletion src/Gurobi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ elseif _is_patch(_GUROBI_VERSION, v"9.5")
include("gen95/libgrb_common.jl")
include("gen95/libgrb_api.jl")
elseif _is_patch(_GUROBI_VERSION, v"10.0")
include("gen100/libgrb_common.jl")
include("gen100/libgrb_api.jl")
else
error("""
Expand Down
Loading