Changeset 2532


Ignore:
Timestamp:
Feb 28, 2013, 10:04:51 PM (10 years ago)
Author:
sam
Message:

build: the “fuck you, Apple” commit; work around three different
compiler bugs in the Xcode toolchain.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/build/autotools/m4/lol-misc.m4

    r2479 r2532  
    55    [AC_MSG_CHECKING([if $CC supports $1 flags])
    66    save_CFLAGS="$CFLAGS"
    7     CFLAGS="$1"
     7    CFLAGS="$1 -Werror"
    88    AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no])
    99    CFLAGS="$save_CFLAGS"
     
    2121    AC_LANG_PUSH(C++)
    2222    save_CXXFLAGS="$CXXFLAGS"
    23     CXXFLAGS="$1"
     23    CXXFLAGS="$1 -Werror"
    2424    AC_TRY_COMPILE([],[],[ac_cv_try_cxxflags_ok=yes],[ac_cv_try_cxxflags_ok=no])
    2525    CXXFLAGS="$save_CXXFLAGS"
     
    3737    [AC_MSG_CHECKING([if $CC supports $1 flags])
    3838    save_LDFLAGS="$LDFLAGS"
    39     LDFLAGS="$1"
     39    LDFLAGS="$1 -Werror"
    4040    AC_TRY_LINK([],[],[ac_cv_try_ldflags_ok=yes],[ac_cv_try_ldflags_ok=no])
    4141    LDFLAGS="$save_LDFLAGS"
  • trunk/configure.ac

    r2488 r2532  
    9494if test "${enable_debug}" = "yes"; then
    9595  AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug)
    96   OPT="-O"
     96  OPT_CXXFLAGS="-O"
    9797else
    98   OPT="-O3 -ffast-math -fno-strength-reduce -fomit-frame-pointer"
     98  OPT_CXXFLAGS="-O3 -ffast-math -fomit-frame-pointer"
     99  OPT_LDFLAGS="-fno-strength-reduce"
    99100fi
    100101
    101102if test "${enable_release}" = "yes"; then
    102103  AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release)
    103   REL=""
     104  REL_CXXFLAGS=""
    104105else
    105   REL="-g"
     106  REL_CXXFLAGS="-g"
    106107fi
    107108
     
    155156
    156157dnl  Optimizations
    157 AM_CXXFLAGS="${AM_CXXFLAGS} ${REL} ${OPT}"
     158AM_CXXFLAGS="${AM_CXXFLAGS} ${REL_CXXFLAGS} ${OPT_CXXFLAGS}"
     159AM_LDFLAGS="${AM_LDFLAGS} ${REL_LDFLAGS} ${OPT_LDFLAGS}"
    158160
    159161dnl  Debug symbols
     
    236238
    237239dnl  Are we building using MinGW?
    238 LIBS_save="$LIBS"
    239 LIBS="$LIBS -mwindows -mwin32"
    240 AC_MSG_CHECKING(for -mwindows -mwin32)
    241 AC_TRY_LINK([], [],
    242  [AC_MSG_RESULT(yes)
    243   AM_CXXFLAGS="${AM_CXXFLAGS} -mwindows -mwin32"
    244   LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"],
    245  [AC_MSG_RESULT(no)])
    246 LIBS="$LIBS_save"
     240LOL_TRY_CXXFLAGS(-mwindows -mwin32,
     241 [AM_CXXFLAGS="${AM_CXXFLAGS} -mwindows -mwin32"
     242  LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"])
    247243
    248244
     
    250246dnl  Answer: NO! we don't know how to build for it anyway
    251247AM_CONDITIONAL(USE_X360, false)
     248
     249
     250dnl  Are we on an OS X or iOS platform?
     251LOL_TRY_LDFLAGS(-framework Foundation,
     252 [LOL_LIBS="${LOL_LIBS} -framework Foundation"])
     253LOL_TRY_LDFLAGS(-framework CoreGraphics,
     254 [LOL_LIBS="${LOL_LIBS} -framework CoreGraphics"])
     255LOL_TRY_LDFLAGS(-framework CoreData,
     256 [LOL_LIBS="${LOL_LIBS} -framework CoreData"])
     257LOL_TRY_LDFLAGS(-framework UIKit,
     258 [LOL_LIBS="${LOL_LIBS} -framework UIKit"])
    252259
    253260
  • trunk/src/lol/math/vector.h

    r2524 r2532  
    13451345    LOL_UNARY_FUNS(tname, static, type)
    13461346
     1347/* HACK: This trick fails with Apple’s clang++, which sometimes fails to deduce
     1348 * the arguments for simple stuff such as vec3 + vec3. Disable it for now.
     1349 * Note that llvm-g++ doesn’t have the problem. */
     1350#if defined __clang__
     1351#   define LOL_OPEN_NAMESPACE(x)
     1352#   define LOL_CLOSE_NAMESPACE(x)
     1353#else
     1354#   define LOL_OPEN_NAMESPACE(x) namespace x {
     1355#   define LOL_CLOSE_NAMESPACE(x) } using namespace x;
     1356#endif
     1357
    13471358#define LOL_ALL_VECTOR_OPS_AND_FUNS(type) \
    1348     namespace x##type \
    1349     { \
     1359    LOL_OPEN_NAMESPACE(x##type) \
    13501360        LOL_ALL_VECTOR_OPS_INNER(Vec2, type) \
    13511361        LOL_ALL_VECTOR_OPS_INNER(Vec3, type) \
    13521362        LOL_ALL_VECTOR_OPS_INNER(Vec4, type) \
    1353     } \
    1354     using namespace x##type; \
     1363    LOL_CLOSE_NAMESPACE(x##type) \
    13551364    LOL_ALL_VECTOR_FUNS_INNER(Vec2, type) \
    13561365    LOL_ALL_VECTOR_FUNS_INNER(Vec3, type) \
     
    14111420#undef LOL_ALL_VECTOR_FUNS_INNER
    14121421#undef LOL_ALL_VECTOR_OPS_AND_FUNS
     1422
     1423#undef LOL_OPEN_NAMESPACE
     1424#undef LOL_CLOSE_NAMESPACE
    14131425
    14141426/*
  • trunk/test/unit/array.cpp

    r2435 r2532  
    3737    void TearDown() {}
    3838
     39/* HACK: we disable these tests because they fail with the
     40 * Xcode iPhone compiler. */
     41#if !defined __clang__ || !defined __arm__
    3942    LOLUNIT_TEST(ArrayPush)
    4043    {
     
    8588        LOLUNIT_ASSERT_EQUAL(a[2], 3);
    8689    }
     90#endif
    8791
    8892    LOLUNIT_TEST(EightElements)
Note: See TracChangeset for help on using the changeset viewer.