From 64ee986984eec681c5184549c1d0159851d02348 Mon Sep 17 00:00:00 2001 From: rude Date: Thu, 14 Jul 2016 16:29:45 +0200 Subject: [PATCH] =?UTF-8?q?Make=20L=C3=96VE=20buildable=20(barely)=20with?= =?UTF-8?q?=20Megasource=20on=20Mac.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 26 ++++++++++++++++++++++++++ src/common/macosx.mm | 6 +++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 620ca9f63..505ce80b3 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,8 @@ project(love) set(LOVE_EXE_NAME love) set(LOVE_LIB_NAME liblove) +set (CMAKE_CXX_STANDARD 11) + if(MSVC) set(LOVE_CONSOLE_EXE_NAME lovec) endif() @@ -46,6 +48,9 @@ option(LOVE_JIT "Use LuaJIT" TRUE) option(LOVE_MPG123 "Use mpg123" TRUE) if(LOVE_JIT) + if(APPLE) + message(FATAL_ERROR "JIT not supported yet on Mac. Please use -DLOVE_JIT=0.") + endif() message(STATUS "LuaJIT: Enabled") else() message(STATUS "LuaJIT: Disabled") @@ -69,6 +74,12 @@ if(MEGA) # are CMake targets, causing include paths to be added automatically. set(LOVE_INCLUDE_DIRS) + if(APPLE) + # Some files do #include , but building with megasource + # requires #include . + add_definitions(-DLOVE_MACOSX_SDL_DIRECT_INCLUDE) + endif () + # SDL2 links with some DirectX libraries, and we apparently also # pull those libraries in for linkage because we link with SDL2. set(LOVE_LINK_DIRS ${SDL_LINK_DIR}) @@ -207,6 +218,12 @@ set(LOVE_SRC_COMMON src/common/wrap_Data.h ) +if (APPLE) + set(LOVE_SRC_COMMON ${LOVE_SRC_COMMON} + src/common/macosx.mm + ) +endif() + source_group("common" FILES ${LOVE_SRC_COMMON}) # @@ -1194,6 +1211,12 @@ if(MSVC) src/libraries/luasocket/libluasocket/wsocket.c src/libraries/luasocket/libluasocket/wsocket.h ) +else() + set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET + ${LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET} + src/libraries/luasocket/libluasocket/usocket.c + src/libraries/luasocket/libluasocket/usocket.h + ) endif() set(LOVE_SRC_3P_LUASOCKET @@ -1401,6 +1424,9 @@ if(LOVE_MOVE_DLLS) endforeach() endif() +if (NOT MSVC) + return() +endif() ################################### # Version diff --git a/src/common/macosx.mm b/src/common/macosx.mm index b6e3cad5e..b9055faf1 100644 --- a/src/common/macosx.mm +++ b/src/common/macosx.mm @@ -25,7 +25,11 @@ #import #import -#include +#ifdef LOVE_MACOSX_SDL_DIRECT_INCLUDE +# include +#else +# include +#endif namespace love {