Browse Source

Add pqp (#289)

* Add pqp

* Add patch to pqp

* Move patch of pqp into version folder

* Change glob pattern of pqp files
PucklaMotzer09 4 years ago
parent
commit
fe54ae696e
2 changed files with 56 additions and 0 deletions
  1. 28 0
      packages/p/pqp/patches/1.3/fix.patch
  2. 28 0
      packages/p/pqp/xmake.lua

+ 28 - 0
packages/p/pqp/patches/1.3/fix.patch

@@ -0,0 +1,28 @@
+diff --git a/PQP_v1.3/src/GetTime.h b/PQP_v1.3/src/GetTime.h
+index 5529a08..62521f4 100644
+--- a/PQP_v1.3/src/GetTime.h
++++ b/PQP_v1.3/src/GetTime.h
+@@ -41,7 +41,7 @@
+ #ifndef PQP_GETTIME_H
+ #define PQP_GETTIME_H
+ 
+-#ifdef WIN32
++#ifdef _WIN32
+ 
+   #include <time.h>
+   #include <sys/timeb.h>
+diff --git a/PQP_v1.3/src/PQP_Compile.h b/PQP_v1.3/src/PQP_Compile.h
+index f76c981..a5e36b1 100644
+--- a/PQP_v1.3/src/PQP_Compile.h
++++ b/PQP_v1.3/src/PQP_Compile.h
+@@ -44,10 +44,6 @@
+ // prevents compiler warnings when PQP_REAL is float
+ 
+ #include <math.h>
+-inline float sqrt(float x) { return (float)sqrt((double)x); }
+-inline float cos(float x) { return (float)cos((double)x); }
+-inline float sin(float x) { return (float)sin((double)x); }
+-inline float fabs(float x) { return (float)fabs((double)x); }
+ 
+ //-------------------------------------------------------------------------
+ //

+ 28 - 0
packages/p/pqp/xmake.lua

@@ -0,0 +1,28 @@
+package("pqp")
+
+    set_homepage("http://gamma.cs.unc.edu/SSV/")
+    set_description("A Proximity Query Package")
+
+    set_urls("http://gamma.cs.unc.edu/software/downloads/SSV/pqp-$(version).tar.gz",
+             "https://github.com/GammaUNC/PQP.git")
+
+    add_versions("1.3", "00bdcb380206393349ed7ee9a773f894bf796059c66cec0d97c0a93649eb012f")
+    add_patches("1.3", path.join(os.scriptdir(), "patches", "1.3", "fix.patch"), "9160f8bc35d23dd5a84af0891410fafa07b8fd9329389724627a68e96b4c270f")
+
+    on_install(function (package)
+        io.writefile("xmake.lua", [[
+            add_rules("mode.debug", "mode.release")
+            target("pqp")
+                set_kind("$(kind)")
+                add_files("**/src/*.cpp")
+                add_headerfiles("**/src/*.h")
+        ]])
+        local configs = {}
+        configs.kind = package:config("shared") and "shared" or "static"
+        import("package.tools.xmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cxxfuncs("PQP_Collide", {includes = "PQP.h"}))
+        assert(package:has_cxxfuncs("TriDist", {includes = "TriDist.h"}))
+    end)