Work around emscripten not finding math.h
authorkoda
Wed, 20 Apr 2016 23:49:37 -0400
changeset 11660 e15eb10f1703
parent 11659 870f22de388b
child 11661 227718170097
Work around emscripten not finding math.h
project_files/hwc/rtl/pmath.h
project_files/hwc/rtl/system.c
--- a/project_files/hwc/rtl/pmath.h	Wed Apr 20 14:46:04 2016 -0400
+++ b/project_files/hwc/rtl/pmath.h	Wed Apr 20 23:49:37 2016 -0400
@@ -21,4 +21,17 @@
 int         __attribute__((overloadable))   fpcrtl_abs(int x);
 int64_t     __attribute__((overloadable))   fpcrtl_abs(int64_t x);
 
+/* emscripten cannot find math.h through our cmake */
+#ifdef EMSCRIPTEN
+double      exp(double);
+double      log(double);
+double      sin(double);
+double      cos(double);
+double      fabs(double);
+double      ceil(double);
+double      sqrt(double);
+double      atan(double);
+double      atan2(double, double);
+#endif
+
 #endif /* PMATH_H_ */
--- a/project_files/hwc/rtl/system.c	Wed Apr 20 14:46:04 2016 -0400
+++ b/project_files/hwc/rtl/system.c	Wed Apr 20 23:49:37 2016 -0400
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <wchar.h>
+#include "pmath.h"
 
 #ifndef M_PI
 // some math.h do not have M_PI macros