[esnacc-dev] [PATCH 09/11] examples: Windows support

Aaron Conole aconole at bytheb.org
Tue Dec 6 19:47:07 UTC 2016


This commit enables 'make check' support under windows.  The support is only
preliminary under the appveyor system, due to the way libtool creates
executables.  There is possibly a better way of doing this, but for now,
just the most basic support is required.

Signed-off-by: Aaron Conole <aconole at bytheb.org>
---
 appveyor.yml                   | 14 ++++++++++++--
 c-examples/simple/expbuf-ex.c  | 16 ++++++++++++----
 c-examples/simple/minbuf-ex.c  | 12 ++++++++----
 c-examples/simple/sbuf-ex.c    | 18 +++++++++++++++---
 cxx-examples/automake.mk       |  3 ++-
 cxx-examples/src/gfsi.cpp      | 12 +++++++-----
 cxx-examples/src/per_tests.cpp |  4 ++--
 7 files changed, 58 insertions(+), 21 deletions(-)

diff --git a/appveyor.yml b/appveyor.yml
index 176801a..63958b8 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -25,6 +25,16 @@ build_script:
 - C:\MinGW\msys\1.0\bin\bash -lc "cp /c/pthreads-win32/Pre-built.2/dll/x86/*.dll /c/esnacc-ng/."
 - C:\MinGW\msys\1.0\bin\bash -lc "mv /bin/link.exe /bin/link_copy.exe"
 - C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./boot.sh"
-- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./configure CC=build-aux/cccl CXX=build-aux/cccl LD=\"`which link`\" --with-pthread=C:/pthreads-win32/Pre-built.2"
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./configure CC=build-aux/cccl CXX=build-aux/cccl LD=\"`which link`\" LIBS=\"-lws2_32 -liphlpapi\" --with-pthread=C:/pthreads-win32/Pre-built.2"
 - C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && make "
-- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./compiler/.libs/esnacc.exe -c -mo `dirname asn1specs/p-rec.c` asn1specs/p-rec.asn1 && make check"
+
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./compiler/.libs/esnacc.exe -c -mo `dirname asn1specs/p-rec.c` asn1specs/p-rec.asn1"
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./compiler/.libs/esnacc.exe -C -mo `dirname cxx-examples/src/autotags.cpp` cxx-examples/src/autotags.asn1"
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./compiler/.libs/esnacc.exe -C -mo `dirname  cxx-examples/src/rfc1155-smi.cpp` cxx-examples/src/rfc1155-smi.asn1"
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./compiler/.libs/esnacc.exe -C -mo `dirname  cxx-examples/src/rfc1157-snmp.cpp` cxx-examples/src/rfc1157-snmp.asn1 -I cxx-examples/src/"
+
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && make c-examples/simple/genber.exe c-examples/simple/minbuf.exe c-examples/simple/expbuf.exe c-examples/simple/sbuf.exe c-examples/test-lib/testlib.exe cxx-examples/main.exe"
+
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./c-examples/simple/.libs/genber.exe"
+
+- C:\MinGW\msys\1.0\bin\bash -lc "cd /c/esnacc-ng && ./cxx-examples/.libs/main.exe"
diff --git a/c-examples/simple/expbuf-ex.c b/c-examples/simple/expbuf-ex.c
index 450f1a5..2c60ddc 100644
--- a/c-examples/simple/expbuf-ex.c
+++ b/c-examples/simple/expbuf-ex.c
@@ -31,16 +31,24 @@
  *
  */
 
+#include "config.h"
 #include "snacc.h"
 #include "asn-incl.h"
 
+#ifndef WIN32
 #include <sys/file.h>
-#include <sys/stat.h>
-#if HAVE_FCNTL_H 
-#include <fcntl.h>
+#include <unistd.h>
+#else
+#include <io.h>
+#include <direct.h>
+#include <time.h>
+#include <windows.h>
+#include <winbase.h>
+#define stat _stat
 #endif
