From 46e59dde568bfd3bc396a9698f3e97465ea66b52 Mon Sep 17 00:00:00 2001 From: Adrien Bertrand Date: Mon, 16 Jan 2023 10:53:25 +0100 Subject: [PATCH] windows: get the build working further. part 3 (includes/config stuff) --- .gitignore | 1 + CMakeLists.txt | 2 ++ libticables/trunk/src/linux/link_usb1.cc | 2 ++ libticables/trunk/src/timeout.h | 1 + libticables/trunk/src/win64/rwp.h | 8 ++++++++ libticalcs/trunk/src/romdump.cc | 8 ++++++++ libtifiles/trunk/src/tigroup.cc | 4 ++++ win32_config/config.h | 7 +++++++ 8 files changed, 33 insertions(+) create mode 100644 win32_config/config.h diff --git a/.gitignore b/.gitignore index 1135ccd83..cc9372a8e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ Makefile.in aclocal.m4 autom4te.cache/ config.* +!win32_config/config.h configure depcomp install-sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cf3dbb72..ff73c123b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,8 @@ elseif(MINGW) add_compile_definitions(__MINGW32__) elseif(WIN32) add_compile_definitions(__WIN32__) + add_compile_definitions(HAVE_CONFIG_H) + include_directories(${CMAKE_SOURCE_DIR}/win32_config) endif() # i18n support checking diff --git a/libticables/trunk/src/linux/link_usb1.cc b/libticables/trunk/src/linux/link_usb1.cc index 56870bce3..789ec2534 100644 --- a/libticables/trunk/src/linux/link_usb1.cc +++ b/libticables/trunk/src/linux/link_usb1.cc @@ -46,7 +46,9 @@ #endif #ifdef __WIN32__ +#ifndef _WINSOCKAPI_ #include /* struct timeval */ +#endif #else #include #include diff --git a/libticables/trunk/src/timeout.h b/libticables/trunk/src/timeout.h index 155ffd62e..28e71c25d 100644 --- a/libticables/trunk/src/timeout.h +++ b/libticables/trunk/src/timeout.h @@ -49,6 +49,7 @@ typedef unsigned long tiTIME; #if defined(__WIN32__) && !defined(__MINGW32__) +# include # define TO_START(ref) { (ref) = GetTickCount(); } # define TO_CURRENT(ref) ( GetTickCount() - (ref) ) # define TO_ELAPSED(ref, max) ( TO_CURRENT(ref) > (100UL*(max)) ) diff --git a/libticables/trunk/src/win64/rwp.h b/libticables/trunk/src/win64/rwp.h index 902892e57..5e5aebdee 100644 --- a/libticables/trunk/src/win64/rwp.h +++ b/libticables/trunk/src/win64/rwp.h @@ -22,6 +22,10 @@ #ifndef __RWP_H__ #define __RWP_H__ +#ifdef __cplusplus +extern "C" { +#endif + int rwp_detect(int* result); int rwp_open(void); @@ -30,4 +34,8 @@ int rwp_close(void); int rwp_read_byte(unsigned short address, unsigned char *data); int rwp_write_byte(unsigned short address, unsigned char data); +#ifdef __cplusplus +} +#endif + #endif diff --git a/libticalcs/trunk/src/romdump.cc b/libticalcs/trunk/src/romdump.cc index 72b15e518..77365d316 100644 --- a/libticalcs/trunk/src/romdump.cc +++ b/libticalcs/trunk/src/romdump.cc @@ -24,6 +24,10 @@ This unit manages common ROM dumper. */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -34,6 +38,10 @@ #include "error.h" #include "romdump.h" +#ifdef __WIN32__ +#include +#endif + #define MAX_RETRY 3 /* CMD | LEN | DATA | CHK */ diff --git a/libtifiles/trunk/src/tigroup.cc b/libtifiles/trunk/src/tigroup.cc index 1f3f6704c..ef5e94a1a 100644 --- a/libtifiles/trunk/src/tigroup.cc +++ b/libtifiles/trunk/src/tigroup.cc @@ -45,6 +45,10 @@ #include "error.h" #include "rwfile.h" +#ifdef __WIN32__ +#include +#endif + // Whether to print detailed information about TigEntry, TigContent instances throughout their lifecycle. //#define TRACE_CONTENT_INSTANCES diff --git a/win32_config/config.h b/win32_config/config.h new file mode 100644 index 000000000..cb9489f91 --- /dev/null +++ b/win32_config/config.h @@ -0,0 +1,7 @@ +#ifndef ROOT_CONFIG_H +#define ROOT_CONFIG_H + +#define WIN32_LEAN_AND_MEAN +#include + +#endif