math/clad: Add test target

This commit is contained in:
Yuri Victorovich 2023-07-18 06:55:24 -07:00
parent 01a9f36630
commit f3a0c9a0ce
3 changed files with 45 additions and 2 deletions

View file

@ -10,14 +10,25 @@ WWW= https://github.com/vgvassilev/clad
LICENSE= LGPL3
LICENSE_FILE= ${WRKSRC}/License.txt
USES= cmake compiler:c++14-lang llvm:15,build,run
USES= cmake:testing compiler:c++14-lang llvm:15,build,run
USE_LDCONFIG= yes
USE_GITHUB= yes
GH_ACCOUNT= vgvassilev
CMAKE_ARGS= -DClang_DIR=${LLVM_PREFIX}/lib/cmake/clang \
-DLLVM_DIR=${LLVM_PREFIX}/lib/cmake/llvm
-DLLVM_DIR=${LLVM_PREFIX}/lib/cmake/llvm \
-DLLVM_EXTERNAL_LIT=${LLVM_PREFIX}/bin/llvm-lit
CMAKE_ON= BUILD_SHARED_LIBS
CMAKE_TESTING_ON= FREEBSD_BUILD_TESTS FREEBSD_BUILD_DEMOS
CMAKE_TESTING_TARGET= check-clad
post-patch:
@${REINPLACE_CMD} \
-e ' \
s|import lit|&${LLVM_VERSION}|; \
s|lit\.|lit${LLVM_VERSION}.| \
' \
${WRKSRC}/test/lit.cfg
.include <bsd.port.mk>

View file

@ -0,0 +1,16 @@
- workaround for errors like:
- ld: error: undefined reference due to --no-allow-shlib-undefined: __progname
- >>> referenced by /lib/libc.so.7
--- demos/ErrorEstimation/CustomModel/CustomModel.cpp.orig 2023-07-19 16:59:14 UTC
+++ demos/ErrorEstimation/CustomModel/CustomModel.cpp
@@ -2,6 +2,9 @@
#include "CustomModel.h"
+char **environ = nullptr;
+const char *__progname = "x";
+
// Here we use the BuildOp function provided by clad to build a multiplication
// expression that clad can generate code for.
clang::Expr* CustomModel::AssignError(clad::StmtDiff refExpr,

View file

@ -0,0 +1,16 @@
- workaround for errors like:
- ld: error: undefined reference due to --no-allow-shlib-undefined: __progname
- >>> referenced by /lib/libc.so.7
--- demos/ErrorEstimation/PrintModel/PrintModel.cpp.orig 2023-07-18 14:54:11 UTC
+++ demos/ErrorEstimation/PrintModel/PrintModel.cpp
@@ -4,6 +4,9 @@
#include "PrintModel.h"
#include "clad/Differentiator/CladUtils.h"
+char **environ = nullptr;
+const char *__progname = "x";
+
// Here we use the BuildOp function provided by clad to build a multiplication
// expression that clad can generate code for.
clang::Expr* PrintModel::AssignError(clad::StmtDiff refExpr,