-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Building Lua (static) as external project
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8) | ||
PROJECT(ArrayFire-Lua-Wrapper) | ||
|
||
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") | ||
|
||
INCLUDE(${CMAKE_MODULE_PATH}/build_lua.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
INCLUDE(ExternalProject) | ||
|
||
SET(prefix ${CMAKE_BINARY_DIR}/third_party/lua) | ||
|
||
SET(lua_location "${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}lua${CMAKE_STATIC_LIBRARY_SUFFIX}") | ||
IF(CMAKE_VERSION VERSION_LESS 3.2) | ||
IF(CMAKE_GENERATOR MATCHES "Ninja") | ||
MESSAGE(WARNING "Building forge with Ninja has known issues with CMake older than 3.2") | ||
endif() | ||
SET(byproducts) | ||
ELSE() | ||
SET(byproducts BYPRODUCTS ${lua_location}) | ||
ENDIF() | ||
|
||
# FIXME Tag forge correctly during release | ||
ExternalProject_Add( | ||
lua-ext | ||
GIT_REPOSITORY https://github.com/LuaDist/lua.git | ||
GIT_TAG 5.3.2 | ||
PATCH_COMMAND patch -p1 -t -N < ${CMAKE_MODULE_PATH}/lua_MSVC.patch | ||
PREFIX "${prefix}" | ||
INSTALL_DIR "${prefix}" | ||
UPDATE_COMMAND "" | ||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -Wno-dev "-G${CMAKE_GENERATOR}" <SOURCE_DIR> | ||
-DCMAKE_SOURCE_DIR:PATH=<SOURCE_DIR> | ||
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER} | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> | ||
-DBUILD_SHARED_LIBS=OFF | ||
-DLUA_BUILD_AS_DLL=OFF | ||
${byproducts} | ||
) | ||
|
||
ExternalProject_Get_Property(lua-ext install_dir) | ||
ADD_LIBRARY(lua IMPORTED STATIC) | ||
SET_TARGET_PROPERTIES(lua PROPERTIES IMPORTED_LOCATION ${lua_location}) | ||
ADD_DEPENDENCIES(lua lua-ext) | ||
SET(LUA_INCLUDE_DIRECTORIES ${install_dir}/include) | ||
SET(LUA_LIBRARIES lua) | ||
SET(LUA_FOUND ON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
commit 4b61e31e44bac6b09bb70d3dbcd1b470b754bb71 | ||
Author: Shehzan Mohammed <[email protected]> | ||
Date: Wed Dec 23 15:01:27 2015 -0500 | ||
|
||
Lua MSVC snprintf patch | ||
|
||
diff --git a/src/lprefix.h b/src/lprefix.h | ||
index 02daa83..b56f8f6 100644 | ||
--- a/src/lprefix.h | ||
+++ b/src/lprefix.h | ||
@@ -39,6 +39,10 @@ | ||
#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ | ||
#endif | ||
|
||
+#if _MSC_VER < 1900 | ||
+#define snprintf sprintf_s | ||
+#endif | ||
+ | ||
#endif /* } */ | ||
|
||
#endif |