Skip to content

Commit

Permalink
Merge pull request #21 from nandor/master
Browse files Browse the repository at this point in the history
upgraded to dune 2.0, fixed cross-compilation
  • Loading branch information
mseri authored Dec 11, 2019
2 parents 114eafe + e881966 commit 0b72a53
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 449 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
PHONY: build
build:
dune build -p eigen eigen_cpp/libeigen_cpp_stubs.a
dune build -p eigen

PHONY: install
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(lang dune 1.5)
(lang dune 2.0)
(name eigen)
3 changes: 1 addition & 2 deletions eigen.opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ dev-repo: "git+https://github.com/owlbarn/eigen.git"
bug-reports: "https://github.com/owlbarn/eigen/issues"
doc: "https://owlbarn.github.io/eigen/eigen"
build: [
["dune" "build" "-p" name "eigen_cpp/libeigen_cpp_stubs.a"]
["dune" "build" "-p" name "-j" jobs]
]
depends: [
"ocaml" {>= "4.02"}
"ctypes" {>= "0.14.0"}
"dune" {>= "1.5.0"}
"dune" {>= "2.0.0"}
]
synopsis: "Owl's OCaml interface to Eigen3 C++ library"
description:
Expand Down
7 changes: 5 additions & 2 deletions eigen/dune
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ let () = Printf.ksprintf Jbuild_plugin.V1.send {|
(public_name eigen)
(libraries ctypes eigen.cpp)
(modules :standard ffi_eigen_generated)
(c_names eigen_utils_stubs ffi_eigen_generated_stub)
(c_flags :standard %s -I../eigen_cpp/lib) ;-flto
(foreign_stubs
(language c)
(names eigen_utils_stubs ffi_eigen_generated_stub)
(flags :standard %s -I../eigen_cpp/lib)
)
(c_library_flags :standard -lstdc++)
)
|} eigen_flags
50 changes: 33 additions & 17 deletions eigen_cpp/dune
Original file line number Diff line number Diff line change
@@ -1,23 +1,39 @@
(rule
(targets libeigen_cpp_stubs.a dlleigen_cpp_stubs.so)
(deps lib/libeigen.a lib/libeigen.so)
(action
(progn
(bash "cp lib/libeigen.a libeigen.a")
(bash "ar -x libeigen.a")
(bash "ocamlmklib.opt -g -o eigen_cpp_stubs *.o -lstdc++")
)
)
)
(* -*- tuareg -*- *)

let optflags =
match Sys.getenv "EIGENCPP_OPTFLAGS" with
| s ->
s
| exception Not_found ->
"-Ofast -march=native -mfpmath=sse -funroll-loops -ffast-math"

let () = Printf.ksprintf Jbuild_plugin.V1.send {|

(include_subdirs unqualified)

(library
(name eigen_cpp)
(name eigen_cpp_stubs)
(public_name eigen.cpp)
(libraries ctypes)
(c_library_flags
(:standard -lstdc++)
)
(self_build_stubs_archive
(eigen_cpp)
(foreign_stubs
(language cxx)
(names eigen_tensor eigen_dsmat eigen_spmat)
(include_dirs lib lib/unsupported)
(flags
:standard
-fPIC
-ansi
-O3
-std=c++11
-pedantic
-Wall
-Wno-invalid-partial-specialization
-Wno-extern-c-compat
-Wno-c++11-long-long
%s
)
)
(c_library_flags :standard -lstdc++)
)

|} optflags
19 changes: 0 additions & 19 deletions eigen_cpp/lib/Eigen/CMakeLists.txt

This file was deleted.

6 changes: 5 additions & 1 deletion eigen_cpp/lib/Eigen/src/Core/util/Meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
#include <math_constants.h>
#endif

// This is a hack to avoid redefining the macro with a different value.
// Meta.h and Macros.h do not agree on the definition of C++11.
#ifndef EIGEN_HAS_CXX11
#if EIGEN_COMP_ICC>=1600 && __cplusplus >= 201103L
#define EIGEN_HAS_CXX11 1
#else
#define EIGEN_HAS_CXX11 0
#endif
#endif

// Define portable (u)int{32,64} types
#if EIGEN_HAS_CXX11
Expand Down Expand Up @@ -492,7 +496,7 @@ template<typename T, typename U> struct scalar_product_traits
} // end namespace internal

namespace numext {

#if defined(__CUDA_ARCH__)
template<typename T> EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
#else
Expand Down
16 changes: 0 additions & 16 deletions eigen_cpp/lib/Makefile

This file was deleted.

22 changes: 0 additions & 22 deletions eigen_cpp/lib/dune

This file was deleted.

7 changes: 0 additions & 7 deletions eigen_cpp/lib/unsupported/CMakeLists.txt

This file was deleted.

32 changes: 0 additions & 32 deletions eigen_cpp/lib/unsupported/Eigen/CMakeLists.txt

This file was deleted.

8 changes: 0 additions & 8 deletions eigen_cpp/lib/unsupported/Eigen/CXX11/CMakeLists.txt

This file was deleted.

8 changes: 0 additions & 8 deletions eigen_cpp/lib/unsupported/Eigen/NeuralNetwork/Makefile

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions eigen_cpp/lib/unsupported/doc/CMakeLists.txt

This file was deleted.

20 changes: 0 additions & 20 deletions eigen_cpp/lib/unsupported/doc/examples/CMakeLists.txt

This file was deleted.

26 changes: 0 additions & 26 deletions eigen_cpp/lib/unsupported/doc/snippets/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 0b72a53

Please sign in to comment.