[cgma-dev] r1609 - cgm/trunk/itaps

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Feb 21 11:30:20 CST 2008


Author: kraftche
Date: 2008-02-21 11:30:19 -0600 (Thu, 21 Feb 2008)
New Revision: 1609

Modified:
   cgm/trunk/itaps/Makefile.am
   cgm/trunk/itaps/testgeom.cc
Log:
look for input file in correct spot if separate build tree

Modified: cgm/trunk/itaps/Makefile.am
===================================================================
--- cgm/trunk/itaps/Makefile.am	2008-02-21 17:09:54 UTC (rev 1608)
+++ cgm/trunk/itaps/Makefile.am	2008-02-21 17:30:19 UTC (rev 1609)
@@ -65,6 +65,7 @@
 
 testgeom_SOURCES = testgeom.cc
 testgeom_LDADD = libiGeom.la  ../init/libcgma_init.la $(TEST_XLIBS)
+testgeom_CPPFLAGS = $(CPPFLAGS) -DSRCDIR=$(srcdir)
 
 
 # Automake doesn't seem to have a directory defined for

Modified: cgm/trunk/itaps/testgeom.cc
===================================================================
--- cgm/trunk/itaps/testgeom.cc	2008-02-21 17:09:54 UTC (rev 1608)
+++ cgm/trunk/itaps/testgeom.cc	2008-02-21 17:30:19 UTC (rev 1609)
@@ -23,6 +23,9 @@
 
 #define CHECK( STR ) if (err != iBase_SUCCESS) return print_error( STR, err, geom, __FILE__, __LINE__ )
 
+#define STRINGIFY(S) XSTRINGIFY(S)
+#define XSTRINGIFY(S) #S
+
 static bool print_error( const char* desc, 
                          int err,
                          iGeom_Instance geom,
@@ -111,11 +114,15 @@
 int main( int argc, char *argv[] )
 {
     // Check command line arg
-  std::string filename = "testgeom.sat";
+  std::string filename = STRINGIFY(SRCDIR) "/testgeom.sat";
   
-  if (argc == 2) 
+  if (argc == 1) {
+    std::cout << "Using default input file: " << filename << std::endl;
+  }
+  else if (argc == 2) {
     filename = argv[1];
-  else if (argc != 1) {
+  }
+  else {
     std::cerr << "Usage: " << argv[0] << " [geom_filename]" << std::endl;
     return 1;
   }




More information about the cgma-dev mailing list