2021-03-06 23:14:48 +08:00
# # # # sol2
2017-12-24 09:34:34 +08:00
# The MIT License (MIT)
#
2022-06-25 16:00:53 +08:00
# Copyright (c) 2013-2022 Rapptz, ThePhD, and contributors
2017-12-24 09:34:34 +08:00
#
# 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
# 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 )
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_VERSION 2.0 )
2017-12-24 09:34:34 +08:00
elseif ( ${ CMAKE_MATCH_2 } EQUAL 1 )
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_VERSION 2.1 )
2017-12-24 09:34:34 +08:00
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" )
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_VERSION 2.1 )
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" )
2019-03-24 00:09:51 +08:00
set ( LUA_JIT_INCLUDE_DIRS "${LUA_JIT_SOURCE_DIR}" )
2018-01-20 04:03:22 +08:00
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
2019-03-24 09:50:02 +08:00
# make sure to find the right one
find_file ( VCVARS_ALL_BAT NAMES vcvarsall.bat
H I N T S " C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / C o m m u n i t y / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / C o m m u n i t y / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / C o m m u n i t y / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / P r o f e s s i o n a l / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / P r o f e s s i o n a l / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / P r o f e s s i o n a l / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / E n t e r p r i s e / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / E n t e r p r i s e / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / E n t e r p r i s e / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / C o m m u n i t y / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / C o m m u n i t y / V C / A u x i l i a r y "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / C o m m u n i t y / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / P r o f e s s i o n a l / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / P r o f e s s i o n a l / V C / A u x i l i a r y "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / P r o f e s s i o n a l / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / E n t e r p r i s e / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / E n t e r p r i s e / V C / A u x i l i a r y "
2019-11-30 02:08:41 +08:00
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 7 / E n t e r p r i s e / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / C o m m u n i t y / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / C o m m u n i t y / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / C o m m u n i t y / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / P r o f e s s i o n a l / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / P r o f e s s i o n a l / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / P r o f e s s i o n a l / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / E n t e r p r i s e / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / E n t e r p r i s e / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / E n t e r p r i s e / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / C o m m u n i t y / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / C o m m u n i t y / V C / A u x i l i a r y "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / C o m m u n i t y / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / P r o f e s s i o n a l / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / P r o f e s s i o n a l / V C / A u x i l i a r y "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / P r o f e s s i o n a l / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / E n t e r p r i s e / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / E n t e r p r i s e / V C / A u x i l i a r y "
2023-07-20 12:53:31 +08:00
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 1 9 / E n t e r p r i s e / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / C o m m u n i t y / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / C o m m u n i t y / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / C o m m u n i t y / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / P r o f e s s i o n a l / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / P r o f e s s i o n a l / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / P r o f e s s i o n a l / V C "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / E n t e r p r i s e / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / E n t e r p r i s e / V C / A u x i l i a r y "
" C : / P r o g r a m Files ( x86 ) / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / E n t e r p r i s e / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / C o m m u n i t y / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / C o m m u n i t y / V C / A u x i l i a r y "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / C o m m u n i t y / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / P r o f e s s i o n a l / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / P r o f e s s i o n a l / V C / A u x i l i a r y "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / P r o f e s s i o n a l / V C "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / E n t e r p r i s e / V C / A u x i l i a r y / B u i l d "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / E n t e r p r i s e / V C / A u x i l i a r y "
" C : / P r o g r a m F i l e s / M i c r o s o f t V i s u a l S t u d i o / 2 0 2 2 / E n t e r p r i s e / V C " )
2019-03-24 09:50:02 +08:00
if ( VCVARS_ALL_BAT MATCHES "VCVARS_ALL_BAT-NOTFOUND" )
MESSAGE ( FATAL_ERROR "Cannot find 'vcvarsall.bat' file or similar needed to build LuaJIT ${LUA_VERSION} on Windows" )
endif ( )
if ( CMAKE_SIZEOF_VOID_P LESS_EQUAL 4 )
set ( LUA_JIT_MAKE_COMMAND "${VCVARS_ALL_BAT}" x86 )
2018-01-20 04:03:22 +08:00
else ( )
2019-03-24 09:50:02 +08:00
set ( LUA_JIT_MAKE_COMMAND "${VCVARS_ALL_BAT}" x64 )
2018-01-20 04:03:22 +08:00
endif ( )
2019-03-24 09:50:02 +08:00
set ( LUA_JIT_MAKE_COMMAND ${ LUA_JIT_MAKE_COMMAND } && cd src && msvcbuild.bat )
2019-11-30 02:08:41 +08:00
if ( CMAKE_BUILD_TYPE MATCHES "Debug" )
set ( LUA_JIT_MAKE_COMMAND ${ LUA_JIT_MAKE_COMMAND } debug )
endif ( )
2019-03-24 09:50:02 +08:00
if ( NOT BUILD_LUA_AS_DLL )
set ( LUA_JIT_MAKE_COMMAND ${ LUA_JIT_MAKE_COMMAND } static )
endif ( )
2018-01-20 04:03:22 +08:00
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" )
2018-02-19 19:30:44 +08:00
set ( LUA_JIT_PREBUILT_EXE "luajit.exe" )
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 "" )
2019-03-24 00:09:51 +08:00
set ( LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "-fPIC" )
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" )
endif ( )
2018-02-13 06:01:30 +08:00
if ( IS_X86 )
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "CC=${CMAKE_C_COMPILER} -m32" )
2018-02-17 23:44:55 +08:00
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "LDFLAGS=-m32" )
2018-02-13 06:01:30 +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")
#set(LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS "${LUA_JIT_MAKE_TARGET_CFLAGS_MODIFICATIONS} -m32")
endif ( )
2018-01-20 04:03:22 +08:00
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 } )
2018-02-19 19:30:44 +08:00
set ( LUA_JIT_PREBUILT_EXE ${ LUA_JIT_EXE_FILENAME } )
set ( LUA_JIT_PREBUILT_EXP ${ LUA_JIT_LIB_EXP_FILENAME } )
2018-01-20 04:03:22 +08:00
if ( WIN32 )
2018-03-16 05:16:28 +08:00
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_SYS=Windows" "TARGET_SYS=Windows" "TARGET_AR=ar rcus" )
2017-12-24 09:34:34 +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}" )
2018-02-13 06:01:30 +08:00
list ( APPEND LUA_JIT_MAKE_BUILD_MODIFICATIONS "HOST_CFLAGS=${LUA_JIT_MAKE_HOST_CFLAGS_MODIFICATIONS}" )
2019-03-24 00:09:51 +08:00
set ( LUA_JIT_MAKE_COMMAND "${MAKE_PROGRAM}" ${ LUA_JIT_MAKE_BUILD_MODIFICATIONS } )
2018-01-20 04:03:22 +08:00
endif ( )
2019-03-24 00:09:51 +08:00
set ( LUA_JIT_BUILD_COMMAND BUILD_COMMAND ${ LUA_JIT_MAKE_COMMAND } )
2018-02-19 19:30:44 +08:00
set ( lualib luajit_lib_ ${ 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
2018-02-19 19:30:44 +08:00
file ( TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_LIB}" LUA_JIT_SOURCE_LUA_LIB )
file ( TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_IMP_LIB}" LUA_JIT_SOURCE_LUA_IMP_LIB )
file ( TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_EXE}" LUA_JIT_SOURCE_LUA_INTERPRETER )
file ( TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_DLL}" LUA_JIT_SOURCE_LUA_DLL )
file ( TO_CMAKE_PATH "${LUA_JIT_SOURCE_DIR}/${LUA_JIT_PREBUILT_EXP}" LUA_JIT_SOURCE_LUA_LIB_EXP )
2018-12-21 14:07:05 +08:00
file ( TO_CMAKE_PATH "${LUA_JIT_DLL_FILE}" LUA_JIT_DESTINATION_LUA_DLL )
file ( TO_CMAKE_PATH "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${LUA_JIT_LIB_EXP_FILENAME}" LUA_JIT_DESTINATION_LUA_LIB_EXP )
2018-12-23 04:36:42 +08:00
file ( TO_CMAKE_PATH "${LUA_JIT_IMP_LIB_FILE}" LUA_JIT_DESTINATION_LUA_IMP_LIB )
file ( TO_CMAKE_PATH "${LUA_JIT_LIB_FILE}" LUA_JIT_DESTINATION_LUA_LIB )
file ( TO_CMAKE_PATH "${LUA_JIT_EXE_FILE}" LUA_JIT_DESTINATION_LUA_INTERPRETER )
2018-01-20 04:03:22 +08:00
2023-07-20 12:53:31 +08:00
if ( LUA_JIT_NORMALIZED_LUA_VERSION MATCHES "latest" )
2018-01-20 04:03:22 +08:00
set ( LUA_JIT_PULL_LATEST TRUE )
endif ( )
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_BYPRODUCTS "${LUA_JIT_SOURCE_LUA_INTERPRETER}" )
set ( LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_DESTINATION_LUA_INTERPRETER}" )
2018-02-19 19:30:44 +08:00
2023-07-20 12:53:31 +08:00
if ( BUILD_LUA_AS_DLL )
set ( LUA_JIT_BYPRODUCTS ${ LUA_JIT_BYPRODUCTS } "${LUA_JIT_SOURCE_LUA_DLL}" )
set ( LUA_JIT_INSTALL_BYPRODUCTS ${ LUA_JIT_INSTALL_BYPRODUCTS } "${LUA_JIT_SOURCE_LUA_DLL}" )
if ( MSVC )
set ( LUA_JIT_BYPRODUCTS ${ LUA_JIT_BYPRODUCTS } "${LUA_JIT_SOURCE_LUA_LIB_EXP}" )
set ( LUA_JIT_INSTALL_BYPRODUCTS ${ LUA_JIT_INSTALL_BYPRODUCTS } "${LUA_JIT_DESTINATION_LUA_LIB_EXP}" )
endif ( )
2019-03-24 00:09:51 +08:00
endif ( )
2018-02-19 20:09:51 +08:00
2019-03-24 00:09:51 +08:00
if ( CMAKE_IMPORT_LIBRARY_SUFFIX AND BUILD_LUA_AS_DLL )
set ( LUA_JIT_BYPRODUCTS ${ LUA_JIT_BYPRODUCTS } "${LUA_JIT_SOURCE_LUA_IMP_LIB}" )
2018-02-19 20:09:51 +08:00
set ( LUA_JIT_INSTALL_BYPRODUCTS "${LUA_JIT_INSTALL_BYPRODUCTS}" "${LUA_JIT_DESTINATION_LUA_IMP_LIB}" )
2019-03-24 00:09:51 +08:00
else ( )
set ( LUA_JIT_BYPRODUCTS ${ LUA_JIT_BYPRODUCTS } "${LUA_JIT_SOURCE_LUA_LIB}" )
set ( LUA_JIT_INSTALL_BYPRODUCTS ${ LUA_JIT_INSTALL_BYPRODUCTS } "${LUA_JIT_DESTINATION_LUA_LIB}" )
2018-02-19 20:09:51 +08:00
endif ( )
2018-02-19 19:30:44 +08:00
# # Post-Build moving steps for necessary items
# Add post-step to move library afterwards
2018-02-19 19:36:31 +08:00
set ( LUA_JIT_POSTBUILD_COMMENTS "Executable - Moving \" ${ LUA_JIT_SOURCE_LUA_INTERPRETER } \" to \"${LUA_JIT_DESTINATION_LUA_INTERPRETER}\"...")
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_POSTBUILD_COMMANDS COMMAND ${ CMAKE_COMMAND } -E copy_if_different ${ LUA_JIT_SOURCE_LUA_INTERPRETER } ${ LUA_JIT_DESTINATION_LUA_INTERPRETER } )
2018-02-19 19:30:44 +08:00
if ( BUILD_LUA_AS_DLL )
if ( MSVC )
2019-11-13 12:18:02 +08:00
set ( LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} Import Library - Moving \" ${ LUA_JIT_SOURCE_LUA_IMP_LIB } \" to \"${LUA_JIT_DESTINATION_LUA_IMP_LIB}\"...")
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_POSTBUILD_COMMANDS ${ LUA_JIT_POSTBUILD_COMMANDS } COMMAND "${CMAKE_COMMAND}" -E copy_if_different ${ LUA_JIT_SOURCE_LUA_IMP_LIB } ${ LUA_JIT_DESTINATION_LUA_IMP_LIB } )
2018-02-19 19:30:44 +08:00
2019-11-13 12:18:02 +08:00
set ( LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} Library - Moving \" ${ LUA_JIT_SOURCE_LUA_LIB_EXP } \" to \"${LUA_JIT_DESTINATION_LUA_LIB_EXP}\"...")
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_POSTBUILD_COMMANDS ${ LUA_JIT_POSTBUILD_COMMANDS } COMMAND ${ CMAKE_COMMAND } -E copy_if_different ${ LUA_JIT_SOURCE_LUA_LIB_EXP } ${ LUA_JIT_DESTINATION_LUA_LIB_EXP } )
2018-02-19 19:30:44 +08:00
endif ( )
2019-11-13 12:18:02 +08:00
set ( LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} Dynamic Library - Moving \" ${ LUA_JIT_SOURCE_LUA_DLL } \" to \"${LUA_JIT_DESTINATION_LUA_DLL}\"...")
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_POSTBUILD_COMMANDS ${ LUA_JIT_POSTBUILD_COMMANDS } COMMAND ${ CMAKE_COMMAND } -E copy_if_different ${ LUA_JIT_SOURCE_LUA_DLL } ${ LUA_JIT_DESTINATION_LUA_DLL } )
2018-02-19 19:30:44 +08:00
else ( )
2019-11-13 12:18:02 +08:00
set ( LUA_JIT_POSTBUILD_COMMENTS "${LUA_JIT_POSTBUILD_COMMENTS} Library - Moving \" ${ LUA_JIT_SOURCE_LUA_LIB } \" to \"${LUA_JIT_DESTINATION_LUA_LIB}\"...")
2023-07-20 12:53:31 +08:00
set ( LUA_JIT_POSTBUILD_COMMANDS ${ LUA_JIT_POSTBUILD_COMMANDS } COMMAND ${ CMAKE_COMMAND } -E copy_if_different ${ LUA_JIT_SOURCE_LUA_LIB } ${ LUA_JIT_DESTINATION_LUA_LIB } )
2018-02-19 19:30:44 +08:00
endif ( )
2018-02-12 16:55:14 +08:00
2019-03-24 00:09:51 +08:00
if ( LUA_LOCAL_DIR )
2023-07-20 12:53:31 +08:00
MESSAGE ( STATUS "Using LuaJIT ${LUA_JIT_VERSION} from local directory \" ${ LUA_LOCAL_DIR } \"")
2019-03-24 00:09:51 +08:00
file ( COPY "${LUA_LOCAL_DIR}/"
D E S T I N A T I O N " $ { L U A _ B U I L D _ T O P L E V E L } "
F I L E S _ M A T C H I N G R E G E X " . * "
)
add_custom_command ( OUTPUT ${ LUA_JIT_BYPRODUCTS }
C O M M A N D $ { L U A _ J I T _ M A K E _ C O M M A N D }
W O R K I N G _ D I R E C T O R Y " $ { L U A _ B U I L D _ T O P L E V E L } "
D E P E N D S " $ { L U A _ B U I L D _ T O P L E V E L } / M a k e f i l e " " $ { L U A _ B U I L D _ T O P L E V E L } / s r c / m s v c b u i l d . b a t "
2023-07-20 12:53:31 +08:00
C O M M E N T " B u i l d i n g L u a J I T $ { L U A _ J I T _ V E R S I O N } . . . "
2019-03-24 00:09:51 +08:00
)
2023-07-20 12:53:31 +08:00
add_custom_target ( LUA_JIT-bat-build
D E P E N D S $ { L U A _ J I T _ B Y P R O D U C T S }
)
add_custom_command ( OUTPUT ${ LUA_JIT_INSTALL_BYPRODUCTS }
2019-03-24 00:09:51 +08:00
$ { L U A _ J I T _ P O S T B U I L D _ C O M M A N D S }
2023-07-20 12:53:31 +08:00
C O M M E N T " $ { L U A _ J I T _ P O S T B U I L D _ C O M M E N T S } "
W O R K I N G _ D I R E C T O R Y " $ { L U A _ B U I L D _ T O P L E V E L } "
2019-03-24 00:09:51 +08:00
D E P E N D S $ { L U A _ J I T _ B Y P R O D U C T S }
)
2023-07-20 12:53:31 +08:00
add_custom_target ( LUA_JIT-move
D E P E N D S L U A _ J I T - b a t - b u i l d $ { L U A _ J I T _ I N S T A L L _ B Y P R O D U C T S }
)
2019-03-24 00:09:51 +08:00
elseif ( LUA_JIT_GIT_COMMIT OR LUA_JIT_PULL_LATEST )
2018-01-20 04:03:22 +08:00
if ( LUA_JIT_PULL_LATEST )
MESSAGE ( STATUS "Latest LuaJIT has been requested: pulling from git..." )
elseif ( LUA_JIT_GIT_COMMIT )
2023-07-20 12:53:31 +08:00
MESSAGE ( STATUS "LuaJIT '${LUA_VERSION}' requested has broken static library builds: using git '${LUA_JIT_GIT_COMMIT}'..." )
set ( LUA_JIT_GIT_TAG GIT_TAG ${ LUA_JIT_GIT_COMMIT } )
2018-01-20 04:03:22 +08:00
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
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 " "
2019-03-24 00:09:51 +08:00
B U I L D _ B Y P R O D U C T S $ { L U A _ J I T _ B Y P R O D U C T S } )
2018-01-20 04:03:22 +08:00
else ( )
ExternalProject_Add ( LUA_JIT
B U I L D _ I N _ S O U R C E T R U E
2019-03-24 00:09:51 +08:00
B U I L D _ A L W A Y S T R U E
2018-01-20 04:03:22 +08:00
# LuaJIT does not offer a TLS/SSL port
2018-02-19 19:30:44 +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 } "
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 " "
2019-03-24 00:09:51 +08:00
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 _ B Y P R O D U C T S } )
2018-01-20 04:03:22 +08:00
endif ( )
2019-03-24 00:09:51 +08:00
if ( NOT LUA_LOCAL_DIR )
ExternalProject_Add_Step ( LUA_JIT move
A L W A Y S T R U E
$ { L U A _ J I T _ P O S T B U I L D _ C O M M A N D S }
W O R K I N G _ D I R E C T O R Y " $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } "
C O M M E N T $ { L U A _ J I T _ P O S T B U I L D _ C O M M E N T S }
D E P E N D E E S b u i l d
D E P E N D S $ { L U A _ J I T _ B Y P R O D U C T S }
B Y P R O D U C T S $ { L U A _ J I T _ I N S T A L L _ B Y P R O D U C T S } )
ExternalProject_Add_StepTargets ( LUA_JIT move )
endif ( )
2018-02-19 19:30:44 +08:00
2018-01-24 01:07:22 +08:00
# # Lua Library
2019-03-24 00:09:51 +08:00
add_library ( ${ lualib } INTERFACE )
2023-07-20 12:53:31 +08:00
add_library ( Lua::Lua ALIAS ${ lualib } )
2018-12-23 04:36:42 +08:00
add_dependencies ( ${ lualib } LUA_JIT-move )
2019-03-24 00:09:51 +08:00
target_include_directories ( ${ lualib }
2023-07-20 12:53:31 +08:00
I N T E R F A C E
" $ { L U A _ J I T _ S O U R C E _ D I R } " )
2021-03-06 14:03:23 +08:00
target_link_libraries ( ${ lualib }
2023-07-20 12:53:31 +08:00
I N T E R F A C E
$ { C M A K E _ D L _ L I B S } )
2018-01-20 04:03:22 +08:00
if ( BUILD_LUA_AS_DLL )
if ( MSVC )
2019-03-24 00:09:51 +08:00
target_link_libraries ( ${ lualib }
I N T E R F A C E " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B } " )
else ( )
target_link_libraries ( ${ lualib }
I N T E R F A C E " $ { 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-20 04:03:22 +08:00
endif ( )
2019-03-24 00:09:51 +08:00
else ( )
target_link_libraries ( ${ lualib }
I N T E R F A C E " $ { L U A _ J I T _ D E S T I N A T I O N _ L U A _ L I B } " )
2017-12-24 09:34:34 +08:00
endif ( )
2019-03-24 00:09:51 +08:00
2018-01-20 04:03:22 +08:00
if ( XCODE )
target_compile_options ( ${ lualib }
2019-03-24 00:09:51 +08:00
I N T E R F A C E - 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 )
2018-01-20 04:03:22 +08:00
endif ( )
2019-03-24 00:09:51 +08:00
2018-02-19 19:30:44 +08:00
# # set externally-visible target indicator
2023-07-20 12:53:31 +08:00
set ( LUA_LIBRARIES Lua::Lua )
2019-03-24 00:09:51 +08:00
set ( LUA_INTERPRETER "" )
set ( LUA_INCLUDE_DIRS "${LUA_JIT_INCLUDE_DIRS}" )