(declare-project :name "geom"
:dependencies ["https://github.com/joy-framework/tester"])
(def- is-win (= (os/which) :windows))
(def- sep (if is-win "\\" "/"))
(def- modext (if is-win ".dll" ".so"))
(def- statext (if is-win ".static.lib" ".a"))
(rule "lib2geom.a" []
(def olddir (os/cwd))
(try
(do
(os/mkdir "build/lib2geom")
(os/cd "build/lib2geom")
(shell "cmake" "../../lib2geom" "-DCMAKE_CXX_FLAGS:STRING=-fPIC")
(shell "make" "2geom"))
([err] (print "Error compiling lib2geom.a: " err)))
(os/cd olddir))
(declare-native :name "geom"
:headers @["include/janet_2geom.h"]
:source @["src/point.cpp" "src/main.cpp"]
:compiler "g++"
:linker "g++"
:cflags ["-Wall" "-Wextra" "-Iinclude" "-Ilib2geom/src"]
:lflags ["build/lib2geom/src/2geom/lib2geom.a" "-ldl" "-ldouble-conversion" "-lgsl" "-lgslcblas" "-lm"])
(def- lname (string "build" sep "geom" statext))
(def- sname (string "build" sep "geom" modext))
(add-dep lname "lib2geom.a")
(add-dep sname "lib2geom.a")