From de5d4715c2293b48aa2ebbdc438cfdd2a22efafb Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 25 Jul 2008 01:37:44 +0000 Subject: [PATCH] - Added Linux support for the CMakeLists. This meant downgrading them for CMake 2.4, since the distros don't seem to consider 2.6 stable yet. As a bonus, GTK+ is no longer a required dependency; now it's optional. - Made dehsupp ignore CR characters, so it doesn't spew warnings on Linux. SVN r1092 (trunk) --- CMakeLists.txt | 4 +- Makefile.linux | 188 ---------------------------- docs/rh-log.txt | 6 + dumb/CMakeLists.txt | 3 +- gdtoa/CMakeLists.txt | 7 +- gdtoa/gdtoaimp.h | 2 +- gdtoa/misc.c | 16 +++ gdtoa/strtod.c | 2 +- jpeg-6b/CMakeLists.txt | 3 +- snes_spc/CMakeLists.txt | 10 +- src/CMakeLists.txt | 32 +++-- src/p_setup.cpp | 2 +- src/s_sound.cpp | 2 +- src/sdl/i_main.cpp | 6 + src/sdl/i_system.cpp | 24 ++-- tools/CMakeLists.txt | 2 +- tools/dehsupp/CMakeLists.txt | 13 +- tools/dehsupp/scanner.re | 5 +- tools/fixrtext/CMakeLists.txt | 4 +- tools/lemon/CMakeLists.txt | 3 +- tools/re2c/CMakeLists.txt | 6 - tools/updaterevision/CMakeLists.txt | 3 +- wadsrc/CMakeLists.txt | 8 +- zlib/CMakeLists.txt | 3 +- 24 files changed, 106 insertions(+), 248 deletions(-) delete mode 100644 Makefile.linux diff --git a/CMakeLists.txt b/CMakeLists.txt index ddbbdce0c..511c61849 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ -cmake_minimum_required( VERSION 2.6 ) +cmake_minimum_required( VERSION 2.4 ) -set( ZDOOM_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created" ) +set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created" ) set( ZDOOM_EXE_NAME "zdoom" CACHE FILEPATH "Name of the executable to create" ) find_package( JPEG ) diff --git a/Makefile.linux b/Makefile.linux deleted file mode 100644 index ec3299a30..000000000 --- a/Makefile.linux +++ /dev/null @@ -1,188 +0,0 @@ -# created on 4/12/2006 by James Bentler - -FMOD_PREFIX = /usr/local -CXX ?= g++ -CC ?= gcc -NASM ?= nasm -CCDV = @./ccdv - -# Can be libdumbd.a, if you really need to debug DUMB -DUMBLIB ?= libdumbd.a - -ifndef X64 - ifeq (x86_64,$(shell uname -m)) - X64=64 - else - X64= - endif -endif - -ifdef DEBUG - CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing -else - CFLAGS ?= -pipe -Wall -Wno-unused -fno-strict-aliasing -O2 -fomit-frame-pointer - CXXFLAGS ?= -fno-rtti -endif -#ifdef GC -# CFLAGS += -ffunction-sections -# LDFLAGS += -Wl,--gc-sections -#endif -CFLAGS += -MMD -DHAVE_FILELENGTH -D__forceinline=inline `sdl-config --cflags` `pkg-config gtk+-2.0 --cflags` -CFLAGS += -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -DNEED_STRUPR -LDFLAGS += -lz -ljpeg `sdl-config --libs` `pkg-config gtk+-2.0 --libs` $(FMOD_PREFIX)/lib/libfmodex${X64}.so -NASMFLAGS += -f elf -DM_TARGET_LINUX - -ifdef VALGRIND - NOSTRIP = 1 - NASMFLAGS += -DVALGRIND_AWARE -endif - -SRCDIRS = src/ $(addprefix src/,g_doom/ g_heretic/ g_hexen/ g_raven/ g_shared/ g_strife/ oplsynth/ sound/ sdl/ textures/ thingdef/ xlat/ timidity/) -VPATH = $(SRCDIRS) -INCLUDES = $(addprefix -I,$(SRCDIRS)) -INCLUDES += -Isnes_spc/snes_spc/ -I$(FMOD_PREFIX)/include/fmodex/ -CFLAGS += $(INCLUDES) - -RELEASEOBJ ?= releaseobj -DEBUGOBJ ?= debugobj - -CPPSRCS = $(wildcard $(addsuffix *.cpp,$(SRCDIRS))) -CSRCS = $(filter-out src/xlat/xlat_parser.c, $(wildcard $(addsuffix *.c,$(SRCDIRS)))) -ifdef X64 - NOASM=1 -endif -ifdef NOASM - CFLAGS += -DNOASM -else - ASRCS = $(wildcard src/*.nas) - CFLAGS += -DUSEASM=1 -endif -SRCS = $(CSRCS) $(CPPSRCS) $(ASRCS) -CPPOBJFILES = $(notdir $(patsubst %.cpp,%.o,$(CPPSRCS))) -COBJFILES = $(notdir $(patsubst %.c,%.o,$(CSRCS))) -AOBJFILES = $(notdir $(patsubst %.nas,%.o,$(ASRCS))) - -ZDOOM = zdoom -ZDOOMDEBUG = zdoomd - -ifdef DEBUG - OBJDIR = $(DEBUGOBJ) - CFLAGS += -D_DEBUG -g3 - NASMFLAGS += -g - ZDOOMBIN = $(ZDOOMDEBUG) -else - OBJDIR = $(RELEASEOBJ) - CFLAGS += -DNDEBUG - LDFLAGS += -Wl,-Map=$(ZDOOM).map - ifndef NOSTRIP - LDFLAGS += -s - else - CFLAGS += -g - endif - ZDOOMBIN = $(ZDOOM) -endif -CXXFLAGS += $(CFLAGS) - -COBJS = $(addprefix $(OBJDIR)/,$(CPPOBJFILES) $(COBJFILES)) -DEPS = $(patsubst %.o,%.d,$(COBJS)) -OBJS = $(addprefix $(OBJDIR)/,$(AOBJFILES)) $(COBJS) - -all: $(ZDOOMBIN) toolsandpk3 zdoom.pk3 - -$(ZDOOMBIN): ccdv updaterev src/xlat/xlat_parser.h src/xlat/xlat_parser.c $(OBJDIR) $(OBJS) snes_spc/libsnes_spc.a dumb/lib/$(DUMBLIB) - $(CCDV) $(CXX) $(LDFLAGS) $(OBJDIR)/autostart.o \ - $(filter-out %/autostart.o %/autozend.o,$(OBJS)) \ - snes_spc/libsnes_spc.a dumb/lib/$(DUMBLIB) $(OBJDIR)/autozend.o -o $(ZDOOMBIN) - -$(OBJDIR)/%.o: %.cpp - $(CCDV) $(CXX) $(CXXFLAGS) -o $@ -c $< - -$(OBJDIR)/%.o: %.c - $(CCDV) $(CC) $(CFLAGS) -o $@ -c $< - -$(OBJDIR)/%.o: %.nas - $(CCDV) $(NASM) -o $@ $(NASMFLAGS) $< - -# This file needs special handling so that it actually gets compiled with SSE2 support. -$(OBJDIR)/nodebuild_classify_sse2.o: nodebuild_classify_sse2.cpp - $(CCDV) $(CXX) $(CXXFLAGS) -msse2 -mfpmath=sse -c -o $@ $< - -# This file needs special handling because GCC misoptimizes it otherwise. -$(OBJDIR)/fmopl.o: src/oplsynth/fmopl.cpp - $(CCDV) $(CXX) $(CXXFLAGS) -fno-tree-dominator-opts -fno-tree-fre -c -o $@ $< - -src/xlat/xlat_parser.h src/xlat/xlat_parser.c: tools/lemon/lemon src/xlat/xlat_parser.y - $(CCDV) tools/lemon/lemon -s src/xlat/xlat_parser.y - -$(OBJDIR): - mkdir $(OBJDIR) - -toolsandpk3: ccdv tools/makewad/makewad tools/dehsupp/dehsupp tools/lemon/lemon - $(MAKE) -C wadsrc/ - -zdoom.pk3: toolsandpk3 - ln -sf wadsrc/zdoom.pk3 ./ - -snes_spc/libsnes_spc.a: ccdv - $(MAKE) -C snes_spc/ - -dumb/lib/libdumb.a: ccdv - $(MAKE) -C dumb/ - -dumb/lib/libdumbd.a: ccdv - $(MAKE) CONFIG=Debug -C dumb/ - -tools/makewad/makewad: ccdv - $(MAKE) -C tools/makewad/ - -tools/dehsupp/dehsupp: ccdv - $(MAKE) -C tools/dehsupp/ - -tools/lemon/lemon: ccdv - $(MAKE) -C tools/lemon/ - -updaterev: tools/updaterevision/updaterevision - @tools/updaterevision/updaterevision . src/svnrevision.h - -tools/updaterevision/updaterevision: ccdv - $(MAKE) -C tools/updaterevision - -.PHONY : clean cleandeps cleanobjs distclean toolsandpk3 cleantools updaterev - -clean: cleanobjs - rm -f $(ZDOOMDEBUG) $(ZDOOM) $(ZDOOM).map - rm -f ccdv - @$(MAKE) -C snes_spc clean - -cleantools: - @$(MAKE) -C wadsrc clean - @$(MAKE) -C tools/makewad clean - @$(MAKE) -C tools/dehsupp clean - @$(MAKE) -C tools/updaterevision clean - @$(MAKE) -C tools/lemon clean - -cleandebug: - rm -f $(ZDOOMDEBUG) $(DEBUGOBJ)/*.o $(DEBUGOBJ)/*.d - -rmdir $(DEBUGOBJ) - -cleanrelease: - rm -f $(ZDOOM) $(ZDOOM).map $(RELEASEOBJ)/*.o $(RELEASEOBJ)/*.o - -rmdir $(RELEASEOBJ) - -# I could use a recursive delete instead, but that could be dangerous... -distclean: clean cleandeps - -rmdir $(RELEASEOBJ) $(DEBUGOBJ) - rm -f zdoom.pk3 - -cleandeps: - rm -f $(RELEASEOBJ)/*.d $(DEBUGOBJ)/*.d - -cleanobjs: - rm -f $(RELEASEOBJ)/*.o $(DEBUGOBJ)/*.o - -ccdv: ccdv-posix.c - @gcc -Os -s ccdv-posix.c -o ccdv - -ifeq (,$(findstring $(MAKECMDGOALS),clean cleandeps cleanobjs distclean toolsandpk3 cleantools updaterev)) --include $(DEPS) -endif diff --git a/docs/rh-log.txt b/docs/rh-log.txt index d7c687450..75184e679 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,9 @@ +July 24, 2008 +- Added Linux support for the CMakeLists. This meant downgrading them for + CMake 2.4, since the distros don't seem to consider 2.6 stable yet. + As a bonus, GTK+ is no longer a required dependency; now it's optional. +- Made dehsupp ignore CR characters, so it doesn't spew warnings on Linux. + July 23, 2008 (Changes by Graf Zahl) - Fixed: The sounds of Strife's intro need CHAN_UI. - Changed all instances of playing the chat sounds to use CHAN_UI. diff --git a/dumb/CMakeLists.txt b/dumb/CMakeLists.txt index 32e4c8c7d..12099accb 100644 --- a/dumb/CMakeLists.txt +++ b/dumb/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) -project( dumb ) +cmake_minimum_required( VERSION 2.4 ) # DUMB is much slower in a Debug build than a Release build, so we force a Release # build here, since we're not maintaining DUMB, only using it. diff --git a/gdtoa/CMakeLists.txt b/gdtoa/CMakeLists.txt index 4b3c5a6ef..39f199714 100644 --- a/gdtoa/CMakeLists.txt +++ b/gdtoa/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) -project( gdtoa ) +cmake_minimum_required( VERSION 2.4 ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" ) @@ -15,12 +14,12 @@ add_definitions( -DINFNAN_CHECK -DMULTIPLE_THREADS ) if( NOT MSVC ) add_executable( arithchk arithchk.c ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/arith.h - COMMAND arithchk >${CMAKE_CURRENT_BINARY_DIR}/arith.h + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/arithchk >${CMAKE_CURRENT_BINARY_DIR}/arith.h DEPENDS arithchk ) add_executable( qnan qnan.c arith.h ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h - COMMAND qnan >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/qnan >${CMAKE_CURRENT_BINARY_DIR}/gd_qnan.h DEPENDS qnan ) set( GEN_FP_FILES arith.h gd_qnan.h ) diff --git a/gdtoa/gdtoaimp.h b/gdtoa/gdtoaimp.h index 49dda8557..ac4b59e57 100644 --- a/gdtoa/gdtoaimp.h +++ b/gdtoa/gdtoaimp.h @@ -284,7 +284,7 @@ extern "C" { #endif #if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1 -Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. +#error Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined. #endif typedef union { double d; ULong L[2]; } U; diff --git a/gdtoa/misc.c b/gdtoa/misc.c index 070e69bdc..7c7815c36 100644 --- a/gdtoa/misc.c +++ b/gdtoa/misc.c @@ -896,5 +896,21 @@ void FREE_DTOA_LOCK(int n) LeaveCriticalSection(&dtoa_lock[n]); } +#else + +#include + +static pthread_mutex_t dtoa_lock[2] = { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER }; + +void ACQUIRE_DTOA_LOCK(int n) +{ + pthread_mutex_lock(&dtoa_lock[n]); +} + +void FREE_DTOA_LOCK(int n) +{ + pthread_mutex_unlock(&dtoa_lock[n]); +} + #endif #endif diff --git a/gdtoa/strtod.c b/gdtoa/strtod.c index d6025dada..ae253739f 100644 --- a/gdtoa/strtod.c +++ b/gdtoa/strtod.c @@ -85,7 +85,7 @@ strtod int rounding; #endif - _control87(_PC_53, _MCW_PC); + //_control87(_PC_53, _MCW_PC); sign = nz0 = nz = decpt = 0; dval(rv) = 0.; for(s = s00;;s++) switch(*s) { diff --git a/jpeg-6b/CMakeLists.txt b/jpeg-6b/CMakeLists.txt index 26bc11f7f..665e99d4a 100644 --- a/jpeg-6b/CMakeLists.txt +++ b/jpeg-6b/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) -project( jpeg ) +cmake_minimum_required( VERSION 2.4 ) if( CMAKE_COMPILER_IS_GNUC ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fomit-frame-pointer" ) diff --git a/snes_spc/CMakeLists.txt b/snes_spc/CMakeLists.txt index 89183540a..57d8d2a1e 100644 --- a/snes_spc/CMakeLists.txt +++ b/snes_spc/CMakeLists.txt @@ -1,11 +1,15 @@ -cmake_minimum_required( VERSION 2.6 ) -project( snes_spc ) +cmake_minimum_required( VERSION 2.4 ) +include( CheckCXXCompilerFlag ) # I don't plan on debugging this, so make it a release build. set( CMAKE_BUILD_TYPE "RelWithDebInfo" ) if( CMAKE_COMPILER_IS_GNUCXX ) - set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fomit-frame-pointer" ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fomit-frame-pointer -Wno-array-bounds" ) + check_cxx_compiler_flag( -Wno-array-bounds HAVE_NO_ARRAY_BOUNDS ) + if( HAVE_NO_ARRAY_BOUNDS ) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds" ) + endif( HAVE_NO_ARRAY_BOUNDS ) endif( CMAKE_COMPILER_IS_GNUCXX ) add_library( snes_spc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62c13410f..d5abd7c7d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,6 @@ -cmake_minimum_required( VERSION 2.6 ) +cmake_minimum_required( VERSION 2.4 ) include( CheckFunctionExists ) +include( FindPkgConfig ) option( NO_ASM "Disable assembly code" ) if( CMAKE_COMPILER_IS_GNUCXX ) @@ -85,6 +86,7 @@ else( WIN32 ) /usr/include /opt/local/include /opt/include ) + set( FMOD_INC_PATH_SUFFIXES PATH_SUFFIXES fmodex ) set( NASM_NAMES nasm ) # Non-Windows version also needs SDL @@ -97,13 +99,13 @@ else( WIN32 ) # Use GTK+ for the IWAD picker, if available. if( NOT NO_GTK ) - find_package( GTK ) - if( GTK_FOUND ) - set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK_LIBRARIES ) - include_directories( "${GTK_LIBRARIES}" ) - else( GTK_FOUND ) + pkg_check_modules( GTK2 gtk+-2.0 ) + if( GTK2_FOUND ) + set( ZDOOM_LIBS ${ZDOOM_LIBS} ${GTK2_LIBRARIES} ) + include_directories( ${GTK2_INCLUDE_DIRS} ) + else( GTK2_FOUND ) set( NO_GTK ON ) - endif( GTK_FOUND ) + endif( GTK2_FOUND ) endif( NOT NO_GTK ) if( NO_GTK ) @@ -255,7 +257,7 @@ endif( NOT MSVC ) # Update svnrevision.h add_custom_command( OUTPUT ${CMAKE_SOURCE_DIR}/src/svnrevision.h - COMMAND updaterevision . src/svnrevision.h + COMMAND ${CMAKE_BINARY_DIR}/tools/updaterevision/updaterevision . src/svnrevision.h WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} DEPENDS updaterevision ) @@ -300,6 +302,7 @@ else( WIN32 ) set( SYSTEM_SOURCES sdl/crashcatcher.c sdl/hardware.cpp + sdl/i_cd.cpp sdl/i_input.cpp sdl/i_main.cpp sdl/i_movie.cpp @@ -323,12 +326,12 @@ endif( NOT NO_ASM ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.h COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/xlat/xlat_parser.y . - COMMAND lemon xlat_parser.y + COMMAND ${CMAKE_BINARY_DIR}/tools/lemon/lemon xlat_parser.y WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS lemon ${CMAKE_CURRENT_SOURCE_DIR}/xlat/xlat_parser.y ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h - COMMAND re2c --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re + COMMAND ${CMAKE_BINARY_DIR}/tools/re2c/re2c --no-generation-date -s -o ${CMAKE_CURRENT_BINARY_DIR}/sc_man_scanner.h ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re DEPENDS re2c ${CMAKE_CURRENT_SOURCE_DIR}/sc_man_scanner.re ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) @@ -680,9 +683,18 @@ include_directories( . add_dependencies( zdoom revision_check ) +# RUNTIME_OUTPUT_DIRECTORY does not exist in CMake 2.4. +# Linux distributions are slow to adopt 2.6. :( set_target_properties( zdoom PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ZDOOM_OUTPUT_DIR} ) set_target_properties( zdoom PROPERTIES OUTPUT_NAME ${ZDOOM_EXE_NAME} ) +if( NOT WIN32 ) + FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/link-make "if [ ! -e ${ZDOOM_OUTPUT_DIR}/${ZDOOM_EXE_NAME} ]; then ln -sf ${CMAKE_CURRENT_BINARY_DIR}/${ZDOOM_EXE_NAME} ${ZDOOM_OUTPUT_DIR}/${ZDOOM_EXE_NAME}; fi" ) + add_custom_command( TARGET zdoom POST_BUILD + COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make + COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make ) +endif( NOT WIN32 ) + if( CMAKE_COMPILER_IS_GNUCXX ) # GCC misoptimizes this file set_source_files_properties( oplsynth/fmopl.cpp PROPERTIES COMPILE_FLAGS "-fno-tree-dominator-opts -fno-tree-fre" ) diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 3b9e38867..c3588566c 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -2068,7 +2068,7 @@ void P_ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec, mapside // upper "texture" is light color // lower "texture" is fog color { - DWORD color, fog; + DWORD color = MAKERGB(255,255,255), fog = 0; bool colorgood, foggood; SetTextureNoErr (sd, side_t::bottom, &fog, msd->bottomtexture, &foggood); diff --git a/src/s_sound.cpp b/src/s_sound.cpp index d47f27747..8cbad20aa 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -947,7 +947,7 @@ static FSoundChan *S_StartSound(AActor *actor, const sector_t *sec, const FPolyO } // If this actor is already playing something on the selected channel, stop it. - if (type != SOURCE_None && (actor == NULL && channel != CHAN_AUTO) || (actor != NULL && actor->SoundChans & (1 << channel))) + if (type != SOURCE_None && ((actor == NULL && channel != CHAN_AUTO) || (actor != NULL && actor->SoundChans & (1 << channel)))) { for (chan = Channels; chan != NULL; chan = chan->NextChan) { diff --git a/src/sdl/i_main.cpp b/src/sdl/i_main.cpp index bbbcfd35d..af4b5403e 100644 --- a/src/sdl/i_main.cpp +++ b/src/sdl/i_main.cpp @@ -40,7 +40,9 @@ #include #include #include +#ifndef NO_GTK #include +#endif #include #include "doomerrors.h" @@ -72,7 +74,9 @@ extern "C" int cc_install_handlers(int, int*, const char*, int(*)(char*, char*)) // PUBLIC DATA DEFINITIONS ------------------------------------------------- +#ifndef NO_GTK bool GtkAvailable; +#endif // The command line arguments. DArgs *Args; @@ -207,7 +211,9 @@ int main (int argc, char **argv) seteuid (getuid ()); std::set_new_handler (NewFailure); +#ifndef NO_GTK GtkAvailable = gtk_init_check (&argc, &argv); +#endif setlocale (LC_ALL, "C"); diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index c70c56eca..859379c48 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -29,9 +29,11 @@ #include #include -#include +#include +#ifndef NO_GTK #include -#include +#include +#endif #include "doomerrors.h" #include @@ -71,8 +73,10 @@ extern "C" double CyclesPerSecond = 1e8; CPUInfo CPU; } - -extern bool GtkAvailable; + +#ifndef NO_GTK +extern bool GtkAvailable; +#endif void CalculateCPUSpeed (); @@ -342,6 +346,7 @@ void I_PrintStr (const char *cp) fflush (stdout); } +#ifndef NO_GTK // GtkTreeViews eats return keys. I want this to be like a Windows listbox // where pressing Return can still activate the default button. gint AllowDefault(GtkWidget *widget, GdkEventKey *event, gpointer func_data) @@ -381,7 +386,7 @@ void ClickedOK(GtkButton *button, gpointer func_data) } EXTERN_CVAR (Bool, queryiwad); - + int I_PickIWad_Gtk (WadStuff *wads, int numwads, bool showwin, int defaultiwad) { GtkWidget *window; @@ -513,7 +518,8 @@ int I_PickIWad_Gtk (WadStuff *wads, int numwads, bool showwin, int defaultiwad) } return i; -} +} +#endif int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad) { @@ -523,11 +529,13 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad) { return defaultiwad; } - + +#ifndef NO_GTK if (GtkAvailable) { return I_PickIWad_Gtk (wads, numwads, showwin, defaultiwad); - } + } +#endif printf ("Please select a game wad (or 0 to exit):\n"); for (i = 0; i < numwads; ++i) diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 7b99c506e..fb03664d3 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) +cmake_minimum_required( VERSION 2.4 ) add_subdirectory( lemon ) add_subdirectory( re2c ) diff --git a/tools/dehsupp/CMakeLists.txt b/tools/dehsupp/CMakeLists.txt index 138acafe6..5f903ab2c 100644 --- a/tools/dehsupp/CMakeLists.txt +++ b/tools/dehsupp/CMakeLists.txt @@ -1,19 +1,24 @@ -cmake_minimum_required( VERSION 2.6 ) -project( dehsupp ) +cmake_minimum_required( VERSION 2.4 ) +include( CheckFunctionExists ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/parse.h ${CMAKE_CURRENT_BINARY_DIR}/parse.c COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/parse.y ${CMAKE_CURRENT_BINARY_DIR} - COMMAND lemon parse.y + COMMAND ${CMAKE_BINARY_DIR}/tools/lemon/lemon parse.y WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS lemon parse.y ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/scanner.c - COMMAND re2c -s -o ${CMAKE_CURRENT_BINARY_DIR}/scanner.c ${CMAKE_CURRENT_SOURCE_DIR}/scanner.re + COMMAND ${CMAKE_BINARY_DIR}/tools/re2c/re2c -s -o ${CMAKE_CURRENT_BINARY_DIR}/scanner.c ${CMAKE_CURRENT_SOURCE_DIR}/scanner.re DEPENDS re2c scanner.re ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) +CHECK_FUNCTION_EXISTS( stricmp STRICMP_EXISTS ) +if( NOT STRICMP_EXISTS ) + add_definitions( -Dstricmp=strcasecmp ) +endif( NOT STRICMP_EXISTS ) + add_executable( dehsupp dehsupp.c parse.c scanner.c ) add_dependencies( dehsupp ${CMAKE_CURRENT_BINARY_DIR}/parse.c ${CMAKE_CURRENT_BINARY_DIR}/scanner.c ) diff --git a/tools/dehsupp/scanner.re b/tools/dehsupp/scanner.re index 828e2ee58..e025897a8 100644 --- a/tools/dehsupp/scanner.re +++ b/tools/dehsupp/scanner.re @@ -122,7 +122,10 @@ ESC = [\\] ([abfnrtv?'"\\] | "x" H+ | O+); any { - printf("unexpected character: %c\n", *s->tok); + if (*s->tok != '\r') + { + printf("unexpected character: %c (%#02x)\n", *s->tok, *s->tok); + } goto std; } */ diff --git a/tools/fixrtext/CMakeLists.txt b/tools/fixrtext/CMakeLists.txt index c88e04a24..9af8eb7f4 100644 --- a/tools/fixrtext/CMakeLists.txt +++ b/tools/fixrtext/CMakeLists.txt @@ -1,4 +1,2 @@ -cmake_minimum_required( VERSION 2.6 ) -project( fixrtext ) - +cmake_minimum_required( VERSION 2.4 ) add_executable( fixrtext fixrtext.c ) diff --git a/tools/lemon/CMakeLists.txt b/tools/lemon/CMakeLists.txt index 213d78e86..0a6b2319c 100644 --- a/tools/lemon/CMakeLists.txt +++ b/tools/lemon/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) -project( lemon ) +cmake_minimum_required( VERSION 2.4 ) set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG" ) diff --git a/tools/re2c/CMakeLists.txt b/tools/re2c/CMakeLists.txt index 109f66887..e6068a28d 100644 --- a/tools/re2c/CMakeLists.txt +++ b/tools/re2c/CMakeLists.txt @@ -1,5 +1,4 @@ cmake_minimum_required( VERSION 2.4 ) -include( CheckIncludeFiles ) include( CheckFunctionExists ) include( CheckTypeSize ) @@ -9,11 +8,6 @@ set( PACKAGE_VERSION 0.12.3 ) set( PACKAGE_STRING "re2c 0.12.3" ) set( PACKAGE_BUGREPORT "re2c-general@lists.sourceforge.net" ) -set( PACKAGE ${PACKAGE_NAME} ) -set( VERSION ${PACKAGE_VERSION} ) - -CHECK_INCLUDE_FILES( unistd.h HAVE_UNISTD_H ) - CHECK_FUNCTION_EXISTS( strdup HAVE_STRDUP ) CHECK_FUNCTION_EXISTS( strndup HAVE_STRNDUP ) diff --git a/tools/updaterevision/CMakeLists.txt b/tools/updaterevision/CMakeLists.txt index 627b4045e..aeacf01f3 100644 --- a/tools/updaterevision/CMakeLists.txt +++ b/tools/updaterevision/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) -project( updaterevision ) +cmake_minimum_required( VERSION 2.4 ) if( WIN32 ) if( CMAKE_COMPILER_IS_GNUC OR CMAKE_COMPILER_IS_GNUCXX ) diff --git a/wadsrc/CMakeLists.txt b/wadsrc/CMakeLists.txt index fa6b376a2..d3766e8b5 100644 --- a/wadsrc/CMakeLists.txt +++ b/wadsrc/CMakeLists.txt @@ -1,12 +1,12 @@ -cmake_minimum_required( VERSION 2.6 ) +cmake_minimum_required( VERSION 2.4 ) -add_custom_command( OUTPUT generated/dehsupp.lmp +add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/generated/dehsupp.lmp COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated - COMMAND dehsupp ${CMAKE_CURRENT_SOURCE_DIR}/sources/dehsupp.txt ${CMAKE_CURRENT_BINARY_DIR}/generated/dehsupp.lmp + COMMAND ${CMAKE_BINARY_DIR}/tools/dehsupp/dehsupp ${CMAKE_CURRENT_SOURCE_DIR}/sources/dehsupp.txt ${CMAKE_CURRENT_BINARY_DIR}/generated/dehsupp.lmp DEPENDS dehsupp ${CMAKE_CURRENT_SOURCE_DIR}/sources/dehsupp.txt ) add_custom_command( OUTPUT ${ZDOOM_OUTPUT_DIR}/zdoom.pk3 - COMMAND zipdir ${ZDOOM_OUTPUT_DIR}/zdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static ${CMAKE_CURRENT_BINARY_DIR}/generated + COMMAND ${CMAKE_BINARY_DIR}/tools/zipdir/zipdir ${ZDOOM_OUTPUT_DIR}/zdoom.pk3 ${CMAKE_CURRENT_SOURCE_DIR}/static ${CMAKE_CURRENT_BINARY_DIR}/generated DEPENDS zipdir ${CMAKE_CURRENT_BINARY_DIR}/generated/dehsupp.lmp ) add_custom_target( pk3 ALL diff --git a/zlib/CMakeLists.txt b/zlib/CMakeLists.txt index f8073d843..4a614c7f2 100644 --- a/zlib/CMakeLists.txt +++ b/zlib/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required( VERSION 2.6 ) -project( z ) +cmake_minimum_required( VERSION 2.4 ) if( CMAKE_COMPILER_IS_GNUC ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fomit-frame-pointer" )