git.s-ol.nu janet-2geom / master project.janet
master

Tree @master (Download .tar.gz)

project.janet @master

2626b5f
 
 
 
 
 
 
 
 
 
 
 
cf94ef1
 
 
2626b5f
 
 
7d82e09
cf94ef1
 
 
7d82e09
 
2626b5f
cf94ef1
2626b5f
 
 
 
 
(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")