(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
(shell "pwd")
(os/mkdir "lib2geom/build")
(os/cd "lib2geom/build")
(shell "cmake" ".." "-DCMAKE_CXX_FLAGS:STRING=-fPIC")
(shell "make" "2geom"))
([err] (print "Error compiling lib2geom.a: " err)))
(os/cd olddir))
(add-body "clean"
(shell "rm" "-rf" "lib2geom/build")
(print "Deleted lib2geom build directory."))
(declare-native :name "geom" :source @["src/point.cpp" "src/main.cpp"]
:compiler "g++"
:linker "g++"
:cflags ["-Wall" "-Wextra" "-Iinclude" "-Ilib2geom/src"]
:lflags ["lib2geom/build/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")