Skip to content

Commit

Permalink
julia: export from google3
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizux committed Feb 10, 2025
1 parent 0cc982d commit f95a59d
Show file tree
Hide file tree
Showing 10 changed files with 4,294 additions and 6 deletions.
5 changes: 4 additions & 1 deletion ortools/julia/ORTools.jl/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ version = "1.0.0-DEV"

[deps]
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
ORToolsGenerated = "6b269722-41d3-11ee-be56-0242ac120002"
ProtoBuf = "3349acd9-ac6a-5e09-bcdb-63829b23a429"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
julia = "1.6.7"
julia = "1.10"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
4 changes: 2 additions & 2 deletions ortools/julia/ORTools.jl/src/ORTools.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module ORTools

# Write your package code here.
# TODO: b/384496822 - Run formatter across entire package
include("moi_wrapper/MOI_wrapper.jl")

end
56 changes: 56 additions & 0 deletions ortools/julia/ORTools.jl/src/c_wrapper/c_wrapper.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
libortools = ORTools_jll.libortools

function MathOptNewInterrupter()
return ccall((:MathOptNewInterrupter, libortools),
Ptr{Cvoid},
(Cvoid,),
ptr)
end

function MathOptFreeInterrupter(ptr)
return ccall((:MathOptFreeInterrupter, libortools),
Cvoid,
(Ptr{Cvoid},),
ptr)
end

function MathOptInterrupt(ptr)
return ccall((:MathOptInterrupt, libortools),
Cvoid,
(Ptr{Cvoid},),
ptr)
end

function MathOptIsInterrupted(ptr)
return ccall((:MathOptIsInterrupted, libortools),
Cint,
(Ptr{Cvoid},),
ptr)
end

function MathOptFree(ptr)
return ccall((:MathOptFree, libortools),
Cvoid,
(Ptr{Cvoid},),
ptr)
end

function MathOptSolve(model, model_size, solver_type, interrupter, solve_result, solve_result_size, status_msg)
return ccall((:MathOptSolve, libortools),
Cint,
(Ptr{Cvoid},
Csize_t,
Cint,
Ptr{Cvoid},
Ptr{Ptr{Cvoid}},
Ptr{Csize_t},
Ptr{Ptr{Cchar}}),
model,
model_size,
solver_type,
interrupter,
solve_result,
solve_result_size,
status_msg)
end

Loading

0 comments on commit f95a59d

Please sign in to comment.