Skip to content

Commit

Permalink
sync v3 build changes into metal-support (#344)
Browse files Browse the repository at this point in the history
* [lua] use luajit (#335)

* [win32] compile libwebsockets in release mode (#334)

* revert windows lib (#336)

* [luajit] upgrade to 2.1.0-beta3 & fix cmakelists.txt deps (#337)

* [vs2017] recompiler box2d and chipmunk to support vs2017 (#338)

* Remove CC_TARGET_PLATFORM marco (#340)

* already support 64 bits offset by define _FILE_OFFSET_BITS=64 (#341)

* fix file api macro (#343)

* remove USE_FILE32API macro

* add defination

* update

* Update version.json
  • Loading branch information
drelaptop authored Jan 16, 2019
1 parent a8b163e commit 2874da3
Show file tree
Hide file tree
Showing 25 changed files with 48 additions and 59 deletions.
Binary file modified Box2D/prebuilt/win32/debug/libbox2d.lib
Binary file not shown.
Binary file modified Box2D/prebuilt/win32/release/libbox2d.lib
Binary file not shown.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@ if(BUILD_JS_LIBS)
)
endif()
if(BUILD_LUA_LIBS)
add_subdirectory(lua/lua)
add_subdirectory(lua/luajit)
add_subdirectory(lua/tolua)
add_subdirectory(lua/luasocket)
set_property(TARGET external APPEND PROPERTY
CC_LUA_DEPEND ext_lua ext_luajit ext_tolua ext_luasocket
CC_LUA_DEPEND ext_luajit ext_tolua ext_luasocket
)
endif()

Expand Down
Binary file removed chipmunk/prebuilt/win10/arm/chipmunk.lib
Binary file not shown.
Binary file removed chipmunk/prebuilt/win10/win32/chipmunk.lib
Binary file not shown.
Binary file removed chipmunk/prebuilt/win10/x64/chipmunk.lib
Binary file not shown.
Binary file modified chipmunk/prebuilt/win32/debug-lib/libchipmunk.lib
Binary file not shown.
Binary file modified chipmunk/prebuilt/win32/release-lib/libchipmunk.lib
Binary file not shown.
34 changes: 14 additions & 20 deletions lua/luajit/include/lauxlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include "lua.h"


#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_setn(L,i,j) ((void)0) /* no op! */

/* extra error code for `luaL_load' */
#define LUA_ERRFILE (LUA_ERRERR+1)

Expand Down Expand Up @@ -58,6 +55,10 @@ LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
const char *const lst[]);

/* pre-defined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)

LUALIB_API int (luaL_ref) (lua_State *L, int t);
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);

Expand All @@ -84,6 +85,11 @@ LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
const char *name, const char *mode);
LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
int level);
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
int sizehint);
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname);


/*
Expand Down Expand Up @@ -113,6 +119,11 @@ LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,

#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))

/* From Lua 5.2. */
#define luaL_newlibtable(L, l) \
lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
#define luaL_newlib(L, l) (luaL_newlibtable(L, l), luaL_setfuncs(L, l, 0))

/*
** {======================================================
** Generic Buffer manipulation
Expand Down Expand Up @@ -147,21 +158,4 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);

/* }====================================================== */


/* compatibility with ref system */

/* pre-defined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)

#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))

#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))

#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))


#define luaL_reg luaL_Reg

#endif
10 changes: 9 additions & 1 deletion lua/luajit/include/lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))


/* thread status; 0 is OK */
/* thread status */
#define LUA_OK 0
#define LUA_YIELD 1
#define LUA_ERRRUN 2
#define LUA_ERRSYNTAX 3
Expand Down Expand Up @@ -347,6 +348,13 @@ LUA_API void *lua_upvalueid (lua_State *L, int idx, int n);
LUA_API void lua_upvaluejoin (lua_State *L, int idx1, int n1, int idx2, int n2);
LUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt,
const char *chunkname, const char *mode);
LUA_API const lua_Number *lua_version (lua_State *L);
LUA_API void lua_copy (lua_State *L, int fromidx, int toidx);
LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum);
LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum);

/* From Lua 5.3. */
LUA_API int lua_isyieldable (lua_State *L);


struct lua_Debug {
Expand Down
10 changes: 3 additions & 7 deletions lua/luajit/include/luaconf.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
** Configuration header.
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
*/

#ifndef luaconf_h
Expand Down Expand Up @@ -37,7 +37,7 @@
#endif
#define LUA_LROOT "/usr/local"
#define LUA_LUADIR "/lua/5.1/"
#define LUA_LJDIR "/luajit-2.1.0-beta2/"
#define LUA_LJDIR "/luajit-2.1.0-beta3/"

#ifdef LUA_ROOT
#define LUA_JROOT LUA_ROOT
Expand Down Expand Up @@ -79,7 +79,7 @@
#define LUA_IGMARK "-"
#define LUA_PATH_CONFIG \
LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
LUA_EXECDIR "\n" LUA_IGMARK
LUA_EXECDIR "\n" LUA_IGMARK "\n"

/* Quoting in error messages. */
#define LUA_QL(x) "'" x "'"
Expand All @@ -92,10 +92,6 @@
#define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */
#define LUA_MAXCAPTURES 32 /* Max. pattern captures. */

/* Compatibility with older library function names. */
#define LUA_COMPAT_MOD /* OLD: math.mod, NEW: math.fmod */
#define LUA_COMPAT_GFIND /* OLD: string.gfind, NEW: string.gmatch */

/* Configuration for the frontend (the luajit executable). */
#if defined(luajit_c)
#define LUA_PROGNAME "luajit" /* Fallback frontend name. */
Expand Down
8 changes: 4 additions & 4 deletions lua/luajit/include/luajit.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
**
** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -30,10 +30,10 @@

#include "lua.h"

#define LUAJIT_VERSION "LuaJIT 2.1.0-beta2"
#define LUAJIT_VERSION "LuaJIT 2.1.0-beta3"
#define LUAJIT_VERSION_NUM 20100 /* Version 2.1.0 = 02.01.00. */
#define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta2
#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2016 Mike Pall"
#define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta3
#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2017 Mike Pall"
#define LUAJIT_URL "http://luajit.org/"

/* Modes for luaJIT_setmode. */
Expand Down
2 changes: 1 addition & 1 deletion lua/luajit/include/lualib.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
** Standard library header.
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
*/

#ifndef _LUALIB_H
Expand Down
Binary file modified lua/luajit/prebuilt/android/arm64-v8a/libluajit.a
Binary file not shown.
Binary file modified lua/luajit/prebuilt/android/armeabi-v7a/libluajit.a
Binary file not shown.
Binary file modified lua/luajit/prebuilt/android/x86/libluajit.a
Binary file not shown.
2 changes: 1 addition & 1 deletion lua/luasocket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ endif()

target_include_directories(${target_name}
INTERFACE ..
PRIVATE ../lua
PRIVATE ../luajit/include
)

set_target_properties(${target_name}
Expand Down
2 changes: 1 addition & 1 deletion lua/tolua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ add_library(${target_name} STATIC
${${target_name}_src}
)

target_include_directories(${target_name} PRIVATE ../lua)
target_include_directories(${target_name} PRIVATE ../luajit/include)
target_include_directories(${target_name} PUBLIC .)

set_target_properties(${target_name}
Expand Down
8 changes: 4 additions & 4 deletions tinyxml2/tinyxml2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ distribution.
#include "tinyxml2.h"

#include <new> // yes, this one new style header, is in the Android SDK.
# if defined(ANDROID_NDK) || (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY)
# if defined(ANDROID_NDK)
# include <stddef.h>
#else
# include <cstddef>
Expand Down Expand Up @@ -1587,7 +1587,7 @@ XMLError XMLDocument::LoadFile( const char* filename )
InitDocument();
FILE* fp = 0;

#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
errno_t err = fopen_s(&fp, filename, "rb" );
if ( !fp || err) {
#else
Expand Down Expand Up @@ -1641,7 +1641,7 @@ XMLError XMLDocument::LoadFile( FILE* fp )
XMLError XMLDocument::SaveFile( const char* filename, bool compact )
{
FILE* fp = 0;
#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
errno_t err = fopen_s(&fp, filename, "w" );
if ( !fp || err) {
#else
Expand Down Expand Up @@ -1768,7 +1768,7 @@ void XMLPrinter::Print( const char* format, ... )
else {
// This seems brutally complex. Haven't figured out a better
// way on windows.
#if defined _MSC_VER && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE)
#if defined _MSC_VER
int len = -1;
int expand = 1000;
while ( len < 0 ) {
Expand Down
4 changes: 2 additions & 2 deletions tinyxml2/tinyxml2.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ distribution.
#endif


#if defined(ANDROID_NDK) || defined(__BORLANDC__) || (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY)
#if defined(ANDROID_NDK) || defined(__BORLANDC__)
# include <ctype.h>
# include <limits.h>
# include <stdio.h>
Expand Down Expand Up @@ -89,7 +89,7 @@ distribution.
#endif


#if (defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (CC_TARGET_PLATFORM != CC_PLATFORM_MARMALADE))
#if (defined(_MSC_VER) && (_MSC_VER >= 1400 ))
// Microsoft visual studio, version 2005 and higher.
/*int _snprintf_s(
char *buffer,
Expand Down
18 changes: 3 additions & 15 deletions unzip/ioapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename,

if ((filename!=NULL) && (mode_fopen != NULL))
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE || CC_TARGET_PLATFORM == CC_PLATFORM_BADA || CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY || CC_TARGET_PLATFORM == CC_PLATFORM_NACL || CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN)
file = NULL;
#else
file = fopen64((const char*)filename, mode_fopen);
#endif
file = fopen((const char*)filename, mode_fopen);
}

return file;
Expand Down Expand Up @@ -147,11 +143,7 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream)
{
ZPOS64_T ret;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE || CC_TARGET_PLATFORM == CC_PLATFORM_BADA || CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY || CC_TARGET_PLATFORM == CC_PLATFORM_NACL || CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN)
ret = 0;
#else
ret = ftello64((FILE *)stream);
#endif
ret = ftell((FILE *)stream);
return ret;
}

Expand Down Expand Up @@ -180,9 +172,6 @@ static long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offs

static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T offset, int origin)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE || CC_TARGET_PLATFORM == CC_PLATFORM_BADA || CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY || CC_TARGET_PLATFORM == CC_PLATFORM_NACL || CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN)
return -1;
#else
int fseek_origin=0;
switch (origin)
{
Expand All @@ -197,10 +186,9 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T
break;
default: return -1;
}
if(fseeko64((FILE *)stream, offset, fseek_origin) != 0)
if(fseek((FILE *)stream, offset, fseek_origin) != 0)
return -1;
return 0;
#endif
}


Expand Down
4 changes: 4 additions & 0 deletions unzip/ioapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ namespace cocos2d {
#define fopen64 fopen
#define ftello64 ftell
#define fseeko64 fseek
#define ftello ftell
#define fseeko fseek
#else
#ifdef _MSC_VER
#define fopen64 fopen
#if (_MSC_VER >= 1400) && (!(defined(NO_MSCVER_FILE64_FUNC)))
#define ftello64 _ftelli64
#define fseeko64 _fseeki64
#define ftello _ftelli64
#define fseeko _fseeki64
#else // old MSC
#define ftello64 ftell
#define fseeko64 fseek
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"prebuilt_libs_version":"v3-deps-145",
"prebuilt_libs_version":"metal-support-3",
"freetype":"2.5.5",
"curl":"7.52.1",
"jpeg":"9.0",
Expand Down
Binary file modified websockets/prebuilt/win10/win32/websockets.dll
Binary file not shown.
Binary file modified websockets/prebuilt/win32/websockets.dll
Binary file not shown.

0 comments on commit 2874da3

Please sign in to comment.