Skip to content

Commit

Permalink
Improve extconf.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
kojix2 committed Oct 21, 2023
1 parent 5164f11 commit 2aa8abb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 31 deletions.
37 changes: 34 additions & 3 deletions ext/odgi/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,39 @@

require "mkmf-rice"

find_header("odgi.hpp", File.expand_path("../../odgi/src/", __dir__))
find_header("version.hpp", File.expand_path("../../odgi/src/", __dir__))
find_library("odgi", nil, File.expand_path("../../vendor", __dir__))
handlegraph_include_dir = File.expand_path("../../odgi/deps/libhandlegraph/src/include", __dir__)
hopscotchmap_include_dir = File.expand_path("../../odgi/deps/hopscotch-map/include", __dir__)
dynamic_include_dir = File.expand_path("../../odgi/deps/DYNAMIC/include", __dir__)
sparsepp_include_dir = File.expand_path("../../odgi/deps/sparsepp/sparsepp", __dir__)
flat_hash_map_include_dir = File.expand_path("../../odgi/deps/flat_hash_map", __dir__)
atomicbitvector_include_dir = File.expand_path("../../odgi/deps/atomicbitvector/include", __dir__)

odgi_include_dir = File.expand_path("../../odgi/src", __dir__)
odgi_library_dir = File.expand_path("../../odgi/lib", __dir__)

find_header("handlegraph/types.hpp", handlegraph_include_dir)
find_header("handlegraph/iteratee.hpp", handlegraph_include_dir)
find_header("handlegraph/util.hpp", handlegraph_include_dir)
find_header("handlegraph/handle_graph.hpp", handlegraph_include_dir)
find_header("handlegraph/path_handle_graph.hpp", handlegraph_include_dir)
find_header("handlegraph/mutable_handle_graph.hpp", handlegraph_include_dir)
find_header("handlegraph/mutable_path_handle_graph.hpp", handlegraph_include_dir)
find_header("handlegraph/mutable_path_mutable_handle_graph.hpp", handlegraph_include_dir)
find_header("handlegraph/deletable_handle_graph.hpp", handlegraph_include_dir)
find_header("handlegraph/mutable_path_deletable_handle_graph.hpp", handlegraph_include_dir)
find_header("handlegraph/serializable_handle_graph.hpp", handlegraph_include_dir)

find_header("tsl/hopscotch_map.h", hopscotchmap_include_dir)

find_header("dynamic.hpp", dynamic_include_dir)

find_header("spp.h", sparsepp_include_dir)

find_header("bytell_hash_map.hpp", flat_hash_map_include_dir)

find_header("atomic_bitvector.hpp", atomicbitvector_include_dir)

find_header("odgi-api.h", odgi_include_dir)
find_library("odgi", nil, odgi_library_dir)

create_makefile("odgi/odgi")
33 changes: 5 additions & 28 deletions ext/odgi/odgi.cpp
Original file line number Diff line number Diff line change
@@ -1,39 +1,16 @@
#include <rice/rice.hpp>
#include <rice/stl.hpp>

#include "version.hpp"
#include "odgi-api.h"

using namespace Rice;

// version.hpp

String get_version()
{
return String(odgi::Version::get_version());
}

String get_release()
{
return String(odgi::Version::get_release());
}

String get_codename()
{
return String(odgi::Version::get_codename());
}

String get_short()
{
return String(odgi::Version::get_short());
String rb_odgi_version() {
return detail::to_ruby(odgi_version());
}

// odgi.hpp

extern "C" void Init_odgi(void)
extern "C" void Init_odgi()
{
define_module("Odgi")
.define_module_function("get_version", &get_version)
.define_module_function("get_release", &get_release)
.define_module_function("get_codename", &get_codename)
.define_module_function("get_short", &get_short);
.define_module_function("odgi_version", &rb_odgi_version);
}

0 comments on commit 2aa8abb

Please sign in to comment.