Index: src/Makefile =================================================================== --- src/Makefile (revision 364) +++ src/Makefile (working copy) @@ -18,6 +18,13 @@ # Use SONAME_OPT=-Wl,h, on Solaris SONAME_OPT=-Wl,-soname, +ifdef PLATFORM_WINDOWS + LIB_NAME = libespeak.dll +else + # On Windows not all source files are compiled + non_windows_SOURCES = mbrowrap.cpp +endif + # Use EXTRA_LIBS=-lm on Solaris EXTRA_LIBS = @@ -72,12 +79,12 @@ speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \ readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ - synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \ + synthdata.cpp synthesize.cpp translate.cpp $(non_windows_SOURCES) \ tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp klatt.cpp sonic.cpp libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp \ readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ - synthdata.cpp synthesize.cpp translate.cpp mbrowrap.cpp \ + synthdata.cpp synthesize.cpp translate.cpp $(non_windows_SOURCES) \ tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \ espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp klatt.cpp sonic.cpp @@ -94,8 +101,14 @@ LIBS3=-lstdc++ -L . -lespeak CXXFLAGS=-O2 +ifdef PLATFORM_WINDOWS + CXXFLAGS += -DPLATFORM_WINDOWS -DNEED_STRUCT_TIMESPEC + LDFLAGS += -static-libgcc -static-libstdc++ +endif +ifdef DEBUG + CXXFLAGS += -DDEBUG_ENABLED +endif - all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME) .cpp.o: @@ -116,9 +129,11 @@ $(LIB_NAME): $(OBJS2) $(CXX) $(LDFLAGS) -shared $(SONAME_OPT)$(LIB_NAME).$(LIB_VERSION) -o $@ \ $(OBJS2) $(LIBS2) - mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG) - $(LN_SF) $(LIB_NAME).$(LIBTAG) $(LIB_NAME).$(LIB_VERSION) - $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(LIB_NAME) + $(if $(PLATFORM_WINDOWS), , \ + mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG); \ + $(LN_SF) $(LIB_NAME).$(LIBTAG) $(LIB_NAME).$(LIB_VERSION); \ + $(LN_SF) $(LIB_NAME).$(LIB_VERSION) $(LIB_NAME); \ + ) $(STATIC_LIB_NAME): $(OBJS2) $(AR) cqs $(STATIC_LIB_NAME) $(OBJS2) Index: src/speech.h =================================================================== --- src/speech.h (revision 364) +++ src/speech.h (working copy) @@ -37,7 +37,6 @@ #endif -#define PLATFORM_POSIX #define PATHSEP '/' // USE_PORTAUDIO or USE_PULSEAUDIO are now defined in the makefile //#define USE_PORTAUDIO @@ -77,7 +76,14 @@ #ifdef PLATFORM_WINDOWS #define N_PATH_HOME 230 -#else +// sleep(seconds) +// Sleep(millisecond = 1/1000 s), windows api, kernel32.dll +// usleep(microseconds = 1/1000000 s) +#define sleep(x) Sleep(1000*x) +// we are lucky, in current code usleep is always used in multiplies of 1000 +#define usleep(x) Sleep((x+500)/1000) +#else /* PLATFORM_POSIX */ +#define PLATFORM_POSIX #define N_PATH_HOME 160 #endif Index: src/speak_lib.cpp =================================================================== --- src/speak_lib.cpp (revision 364) +++ src/speak_lib.cpp (working copy) @@ -31,7 +31,13 @@ #include "speech.h" #include -#ifndef PLATFORM_WINDOWS + +#ifdef PLATFORM_WINDOWS +#include +#include +#include +#include +#else /* PLATFORM_POSIX */ #include #endif Index: src/wave.cpp =================================================================== --- src/wave.cpp (revision 364) +++ src/wave.cpp (working copy) @@ -32,7 +32,9 @@ #include #include "portaudio.h" -#ifndef PLATFORM_WINDOWS +#ifdef PLATFORM_WINDOWS +#include +#else /* PLATFORM_POSIX */ #include #endif #include "wave.h" @@ -40,6 +42,14 @@ // +#endif #include #include #include Index: src/fifo.cpp =================================================================== --- src/fifo.cpp (revision 364) +++ src/fifo.cpp (working copy) @@ -24,7 +24,9 @@ // +#endif #include #include #include