Skip to content

Commit

Permalink
First version of caller - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasguts authored and fingolfin committed Jul 24, 2019
1 parent 2aa343a commit 0b5a8c5
Show file tree
Hide file tree
Showing 23 changed files with 849 additions and 103 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ docs/build
*.jl.*.cov
*.jl.mem
.gitattributes
/src/libraryfuncdictionary.jl
3 changes: 3 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ withenv("CPP_FLAGS"=>"-I$vdir/include", "LD_LIBRARY_PATH"=>"$vdir/lib:$nemodir/l
cmd = split(
"""
$srcs/configure
--with-libparse
--prefix=$vdir
--libdir=$vdir/lib
--disable-static
Expand Down Expand Up @@ -152,3 +153,5 @@ print("Running cmake")
run(`make VERBOSE=1`)
run(`make install`)

include("parselibs.jl")

46 changes: 46 additions & 0 deletions deps/parselibs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
function execute(cmd::Cmd)
out = Pipe()
err = Pipe()

process = run(pipeline(ignorestatus(cmd), stdout = out, stderr = err))
close(out.in)
close(err.in)

(stdout = String(read(out)),
stderr = String(read(err)),
code = process.exitcode)
end

libparsepath = abspath(joinpath(@__DIR__, "..", "local", "bin", "libparse"))

library_dir = ""

if haskey(ENV, "SINGULAR_LIBRARY_DIR")
library_dir = ENV["SINGULAR_LIBRARY_DIR"]
else
library_dir = abspath(joinpath(@__DIR__, "..", "local", "share", "singular", "LIB"))
end

filenames = filter(x -> endswith(x, ".lib"), readdir(library_dir))

output_filename = abspath(joinpath(@__DIR__, "..", "src", "libraryfuncdictionary.jl"))

open(output_filename, "w") do outputfile
println(outputfile, "libraryfunctiondictionary = Dict(")
for i in filenames
full_path = joinpath(library_dir, i)
libs = execute(`$libparsepath $full_path`)
if libs.stderr != ""
error("from libparse: $(libs.stderr)")
end
libs_splitted = split(libs.stdout,"\n")[4:end-1]
libs_splitted = [ split(i," ") for i in libs_splitted ]
libs_splitted = [ [ j for j in i if j != ""] for i in libs_splitted ]
println(outputfile, ":$(i[1:end - 4]) => [")
for j in libs_splitted
println(outputfile, """[ "$(j[1])", "$(j[3])" ],""")
end
println(outputfile, "],\n")
end
println(outputfile, ")\n")
end
4 changes: 2 additions & 2 deletions deps/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ include_directories(${nemo_includes})
include_directories(${singular_includes})
include_directories(${singular_includes}/singular)

SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14" )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -g" )
SET( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L${JULIA_LIB_DIR} -Wl,-rpath,${JULIA_LIB_DIR} -L${singular_libdir} -Wl,-rpath,${singular_libdir}" )

add_library(singularwrap SHARED singular.cpp rings.cpp coeffs.cpp ideals.cpp matrices.cpp)
add_library(singularwrap SHARED singular.cpp rings.cpp coeffs.cpp ideals.cpp matrices.cpp caller.cpp)
target_link_libraries(singularwrap JlCxx::cxxwrap_julia -ljulia "-lSingular -lpolys -lsingular_resources -lfactory -lomalloc -ldl")

install(TARGETS
Expand Down
Loading

0 comments on commit 0b5a8c5

Please sign in to comment.