diff --git a/configure.ac b/configure.ac index fb2e73e0..c4917d27 100644 --- a/configure.ac +++ b/configure.ac @@ -31,6 +31,19 @@ AC_TRY_LINK([], [], AC_MSG_ERROR([[C++ compiler cannot link executables]])]) AC_LANG_POP(C++) +dnl C++11 mode. Checked early so that we don't run into surprises. +LOL_TRY_CXXFLAGS(-std=c++11, + [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++11" + CXXFLAGS="${CXXFLAGS} -std=c++11"]) + +AC_LANG_PUSH(C++) +AC_MSG_CHECKING(for C++11 enum class support) +AC_TRY_LINK([], [enum class Foo : int { Bar, Baz };], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_MSG_ERROR([[C++ compiler does not support C++11 enum classes]])]) +AC_LANG_POP(C++) + AC_LIBTOOL_WIN32_DLL AM_PROG_LIBTOOL AC_LIBTOOL_CXX @@ -81,12 +94,6 @@ AC_ARG_ENABLE(doc, [ --enable-doc build documentation (needs doxygen and LaTeX)]) -dnl C++11 mode. Checked early so that we don't run into surprises. -LOL_TRY_CXXFLAGS(-std=c++11, - [AM_CXXFLAGS="${AM_CXXFLAGS} -std=c++11" - CXXFLAGS="${CXXFLAGS} -std=c++11"]) - - dnl Common C headers AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h math.h) AC_CHECK_HEADERS(fastmath.h pthread.h libutil.h util.h pty.h glob.h unistd.h io.h) diff --git a/src/base/enum.cpp b/src/base/enum.cpp index 5605e455..97bc060e 100644 --- a/src/base/enum.cpp +++ b/src/base/enum.cpp @@ -47,7 +47,11 @@ Map BuildEnumMap(char const *str) ++parser; if (*parser && *parser != ',') { +#if defined _WIN32 + current_value = _strtoi64(parser, nullptr, 0); +#else current_value = strtoll(parser, nullptr, 0); +#endif while (*parser && *parser != ' ' && *parser != ',') ++parser; diff --git a/src/base/log.cpp b/src/base/log.cpp index 959b6e39..146516c4 100644 --- a/src/base/log.cpp +++ b/src/base/log.cpp @@ -1,25 +1,25 @@ // // Lol Engine // -// Copyright: (c) 2010-2011 Sam Hocevar +// Copyright: (c) 2010-2014 Sam Hocevar // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See // http://www.wtfpl.net/ for more details. // -#if defined HAVE_CONFIG_H +#if defined(HAVE_CONFIG_H) # include "config.h" #endif #include -#ifdef WIN32 +#if defined(_WIN32) # define WIN32_LEAN_AND_MEAN # include #endif -#if defined __ANDROID__ +#if defined(__ANDROID__) # include # include /* for gettid() */ #else diff --git a/src/base/string.cpp b/src/base/string.cpp index 15b44f3f..d00a9396 100644 --- a/src/base/string.cpp +++ b/src/base/string.cpp @@ -1,20 +1,20 @@ // // Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar +// Copyright: (c) 2010-2014 Sam Hocevar // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See // http://www.wtfpl.net/ for more details. // -#if defined HAVE_CONFIG_H +#if HAVE_CONFIG_H # include "config.h" #endif #include -#ifdef WIN32 +#if defined(_WIN32) # define WIN32_LEAN_AND_MEAN # include #endif diff --git a/src/easymesh/easymeshbuild.h b/src/easymesh/easymeshbuild.h index cae1b304..0a3b7f44 100644 --- a/src/easymesh/easymeshbuild.h +++ b/src/easymesh/easymeshbuild.h @@ -2,7 +2,7 @@ // Lol Engine // // Copyright: (c) 2009-2013 Benjamin "Touky" Huet -// (c) 2010-2013 Sam Hocevar +// (c) 2010-2014 Sam Hocevar // (c) 2009-2013 Cédric Lecacheur // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To @@ -33,7 +33,7 @@ struct MeshBuildOperation ADD_VALUE_SET(PostBuildComputeNormals , (1 << 5)) ADD_VALUE_SET(PreventVertCleanup , (1 << 6)) - ADD_VALUE_SET(All , 0xffffffff) + ADD_VALUE_SET(All , 0xffff) END_E_VALUE LOL_DECLARE_ENUM_METHODS(MeshBuildOperation) diff --git a/src/gpu/shader.cpp b/src/gpu/shader.cpp index 8ee2022f..e6b5c844 100644 --- a/src/gpu/shader.cpp +++ b/src/gpu/shader.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar +// Copyright: (c) 2010-2014 Sam Hocevar // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See @@ -15,7 +15,7 @@ #include #include -#if defined WIN32 && !defined _XBOX +#if defined(_WIN32) && !defined(_XBOX) # define WIN32_LEAN_AND_MEAN # include # if defined USE_D3D9 diff --git a/src/scene.cpp b/src/scene.cpp index 87c2b4ed..96f4e202 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar +// Copyright: (c) 2010-2014 Sam Hocevar // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See @@ -14,7 +14,7 @@ #include -#if WIN32 +#if defined(_WIN32) # define WIN32_LEAN_AND_MEAN 1 # include #endif diff --git a/src/sys/file.cpp b/src/sys/file.cpp index a3e01e65..67c11780 100644 --- a/src/sys/file.cpp +++ b/src/sys/file.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar +// Copyright: (c) 2010-2014 Sam Hocevar // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See @@ -20,7 +20,7 @@ # include #endif -#if WIN32 +#if defined(_WIN32) # define WIN32_LEAN_AND_MEAN 1 # include #else @@ -367,7 +367,7 @@ class DirectoryData { #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) m_handle = INVALID_HANDLE_VALUE; #elif HAVE_STDIO_H m_dd = nullptr; @@ -379,7 +379,7 @@ class DirectoryData m_type = StreamType::File; #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) m_directory = directory; String filter = m_directory + String("*"); filter.Replace('/', '\\', true); @@ -399,7 +399,7 @@ class DirectoryData { #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) FindClose(m_handle); #elif HAVE_STDIO_H closedir(m_dd); @@ -408,7 +408,7 @@ class DirectoryData #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) m_handle = INVALID_HANDLE_VALUE; #elif HAVE_STDIO_H m_dd = nullptr; @@ -422,7 +422,7 @@ class DirectoryData #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) String filter = m_directory + String("*"); filter.Replace('/', '\\', true); WIN32_FIND_DATA find_data; @@ -458,7 +458,7 @@ class DirectoryData { #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) return (m_handle != INVALID_HANDLE_VALUE); #elif HAVE_STDIO_H return !!m_dd; @@ -469,7 +469,7 @@ class DirectoryData #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) HANDLE m_handle; String m_directory; #elif HAVE_STDIO_H @@ -592,7 +592,7 @@ String Directory::GetCurrent() String result; #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) TCHAR buff[MAX_PATH * 2]; GetCurrentDirectory(MAX_PATH, buff); result = buff; @@ -608,7 +608,7 @@ bool Directory::SetCurrent(String directory) { #if __CELLOS_LV2__ || __ANDROID__ /* FIXME: not implemented */ -#elif WIN32 +#elif defined(_WIN32) String result = directory; result.Replace('/', '\\', true); return (bool)SetCurrentDirectory(result.C()); diff --git a/src/tileset.cpp b/src/tileset.cpp index d1fc4855..4c62f5ac 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -1,7 +1,7 @@ // // Lol Engine // -// Copyright: (c) 2010-2013 Sam Hocevar +// Copyright: (c) 2010-2014 Sam Hocevar // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To // Public License, Version 2, as published by Sam Hocevar. See @@ -16,7 +16,7 @@ #include #include -#if defined WIN32 && !defined _XBOX +#if defined(_WIN32) && !defined(_XBOX) # define WIN32_LEAN_AND_MEAN # include # if defined USE_D3D9 diff --git a/test/meshviewer.cpp b/test/meshviewer.cpp index e93b97be..229d306d 100644 --- a/test/meshviewer.cpp +++ b/test/meshviewer.cpp @@ -2,7 +2,7 @@ // // Lol Engine - EasyMesh tutorial // -// Copyright: (c) 2011-2013 Sam Hocevar +// Copyright: (c) 2011-2014 Sam Hocevar // (c) 2012-2013 Benjamin "Touky" Huet // This program is free software; you can redistribute it and/or // modify it under the terms of the Do What The Fuck You Want To @@ -662,7 +662,7 @@ public: // MessageService::Send(MessageBucket::AppIn, "[sc#ff8 afcb 1 1 1 0]"); } */ -#elif WIN32 +#elif defined(_WIN32) //-- //File management //--