From cdcce657d90e186dc6f127efd1d48bc0411685aa Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 8 Dec 2012 04:04:43 +0000 Subject: [PATCH] - An aborted attempt at getting ZDBSP to compile with Clang on Windows. For the time being, it fails at linking. SVN r3987 (trunk) --- CMakeLists.txt | 4 ++++ getopt.c | 2 ++ getopt.h | 4 ---- main.cpp | 5 ++--- nodebuild.cpp | 1 - nodebuild_events.cpp | 1 - nodebuild_gl.cpp | 1 - zdbsp.h | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6f3777..00d8e1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,6 +99,10 @@ if( CMAKE_COMPILER_IS_GNUCXX ) endif( PROFILE EQUAL 1 ) endif( CMAKE_COMPILER_IS_GNUCXX ) +if( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + set( ALL_C_FLAGS "${ALL_C_FLAGS} -Wno-deprecated-declarations -Wno-format" ) +endif( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) + if( ZLIB_FOUND ) message( STATUS "Using system zlib" ) else( ZLIB_FOUND ) diff --git a/getopt.c b/getopt.c index 1d2f578..5b0707a 100644 --- a/getopt.c +++ b/getopt.c @@ -45,6 +45,8 @@ USA. */ #include #ifdef __APPLE__ #include +#else +#include #endif /* Comment out all this code if we are using the GNU C Library, and are not diff --git a/getopt.h b/getopt.h index 70aff2d..e3ba808 100644 --- a/getopt.h +++ b/getopt.h @@ -80,11 +80,7 @@ extern int optopt; struct option { -#if defined (__STDC__) && __STDC__ const char *name; -#else - char *name; -#endif /* has_arg can't be an enum because some compilers complain about type mismatches in all the code that assumes it is an int. */ int has_arg; diff --git a/main.cpp b/main.cpp index acbeb9d..406f56a 100644 --- a/main.cpp +++ b/main.cpp @@ -52,7 +52,6 @@ #include #include #include -#include #include #include "zdbsp.h" @@ -612,7 +611,7 @@ static void CheckSSE () HaveSSE1 = false; HaveSSE2 = false; -#if defined(_MSC_VER) +#if defined(_MSC_VER) && !defined(__clang__) #ifdef _M_X64 // Processors implementing AMD64 are required to support SSE2. @@ -642,7 +641,7 @@ noid: } #endif -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__clang__) // Same as above, but for GCC asm volatile diff --git a/nodebuild.cpp b/nodebuild.cpp index 8d2bce2..8347ce2 100644 --- a/nodebuild.cpp +++ b/nodebuild.cpp @@ -22,7 +22,6 @@ #include #include #include -#include #ifndef _WIN32 #include #endif diff --git a/nodebuild_events.cpp b/nodebuild_events.cpp index 250ca62..41f4c63 100644 --- a/nodebuild_events.cpp +++ b/nodebuild_events.cpp @@ -19,7 +19,6 @@ */ #include #include -#include #include "zdbsp.h" #include "nodebuild.h" diff --git a/nodebuild_gl.cpp b/nodebuild_gl.cpp index 6bd9e83..751314e 100644 --- a/nodebuild_gl.cpp +++ b/nodebuild_gl.cpp @@ -18,7 +18,6 @@ */ #include -#include #include "zdbsp.h" #include "nodebuild.h" diff --git a/zdbsp.h b/zdbsp.h index 04b20bf..46ffe6f 100644 --- a/zdbsp.h +++ b/zdbsp.h @@ -76,7 +76,7 @@ static const angle_t ANGLE_EPSILON = 5000; void Warn (const char *format, ...); -#if defined(_MSC_VER) && defined(_M_IX86) +#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_IX86) #pragma warning (disable: 4035)