Browse Source

core: fix minor Windows and Raspberry compilation issues.

undefined
Sam Hocevar 10 years ago
parent
commit
44dec8612e
10 changed files with 45 additions and 34 deletions
  1. +13
    -6
      configure.ac
  2. +4
    -0
      src/base/enum.cpp
  3. +4
    -4
      src/base/log.cpp
  4. +3
    -3
      src/base/string.cpp
  5. +2
    -2
      src/easymesh/easymeshbuild.h
  6. +2
    -2
      src/gpu/shader.cpp
  7. +2
    -2
      src/scene.cpp
  8. +11
    -11
      src/sys/file.cpp
  9. +2
    -2
      src/tileset.cpp
  10. +2
    -2
      test/meshviewer.cpp

+ 13
- 6
configure.ac View File

@@ -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)


+ 4
- 0
src/base/enum.cpp View File

@@ -47,7 +47,11 @@ Map<int64_t, String> 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;


+ 4
- 4
src/base/log.cpp View File

@@ -1,25 +1,25 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// 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 <cstdio>

#ifdef WIN32
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif

#if defined __ANDROID__
#if defined(__ANDROID__)
# include <android/log.h>
# include <unistd.h> /* for gettid() */
#else


+ 3
- 3
src/base/string.cpp View File

@@ -1,20 +1,20 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// 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 <cstdio>

#ifdef WIN32
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif


+ 2
- 2
src/easymesh/easymeshbuild.h View File

@@ -2,7 +2,7 @@
// Lol Engine
//
// Copyright: (c) 2009-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// (c) 2009-2013 Cédric Lecacheur <jordx@free.fr>
// 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)


+ 2
- 2
src/gpu/shader.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// 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 <cstring>
#include <cstdio>

#if defined WIN32 && !defined _XBOX
#if defined(_WIN32) && !defined(_XBOX)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# if defined USE_D3D9


+ 2
- 2
src/scene.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// 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 <cstdlib>

#if WIN32
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN 1
# include <windows.h>
#endif


+ 11
- 11
src/sys/file.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// 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 <android/asset_manager_jni.h>
#endif

#if WIN32
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN 1
# include <windows.h>
#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());


+ 2
- 2
src/tileset.cpp View File

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2010-2014 Sam Hocevar <sam@hocevar.net>
// 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 <cstdio>
#include <cstring>

#if defined WIN32 && !defined _XBOX
#if defined(_WIN32) && !defined(_XBOX)
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# if defined USE_D3D9


+ 2
- 2
test/meshviewer.cpp View File

@@ -2,7 +2,7 @@
//
// Lol Engine - EasyMesh tutorial
//
// Copyright: (c) 2011-2013 Sam Hocevar <sam@hocevar.net>
// Copyright: (c) 2011-2014 Sam Hocevar <sam@hocevar.net>
// (c) 2012-2013 Benjamin "Touky" Huet <huet.benjamin@gmail.com>
// 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
//--


Loading…
Cancel
Save