+#include <fcntl.h>
+#include <sys/stat.h>
 #include <stdio.h>
-#include <unistd.h>
 
 #include "p-rec.h"
 
diff --git a/c-examples/simple/minbuf-ex.c b/c-examples/simple/minbuf-ex.c
index c592029..9b8b334 100644
--- a/c-examples/simple/minbuf-ex.c
+++ b/c-examples/simple/minbuf-ex.c
@@ -31,19 +31,23 @@
  *
  */
 
+#include "config.h"
 #include "snacc.h"
 #include "asn-incl.h"
 
 #ifndef WIN32
 #include <sys/file.h>
-#include <sys/stat.h>
-#if HAVE_FCNTL_H 
-#include <fcntl.h>
-#endif
 #include <unistd.h>
 #else
+#include <io.h>
+#include <direct.h>
+#include <time.h>
 #include <windows.h>
+#include <winbase.h>
+#define stat _stat
 #endif
+#include <fcntl.h>
+#include <sys/stat.h>
 #include <stdio.h>
 
 #include "p-rec.h"
diff --git a/c-examples/simple/sbuf-ex.c b/c-examples/simple/sbuf-ex.c
index f15d829..60cb99e 100644
--- a/c-examples/simple/sbuf-ex.c
+++ b/c-examples/simple/sbuf-ex.c
@@ -31,13 +31,25 @@
  *
  */
 
+#include "config.h"
+#include "snacc.h"
 #include "asn-incl.h"
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+#ifndef WIN32
+#include <sys/file.h>
 #include <unistd.h>
+#else
+#include <io.h>
+#include <direct.h>
+#include <time.h>
+#include <windows.h>
+#include <winbase.h>
+#define stat _stat
+#endif
+#include <fcntl.h>
+#include <sys/stat.h>
 #include <stdio.h>
+
 #include "sbuf.h"
 #include "p-rec.h"
 
diff --git a/cxx-examples/automake.mk b/cxx-examples/automake.mk
index 69dafcf..8d227ea 100644
--- a/cxx-examples/automake.mk
+++ b/cxx-examples/automake.mk
@@ -33,7 +33,8 @@ cxx_examples_main_LDADD = \
 	$(PTHREAD_LIBS)
 
 cxx_examples_main_LDFLAGS = \
-	$(PTHREAD_CFLAGS)
+	$(PTHREAD_CFLAGS) \
+	$(PTHREAD_LDFLAGS)
 
 $(top_builddir)/cxx-examples/src/rfc1155-smi.cpp: \
  $(top_srcdir)/cxx-examples/src/rfc1155-smi.asn1 \
diff --git a/cxx-examples/src/gfsi.cpp b/cxx-examples/src/gfsi.cpp
index 7d2b10b..b5cbba9 100644
--- a/cxx-examples/src/gfsi.cpp
+++ b/cxx-examples/src/gfsi.cpp
@@ -1,16 +1,18 @@
+#include "config.h"
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#if defined(WIN32) || defined(WIN16)
+#ifndef WIN32
+#include <dirent.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#else
 #include <io.h>
 #include <direct.h>
 #include <time.h>
 #include <windows.h>
 #include <winbase.h>
-#else
-#include <dirent.h>
-#include <dlfcn.h>
-#include <unistd.h>
 #endif
 #include "asnutil.h"
 
diff --git a/cxx-examples/src/per_tests.cpp b/cxx-examples/src/per_tests.cpp
index e6d773f..27a96c3 100644
--- a/cxx-examples/src/per_tests.cpp
+++ b/cxx-examples/src/per_tests.cpp
@@ -7,8 +7,8 @@
 int Perform_Per_Tests()
 {
 
-
+    return 0;
 }		// END Perform_Per_Tests()
 
 
-// EOF per_tests.cpp
\ No newline at end of file
+// EOF per_tests.cpp
-- 
2.7.4




More information about the dev mailing list