Build example programs to avoid breaking them on API changes
authorAlexey Sheplyakov <asheplyakov@altlinux.org>
Mon, 6 Jan 2020 18:34:09 +0000 (22:34 +0400)
committerAlexey Sheplyakov <asheplyakov@altlinux.org>
Fri, 28 Aug 2020 15:15:31 +0000 (19:15 +0400)
doc/examples/CMakeLists.txt
doc/examples/Makefile.am
doc/examples/archive1.cpp
doc/examples/compile1.cpp
doc/examples/compile2.cpp
doc/examples/compile3.cpp
doc/examples/derivative.cpp
doc/examples/mystring.cpp

index 851c61ce4a59070ccf9f345cddeb504725612455..afdc67d206fcb65dea2ee633925fb12b67bc6822 100644 (file)
@@ -1 +1,23 @@
 add_info_file(ginac-examples)
+
+add_definitions(-DIN_GINAC)
+include_directories(${CMAKE_SOURCE_DIR}/ginac ${CMAKE_BUILD_DIR}/ginac)
+
+add_executable(archive1 archive1.cpp)
+target_link_libraries(archive1 ginac ${LIBDL_LIBRARIES})
+
+add_executable(compile1 compile1.cpp)
+target_link_libraries(compile1 ginac ${LIBDL_LIBRARIES})
+
+# XXX: compile2 example uses the Cuba library (http://www.feynarts.de/cuba)
+# add_executable(compile2 compile2.cpp)
+# target_link_libraries(compile2 ginac ${LIBDL_LIBRARIES})
+
+add_executable(compile3 compile3.cpp)
+target_link_libraries(compile3 ginac ${LIBDL_LIBRARIES})
+
+add_executable(mystring mystring.cpp)
+target_link_libraries(mystring ginac ${LIBDL_LIBRARIES})
+
+add_executable(derivative derivative.cpp)
+target_link_libraries(derivative ginac ${LIBDL_LIBRARIES})
index 472a2a163eb2cdfd346148f6c092008e04c7a235..9c66c7317be988e6766baad3bd8d22243b652f0f 100644 (file)
@@ -17,3 +17,30 @@ all: $(EXFILES)
 CLEANFILES = $(TXT) $(HTML)
 
 EXTRA_DIST = $(EXFILES) CMakeLists.txt
+
+AM_CPPFLAGS = -I$(srcdir)/../../ginac -I../../ginac -DIN_GINAC
+
+noinst_PROGRAMS = archive1 \
+                 compile1 \
+                 compile3 \
+                 mystring \
+                 derivative
+
+archive1_SOURCES = archive1.cpp
+archive1_LDADD = ../../ginac/libginac.la
+
+compile1_SOURCES = compile1.cpp
+compile1_LDADD = ../../ginac/libginac.la
+
+# compile2 example uses the Cuba library: (http://www.feynarts.de)
+# compile2_SOURCES = compile2.cpp
+# compile2_LDADD = ../../ginac/libginac.la
+
+compile3_SOURCES = compile3.cpp
+compile3_LDADD = ../../ginac/libginac.la
+
+mystring_SOURCES = mystring.cpp
+mystring_LDADD = ../../ginac/libginac.la
+
+derivative_SOURCES = derivative.cpp
+derivative_LDADD = ../../ginac/libginac.la
index cf55ee5af56820e025a69ff40d57366203bc00d7..611a15dcfa4493a9e82a8a7069621f139a2ad951 100644 (file)
@@ -3,8 +3,12 @@
  */
 
 #include <fstream>
-#include <ginac/ginac.h>
 
+#ifdef IN_GINAC
+#include "ginac.h"
+#else
+#include <ginac/ginac.h>
+#endif
 using namespace std;
 using namespace GiNaC;
 
index b92dc766b3bb4501321fbbde208ff08569c31f63..69827251a13e1e1943fa784e60c0abe17a0f64b5 100644 (file)
@@ -1,7 +1,10 @@
 #include <ctime>
 #include <iostream>
+#ifdef IN_GINAC
+#include "ginac.h"
+#else
 #include <ginac/ginac.h>
-
+#endif
 using namespace std;
 using namespace GiNaC;
 
index 960bbed9091c8e658a3df297b076bf3175e6c977..0854e72234793c393064817de217a27d5ad7ec36 100644 (file)
@@ -1,5 +1,9 @@
 #include <iostream>
+#ifdef IN_GINAC
+#include "ginac.h"
+#else
 #include <ginac/ginac.h>
+#endif
 // Yes, we are using CUBA (should be installed on the system!)
 #include <cuba.h>
 
index b92df53f22c99c610afa5aed3fb72114b45e7efc..c0e5209f5f2ff6837e59eea6dbc77b5326c828ad 100644 (file)
@@ -1,7 +1,10 @@
 #include <ctime>
 #include <iostream>
+#ifdef IN_GINAC
+#include "ginac.h"
+#else
 #include <ginac/ginac.h>
-
+#endif
 using namespace std;
 using namespace GiNaC;
 
index c1a09b993daa342e3bc722466a6c4b75beadedb1..3b845c05daf42d162097abb1342beca2b838e341 100644 (file)
@@ -5,7 +5,11 @@
 #include <iostream>
 #include <string>
 #include <stdexcept>
+#ifdef IN_GINAC
+#include "ginac.h"
+#else
 #include <ginac/ginac.h>
+#endif
 using namespace std;
 using namespace GiNaC;
 
index 640f81eba84478e5a3d8a5b91d81edcf75a6b670..655fe825f93b7d5b3ffe96d8ed7252aeeb44b3c4 100644 (file)
@@ -4,9 +4,11 @@
 #include <iostream>
 #include <string>   
 #include <stdexcept>
-
+#ifdef IN_GINAC
+#include "ginac.h"
+#else
 #include <ginac/ginac.h>
-
+#endif
 using namespace std;
 using namespace GiNaC;