2017-12-24 09:34:34 +08:00
# # # # sol2
# The MIT License (MIT)
#
# Copyright (c) 2013-2017 Rapptz, ThePhD, and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2018-01-20 04:03:22 +08:00
# protect from multiple inclusion
if ( lua_jit_build_included )
2018-01-24 01:07:22 +08:00
return ( )
2018-01-20 04:03:22 +08:00
endif ( lua_jit_build_included )
set ( lua_jit_build_included true )
2018-01-24 01:07:22 +08:00
# import necessary standard modules
include ( ExternalProject )
2017-12-24 09:34:34 +08:00
# Latest iterations for specific sub-versions of LuaJIT
set ( LUA_JIT_2.0_LATEST_VERSION 2.0.5 )
2018-01-20 04:03:22 +08:00
set ( LUA_JIT_ ${ LUA_JIT_2.0_LATEST_VERSION } _COMMIT c88602f080dcafea6ba222a2f7cc1ea0e41ef3cc )
2017-12-24 09:34:34 +08:00
set ( LUA_JIT_2.1_LATEST_VERSION 2.1.0-beta3 )
2018-01-20 04:03:22 +08:00
set ( LUA_JIT_ ${ LUA_JIT_2.1_LATEST_VERSION } _COMMIT 80aaaeee99d7f7b06c9e75ed3a457c49d86fc4db )
2017-12-24 09:34:34 +08:00
# MD5 hashes taken off of LuaJIT's website
# must be updated whenever a new version appears
2018-01-20 04:03:22 +08:00
set ( LUA_JIT_MD5_2.1.0-beta3.tar.gz eae40bc29d06ee5e3078f9444fcea39b )
set ( LUA_JIT_MD5_2.1.0-beta3.zip 58d0480e1af0811e7ecee45498d62e2d )
set ( LUA_JIT_MD5_2.1.0-beta2.tar.gz fa14598d0d775a7ffefb138a606e0d7b )
set ( LUA_JIT_MD5_2.1.0-beta2.zip b5d943c0174ca217736e2ddc2d9721c3 )
set ( LUA_JIT_MD5_2.1.0-beta1.tar.gz 5a5bf71666e77cf6e7a1ae851127b834 )
set ( LUA_JIT_MD5_2.1.0-beta1.zip 4b5c2c9aef0e7c0b622b09e7c84d566b )
set ( LUA_JIT_MD5_2.0.5.tar.gz 48353202cbcacab84ee41a5a70ea0a2c )
set ( LUA_JIT_MD5_2.0.5.zip f7cf52a049d74aee4e624bdc1160b80d )
set ( LUA_JIT_MD5_2.0.4.tar.gz dd9c38307f2223a504cbfb96e477eca0 )
set ( LUA_JIT_MD5_2.0.4.zip ed1f0caf3d390171f423f6f1b5c57aac )
set ( LUA_JIT_MD5_2.0.3.tar.gz f14e9104be513913810cd59c8c658dc0 )
set ( LUA_JIT_MD5_2.0.3.zip 6c0f6958d5e1f67734fb1ff514ec4c84 )
set ( LUA_JIT_MD5_2.0.2.tar.gz 112dfb82548b03377fbefbba2e0e3a5b )
set ( LUA_JIT_MD5_2.0.2.zip a57c7d1b8eaf46559303dcfd56404045 )
set ( LUA_JIT_MD5_2.0.1.tar.gz 85e406e8829602988eb1233a82e29f1f )
set ( LUA_JIT_MD5_2.0.1.zip cf4aee0e40b220054ee3cffbe0cd6ed5 )
set ( LUA_JIT_MD5_2.0.0.tar.gz 97a2b87cc0490784f54b64cfb3b8f5ad )
set ( LUA_JIT_MD5_2.0.0.zip 467f4f531f7e08ee252f5030ecada7ed )
set ( LUA_JIT_MD5_2.0.0-beta11.tar.gz 824aa2684a11e3cc3abe87350a7b6139 )
set ( LUA_JIT_MD5_2.0.0-beta11.zip 8629401437048e477c94bd791b0a823a )
set ( LUA_JIT_MD5_2.0.0-beta10.tar.gz ed66689b96f7ad7bfeffe0b4ff2d63d4 )
set ( LUA_JIT_MD5_2.0.0-beta10.zip f6bbd472726b761b29438c4a06b5ab3c )
set ( LUA_JIT_MD5_2.0.0-beta9.tar.gz e7e03e67e2550817358bc28b44270c6d )
set ( LUA_JIT_MD5_2.0.0-beta9.zip 3f9ca0309f26e789c6c3246c83696f84 )
set ( LUA_JIT_MD5_2.0.0-beta8.tar.gz f0748a73ae268d49b1d01f56c4fe3e61 )
set ( LUA_JIT_MD5_2.0.0-beta8.zip fb096a90c9e799c8922f32095ef3d93c )
set ( LUA_JIT_MD5_2.0.0-beta7.tar.gz b845dec15dd9eba2fd17d865601a52e5 )
set ( LUA_JIT_MD5_2.0.0-beta7.zip e10fc2b19de52d8770cdf24f1791dd77 )
set ( LUA_JIT_MD5_2.0.0-beta6.tar.gz bfcbe2a11162cfa84d5a1693b442c8bf )
set ( LUA_JIT_MD5_2.0.0-beta6.zip f64945c5ecaf3ea71a829fdbb5cb196c )
set ( LUA_JIT_MD5_2.0.0-beta5.tar.gz 7e0dfa03a140148149a1021d4ffd5c57 )
set ( LUA_JIT_MD5_2.0.0-beta5.zip be8087fcb576c30ffbb6368ebc284498 )
set ( LUA_JIT_MD5_2.0.0-beta4.tar.gz 5c5a9305b3e06765e1dae138e1a95c3a )
set ( LUA_JIT_MD5_2.0.0-beta4.zip d0b241be6207fa7d97b6afc41368e05f )
set ( LUA_JIT_MD5_2.0.0-beta3.tar.gz 313b6f164e93e1bbac7bf87abb58d4a1 )
set ( LUA_JIT_MD5_2.0.0-beta3.zip bea9c7bcd5084f98830e31956f276ff6 )
set ( LUA_JIT_MD5_2.0.0-beta2.tar.gz 2ebcc38fa1d9756dc2e341f191701120 )
set ( LUA_JIT_MD5_2.0.0-beta2.zip 94086f99f647d46a8360adeb11851d66 )
set ( LUA_JIT_MD5_2.0.0-beta1.tar.gz 9ed7646d03580a1cec4abeb74ca44843 )
set ( LUA_JIT_MD5_2.0.0-beta1.zip 19d5bac616fa739343c7158d9d99a3f3 )
set ( LUA_JIT_MD5_1.1.8.tar.gz ad0e319483fa235e3979537a748631e9 )
set ( LUA_JIT_MD5_1.1.8.zip 92870c80f504c34c9b7547cd6c5562d0 )
set ( LUA_JIT_MD5_1.1.7.tar.gz 3aed0795f7c8725d3613269cd56f8e5a )
set ( LUA_JIT_MD5_1.1.7.zip 40a8dbc214306bb4b9849fcf026c4ee0 )
set ( LUA_JIT_MD5_1.1.6.tar.gz 1a1320e09d0cd5b793014556fb7d64c9 )
set ( LUA_JIT_MD5_1.1.6.zip 350d7b9230637056fbd6158b95e8fa11 )
set ( LUA_JIT_MD5_1.1.5.tar.gz b99d244ba4fc1979946ae1025368fc5c )
set ( LUA_JIT_MD5_1.1.5.zip d3ffbae3bfcd5914b02dc00b1118a59d )
set ( LUA_JIT_MD5_1.1.4.tar.gz 9fe29cfb8126bc9c4302701c06965f1c )
set ( LUA_JIT_MD5_1.1.4.zip 30d318e3287000ecf4c93b29e8783183 )
set ( LUA_JIT_MD5_1.1.3.tar.gz f5db1a147ed3d34677ad1ef310c56da7 )
set ( LUA_JIT_MD5_1.1.3.zip 5949e7bce9d97c37c282e1cbe85aa378 )
set ( LUA_JIT_MD5_1.1.2.tar.gz 4ae25ce7e3f301d1fcf0b713016edab0 )
set ( LUA_JIT_MD5_1.1.0.tar.gz 16d880a98a1ff6608ac1039c802233db )
set ( LUA_JIT_MD5_1.0.3.tar.gz d0a63d5394cca549889bd820a05b32d2 )
2017-12-24 09:34:34 +08:00
# Clean up some variables
string ( TOLOWER ${ LUA_VERSION } LUA_JIT_NORMALIZED_LUA_VERSION )
if ( LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "([0-9]+\\.[0-9]+\\.[0-9]+(-[A-Za-z0-9_-]+)?)" )
# 3-digit with optional beta1/beta2/beta3 (or whatever): probably okay?
set ( LUA_JIT_VERSION ${ CMAKE_MATCH_1 } )
elseif ( LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "([0-9]+\\.[0-9]+)" )
# extend version number with prefix
if ( ${ CMAKE_MATCH_1 } EQUAL 2 )
if ( ${ CMAKE_MATCH_2 } EQUAL 0 )
set ( LUA_JIT_VERSION ${ LUA_JIT_2.0_LATEST_VERSION } )
elseif ( ${ CMAKE_MATCH_2 } EQUAL 1 )
set ( LUA_JIT_VERSION ${ LUA_JIT_2.1_LATEST_VERSION } )
endif ( )
endif ( )
if ( NOT LUA_JIT_VERSION )
# Just pick a default version and roll with it
set ( LUA_JIT_VERSION ${ CMAKE_MATCH_1 } . ${ CMAKE_MATCH_2 } .0 )
endif ( )
2018-01-20 04:03:22 +08:00
elseif ( LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "latest" )
set ( LUA_JIT_VERSION ${ LUA_JIT_2.1_LATEST_VERSION } )
2017-12-24 09:34:34 +08:00
else ( )
2018-01-20 04:03:22 +08:00
MESSAGE ( FATAL "Cannot deduce LuaJIT version from ${LUA_VERSION}" )
2017-12-24 09:34:34 +08:00
endif ( )
2018-01-24 01:07:22 +08:00
FIND_PACKAGE_MESSAGE ( LUABUILD
" S e l e c t i n g L u a J I T $ { L U A _ J I T _ V E R S I O N } f r o m ' $ { L U A _ V E R S I O N } ' a n d b u i l d i n g a $ { L U A _ B U I L D _ L I B R A R Y _ T Y P E } l i b r a r y . . . "
" [ $ { L U A _ J I T _ V E R S I O N } ] [ $ { L U A _ V E R S I O N } ] [ $ { L U A _ B U I L D _ L I B R A R Y _ T Y P E } ] " )
2017-12-24 09:34:34 +08:00
# Get hashes for the build
# LuaJIT unfortunately does not give us SHA1 hashes as well
# set(LUA_JIT_SHA1 ${LUA_JIT_SHA1_${LUA_JIT_VERSION}})
2018-01-20 04:03:22 +08:00
if ( WIN32 )
set ( LUA_JIT_MD5 ${ LUA_JIT_MD5_${LUA_JIT_VERSION } .zip} )
set ( LUA_JIT_DOWNLOAD_URI http://luajit.org/download/LuaJIT- ${ LUA_JIT_VERSION } .zip )
else ( )
set ( LUA_JIT_MD5 ${ LUA_JIT_MD5_${LUA_JIT_VERSION } .tar.gz} )
set ( LUA_JIT_DOWNLOAD_URI http://luajit.org/download/LuaJIT- ${ LUA_JIT_VERSION } .tar.gz )
endif ( )
2017-12-24 09:34:34 +08:00
if ( LUA_JIT_MD5 )
set ( LUA_JIT_DOWNLOAD_MD5_COMMAND URL_MD5 ${ LUA_JIT_MD5 } )
else ( )
set ( LUA_JIT_DOWNLOAD_MD5_COMMAND "" )
endif ( )
if ( LUA_JIT_SHA1 )
set ( LUA_JIT_DOWNLOAD_SHA1_COMMAND URL_HASH SHA1= ${ LUA_JIT_SHA1 } )
else ( )
set ( LUA_JIT_DOWNLOAD_SHA1_COMMAND "" )
endif ( )
2018-01-20 04:03:22 +08:00
set ( LUA_JIT_SOURCE_DIR "${LUA_BUILD_TOPLEVEL}/src" )
set ( LUA_JIT_INSTALL_DIR "${LUA_BUILD_TOPLEVEL}/install" )
file ( MAKE_DIRECTORY ${ LUA_JIT_SOURCE_DIR } )
file ( MAKE_DIRECTORY ${ LUA_JIT_INSTALL_DIR } )
set ( LUA_JIT_LIB_FILENAME "${CMAKE_STATIC_LIBRARY_PREFIX}${LUA_BUILD_LIBNAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" )
set ( LUA_JIT_IMP_LIB_FILENAME "${CMAKE_IMPORT_LIBRARY_PREFIX}${LUA_BUILD_LIBNAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}" )
set ( LUA_JIT_LIB_EXP_FILENAME "${LUA_BUILD_LIBNAME}.exp" )
set ( LUA_JIT_DLL_FILENAME "${CMAKE_SHARED_LIBRARY_PREFIX}${LUA_BUILD_LIBNAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" )
set ( LUA_JIT_EXE_FILENAME "${LUA_BUILD_LIBNAME}${CMAKE_EXECUTABLE_SUFFIX}" )
set ( LUA_JIT_LIB_FILE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_LIB_FILENAME}" )
set ( LUA_JIT_IMP_LIB_FILE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_IMP_LIB_FILENAME}" )
set ( LUA_JIT_LIB_EXP_FILE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_LIB_EXP_FILENAME}" )
set ( LUA_JIT_DLL_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${LUA_JIT_DLL_FILENAME}" )
2018-01-24 01:07:22 +08:00
set ( LUA_JIT_EXE_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${LUA_JIT_EXE_FILENAME}" )
2018-01-20 04:03:22 +08:00
2017-12-24 09:34:34 +08:00
# # # Do the build
if ( MSVC )
# Visual C++ is predicated off running msvcbuild.bat
# which requires a Visual Studio Command Prompt
2018-01-20 04:03:22 +08:00
if ( BUILD_LUA_AS_DLL )
set ( LUA_JIT_BUILD_COMMAND cd src && msvcbuild.bat )
else ( )
set ( LUA_JIT_BUILD_COMMAND cd src && msvcbuild.bat static )
endif ( )
set ( LUA_JIT_PREBUILT_LIB "lua51.lib" )
set ( LUA_JIT_PREBUILT_IMP_LIB "lua51.lib" )
set ( LUA_JIT_PREBUILT_DLL "lua51.dll" )
set ( LUA_JIT_PREBUILT_EXP "lua51.exp" )
2017-12-24 09:34:34 +08:00
else ( )
2018-01-20 04:03:22 +08:00
# get the make command we need for this system
find_program ( MAKE_PROGRAM NAMES make mingw32-make mingw64-make )
if ( MAKE_PROGRAM MATCHES "MAKE_PROGRAM-NOTFOUND" )
MESSAGE ( FATAL_ERROR "Cannot find 'make' program or similar needed to build LuaJIT ${LUA_VERSION} (perhaps place it in the PATH environment variable if it is not already?)" )
endif ( )
2017-12-24 09:34:34 +08:00
# we can simply reuse the makefile here
# so define it as an external project and then just have the proper
# build/install/test commands
2018-02-09 12:19:45 +08:00
# make sure to apply -pagezero_size 10000 -image_base 100000000 (done later for XCode Targets)
2018-01-20 04:03:22 +08:00
set ( LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_T=${LUA_JIT_EXE_FILENAME}" )
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_A=${LUA_JIT_LIB_FILENAME}" )
2018-02-11 13:53:53 +08:00
set ( LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "" )
set ( LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS "" )
set ( LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "" )
2017-12-24 09:34:34 +08:00
if ( BUILD_LUA_AS_DLL )
2018-01-20 04:03:22 +08:00
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LUAJIT_SO=${LUA_JIT_DLL_FILENAME}" "TARGET_SONAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DYLIBNAME=${LUA_JIT_DLL_FILENAME}" "TARGET_DLLNAME=${LUA_JIT_DLL_FILENAME}" )
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=dynamic" )
2017-12-24 09:34:34 +08:00
else ( )
2018-01-20 04:03:22 +08:00
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "BUILDMODE=static" )
2018-02-11 13:53:53 +08:00
set ( LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -fPIC" )
2018-01-20 04:03:22 +08:00
endif ( )
set ( LUA_JIT_PREBUILT_DLL ${ LUA_JIT_DLL_FILENAME } )
set ( LUA_JIT_PREBUILT_LIB ${ LUA_JIT_LIB_FILENAME } )
set ( LUA_JIT_PREBUILT_IMP_LIB ${ LUA_JIT_IMP_LIB_FILENAME } )
if ( WIN32 )
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_SYS=Windows" "TARGET_SYS=Windows" )
2017-12-24 09:34:34 +08:00
endif ( )
2018-01-21 01:02:06 +08:00
if ( PLATFORM MATCHES "x86" )
2018-02-11 13:53:53 +08:00
set ( LUA_JIT_MAKE_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS} -m32" )
set ( LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS} -m32" )
2018-01-21 01:02:06 +08:00
endif ( )
2018-02-11 13:53:53 +08:00
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CFLAGS=${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS}" )
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "TARGET_CFLAGS=${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS}" )
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_CFLAGS=${LUA_JIT_MAKE_CFLAGS_MODIFICATIONS}" )
2018-01-20 04:03:22 +08:00
set ( LUA_JIT_BUILD_COMMAND BUILD_COMMAND "${MAKE_PROGRAM}" ${ LUA_JIT_MAKE_BUILD_MODIFICATIONS } )
endif ( )
set ( lualib luajitlib_ ${ LUA_JIT_VERSION } )
2018-01-24 01:07:22 +08:00
set ( luainterpreter luajit_ ${ LUA_JIT_VERSION } )
2018-01-20 04:03:22 +08:00
file ( TO_NATIVE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_LIB}" LUA_JIT_SOURCE_LUA_LIB )
file ( TO_NATIVE_PATH "${LUA_JIT_LIB_FILE}" LUA_JIT_DESTINATION_LUA_LIB )
file ( TO_NATIVE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_IMP_LIB}" LUA_JIT_SOURCE_LUA_IMP_LIB )
file ( TO_NATIVE_PATH "${LUA_JIT_IMP_LIB_FILE}" LUA_JIT_DESTINATION_LUA_IMP_LIB )
file ( TO_NATIVE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_DLL}" LUA_JIT_SOURCE_LUA_DLL )
file ( TO_NATIVE_PATH "${LUA_JIT_DLL_FILE}" LUA_JIT_DESTINATION_LUA_DLL )
file ( TO_NATIVE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_EXP}" LUA_JIT_SOURCE_LUA_LIB_EXP )
file ( TO_NATIVE_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_LIB_EXP_FILENAME}" LUA_JIT_DESTINATION_LUA_LIB_EXP )
2018-01-24 08:50:49 +08:00
file ( TO_NATIVE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_EXE_FILENAME}" LUA_JIT_SOURCE_LUA_INTERPRETER )
2018-01-24 01:07:22 +08:00
file ( TO_NATIVE_PATH "${LUA_JIT_EXE_FILE}" LUA_JIT_DESTINATION_LUA_INTERPRETER )
2018-01-20 04:03:22 +08:00
if ( WIN32 AND NOT MSVC )
string ( COMPARE EQUAL ${ LUA_JIT_VERSION } ${ LUA_JIT_2.0_LATEST_VERSION } lua_jit_same_version_20 )
string ( COMPARE EQUAL ${ LUA_JIT_VERSION } ${ LUA_JIT_2.1_LATEST_VERSION } lua_jit_same_version_21 )
if ( lua_jit_same_version_20 OR lua_jit_same_version_21 )
#set (LUA_JIT_GIT_COMMIT ${LUA_JIT_${LUA_JIT_VERSION}_COMMIT})
#set(LUA_JIT_GIT_TAG GIT_TAG ${LUA_JIT_GIT_COMMIT})
endif ( )
elseif ( LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "latest" )
set ( LUA_JIT_PULL_LATEST TRUE )
endif ( )
if ( LUA_JIT_GIT_COMMIT OR LUA_JIT_PULL_LATEST )
if ( LUA_JIT_PULL_LATEST )
MESSAGE ( STATUS "Latest LuaJIT has been requested: pulling from git..." )
elseif ( LUA_JIT_GIT_COMMIT )
MESSAGE ( STATUS "LuaJIT '${LUA_VERSION}' requested has broken static library builds: using git '${LUA_JIT_GIT_COMMIT}'..." )
endif ( )
2017-12-24 09:34:34 +08:00
ExternalProject_Add ( LUA_JIT
B U I L D _ I N _ S O U R C E T R U E
2018-02-11 05:24:17 +08:00
B U I L D _ A L W A Y S F A L S E
2017-12-24 09:34:34 +08:00
# LuaJIT does not offer a TLS/SSL port
2018-02-11 05:24:17 +08:00
T L S _ V E R I F Y F A L S E
2018-01-20 04:03:22 +08:00
P R E F I X " $ { L U A _ B U I L D _ T O P L E V E L } "
S O U R C E _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } "
D O W N L O A D _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } "
2017-12-24 09:34:34 +08:00
T M P _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } - t m p "
S T A M P _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } - s t a m p "
I N S T A L L _ D I R " $ { L U A _ B U I L D _ I N S T A L L _ D I R } "
2018-01-20 04:03:22 +08:00
G I T _ R E P O S I T O R Y h t t p s : / / g i t h u b . c o m / L u a J I T / L u a J I T . g i t
G I T _ R E M O T E _ N A M E o r i g i n
$ { L U A _ J I T _ G I T _ T A G }
G I T _ S H A L L O W T R U E
C O N F I G U R E _ C O M M A N D " "
$ { L U A _ J I T _ B U I L D _ C O M M A N D }
I N S T A L L _ C O M M A N D " "
T E S T _ C O M M A N D " "
B U I L D _ B Y P R O D U C T S " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B _ E X P } "
" $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ D L L } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ I M P _ L I B } " )
else ( )
ExternalProject_Add ( LUA_JIT
B U I L D _ I N _ S O U R C E T R U E
B U I L D _ A L W A Y S T R U E
# LuaJIT does not offer a TLS/SSL port
# TLS_VERIFY TRUE
P R E F I X " $ { L U A _ B U I L D _ T O P L E V E L } "
S O U R C E _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } "
D O W N L O A D _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } "
T M P _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } - t m p "
S T A M P _ D I R " $ { L U A _ B U I L D _ T O P L E V E L } - s t a m p "
I N S T A L L _ D I R " $ { L U A _ B U I L D _ I N S T A L L _ D I R } "
U R L " $ { L U A _ J I T _ D O W N L O A D _ U R I } "
2017-12-24 09:34:34 +08:00
$ { L U A _ J I T _ D O W N L O A D _ M D 5 _ C O M M A N D }
$ { L U A _ J I T _ D O W N L O A D _ S H A 1 _ C O M M A N D }
C O N F I G U R E _ C O M M A N D " "
2018-01-20 04:03:22 +08:00
$ { L U A _ J I T _ B U I L D _ C O M M A N D }
I N S T A L L _ C O M M A N D " "
T E S T _ C O M M A N D " "
B U I L D _ B Y P R O D U C T S " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B _ E X P } "
" $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ D L L } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ I M P _ L I B } " )
endif ( )
# # Post-Build moving steps for necessary items
# Add post-step to move library afterwards
if ( MSVC )
ExternalProject_Add_Step ( LUA_JIT
p o s t b u i l d . e x p
D E P E N D E E S b u i l d
C O M M E N T " L i b r a y - M o v i n g \ " $ { L U A _ J I T _ S O U R C E _ L U A _ L I B _ E X P } \ " t o \ " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B _ E X P } \ " . . . "
2018-01-21 01:02:06 +08:00
C O M M A N D " $ { C M A K E _ C O M M A N D } " - E c o p y " $ { L U A _ J I T _ S O U R C E _ L U A _ L I B _ E X P } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B _ E X P } " & & e c h o S u c c e s s f u l l y m o v e d ! )
2018-01-20 04:03:22 +08:00
endif ( )
if ( BUILD_LUA_AS_DLL )
if ( MSVC )
MESSAGE ( STATUS ${ LUA_JIT_SOURCE_LUA_IMP_LIB } )
MESSAGE ( STATUS ${ LUA_JIT_DESTINATION_LUA_IMP_LIB } )
ExternalProject_Add_Step ( LUA_JIT
p o s t b u i l d . i m p o r t . l i b
D E P E N D E E S b u i l d
C O M M E N T " L i b r a y - M o v i n g \ " $ { L U A _ J I T _ S O U R C E _ L U A _ I M P _ L I B } \ " t o \ " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ I M P _ L I B } \ " . . . "
C O M M A N D " $ { C M A K E _ C O M M A N D } " - E c o p y " $ { L U A _ J I T _ S O U R C E _ L U A _ I M P _ L I B } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ I M P _ L I B } "
2018-01-21 01:02:06 +08:00
C O M M A N D e c h o S u c c e s s f u l l y m o v e d ! )
2018-01-20 04:03:22 +08:00
endif ( )
MESSAGE ( STATUS ${ LUA_JIT_SOURCE_LUA_DLL } )
MESSAGE ( STATUS ${ LUA_JIT_DESTINATION_LUA_DLL } )
MESSAGE ( STATUS ${ LUA_JIT_DLL_FILE } )
ExternalProject_Add_Step ( LUA_JIT
p o s t b u i l d . d l l
D E P E N D E E S b u i l d
C O M M E N T " D y n a m i c L i b r a r y - M o v i n g \ " $ { L U A _ J I T _ S O U R C E _ L U A _ D L L } \ " t o \ " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ D L L } \ " . . . "
2018-01-21 01:02:06 +08:00
C O M M A N D " $ { C M A K E _ C O M M A N D } " - E c o p y " $ { L U A _ J I T _ S O U R C E _ L U A _ D L L } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ D L L } " & & e c h o S u c c e s s f u l l y m o v e d ! )
2018-01-20 04:03:22 +08:00
else ( )
ExternalProject_Add_Step ( LUA_JIT
p o s t b u i l d . l i b
D E P E N D E E S b u i l d
C O M M E N T " L i b r a r y - M o v i n g \ " $ { L U A _ J I T _ S O U R C E _ L U A _ L I B } \ " t o \ " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B } \ " . . . "
2018-01-21 01:02:06 +08:00
C O M M A N D " $ { C M A K E _ C O M M A N D } " - E c o p y " $ { L U A _ J I T _ S O U R C E _ L U A _ L I B } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B } " & & e c h o S u c c e s s f u l l y m o v e d ! )
2018-01-20 04:03:22 +08:00
endif ( )
2018-01-24 01:07:22 +08:00
ExternalProject_Add_Step ( LUA_JIT
p o s t b u i l d . e x e
D E P E N D E E S b u i l d
C O M M E N T " L i b r a r y - M o v i n g \ " $ { L U A _ J I T _ S O U R C E _ L U A _ I N T E R P R E T E R } \ " t o \ " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ I N T E R P R E T E R } \ " . . . "
C O M M A N D " $ { C M A K E _ C O M M A N D } " - E c o p y " $ { L U A _ J I T _ S O U R C E _ L U A _ I N T E R P R E T E R } " " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ I N T E R P R E T E R } " & & e c h o S u c c e s s f u l l y m o v e d ! )
# # TODO:
2018-01-20 04:03:22 +08:00
# Add additional post-build step to move all necessary headers/lua files
# for now, we just point directly to the `src` directory...
2018-01-24 01:07:22 +08:00
# # Lua Library
2018-01-20 04:03:22 +08:00
add_library ( ${ lualib } ${ LUA_BUILD_LIBRARY_TYPE } IMPORTED )
# make sure the library we export really does depend on Lua JIT's external project
add_dependencies ( ${ lualib } LUA_JIT )
if ( BUILD_LUA_AS_DLL )
if ( MSVC )
set_target_properties ( ${ lualib }
P R O P E R T I E S
I M P O R T E D _ I M P L I B " $ { L U A _ J I T _ I M P _ L I B _ F I L E } " )
endif ( )
MESSAGE ( STATUS "${LUA_JIT_DLL_FILE}" )
MESSAGE ( STATUS "${LUA_JIT_DESTINATION_LUA_DLL}" )
set_target_properties ( ${ lualib }
2017-12-24 09:34:34 +08:00
P R O P E R T I E S
2018-01-20 04:03:22 +08:00
#IMPORTED_SONAME "${LUA_BUILD_LIBNAME}"
I M P O R T E D _ L O C A T I O N " $ { L U A _ J I T _ D L L _ F I L E } " )
else ( )
set_target_properties ( ${ lualib }
P R O P E R T I E S
I M P O R T E D _ L O C A T I O N " $ { L U A _ J I T _ L I B _ F I L E } " )
2017-12-24 09:34:34 +08:00
endif ( )
2018-01-20 04:03:22 +08:00
set_target_properties ( ${ lualib }
P R O P E R T I E S
I M P O R T E D _ L I N K _ I N T E R F A C E _ L A N G U A G E S C
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S " $ { L U A _ J I T _ S O U R C E _ D I R } " )
if ( XCODE )
target_compile_options ( ${ lualib }
P U B L I C - p a g e z e r o _ s i z e 1 0 0 0 0 - i m a g e _ b a s e 1 0 0 0 0 0 0 0 0 )
endif ( )
2018-01-24 01:07:22 +08:00
# # Lua Executable
add_executable ( ${ luainterpreter } IMPORTED )
# Point EXE to fiel
set_target_properties ( ${ luainterpreter }
P R O P E R T I E S
I M P O R T E D _ L O C A T I O N " $ { L U A _ J I T _ E X E _ F I L E } " )
2018-01-20 04:03:22 +08:00
# set externally-visible target indicator
set ( LUA_LIBRARIES ${ lualib } )
2018-01-24 01:07:22 +08:00
set ( LUA_INTERPRETER ${ luainterpreter } )
2018-02-08 13:40:34 +08:00
set ( LUA_INCLUDE_DIRS "${LUA_JIT_SOURCE_DIR}" )