summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2019-11-29 14:40:50 +0000
committers-ol <s-ol@users.noreply.github.com>2019-11-29 16:14:18 +0000
commit2626b5f86c7a474bda0bf7b752c5d69d762272e2 (patch)
tree12bb84b2f4c0bd89c60c60dbef4595529a346051
parentmore point methods (diff)
downloadjanet-2geom-2626b5f86c7a474bda0bf7b752c5d69d762272e2.tar.gz
janet-2geom-2626b5f86c7a474bda0bf7b752c5d69d762272e2.zip
better jpm build
-rw-r--r--project.janet37
1 files changed, 29 insertions, 8 deletions
diff --git a/project.janet b/project.janet
index 3a1366e..692a48d 100644
--- a/project.janet
+++ b/project.janet
@@ -1,12 +1,33 @@
-(declare-project :name "geom")
+(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."))
-(os/shell (string/join [
- "mkdir" "-p" "lib2geom/build" "&&"
- "cd" "lib2geom/build" "&&"
- "cmake" ".." "-D2GEOM_BUILD_SHARED:BOOL=ON" "&&"
- "make" "2geom"] " "))
(declare-native :name "geom" :source @["src/point.cpp" "src/main.cpp"]
:compiler "g++"
:linker "g++"
- :cflags ["-Wall" "-Wextra" "-Iinclude" "-Ilib2geom/src" "-Llib2geom/build/src/2geom"]
- :lflags ["-l2geom" "-ldl" "-ldouble-conversion" "-lgsl" "-lgslcblas" "-lm"])
+ :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")