This repository was archived by the owner on Nov 20, 2020. It is now read-only.
forked from fab13n/metalua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
49 lines (41 loc) · 2.25 KB
/
CMakeLists.txt
File metadata and controls
49 lines (41 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Copyright (C) 2011 LuaDist.
# Submited by Michal Kottman, Peter Drahos
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the COPYRIGHT file distributed with LuaDist.
# Please note that the package source code is licensed under its own license.
project ( metalua NONE )
cmake_minimum_required ( VERSION 2.8 )
include ( cmake/dist.cmake )
include ( lua )
find_program ( LUA NAMES lua lua.bat )
find_program ( LUAC NAMES luac luac.bat )
set ( SRC ${CMAKE_CURRENT_SOURCE_DIR}/src )
set ( BIN ${CMAKE_CURRENT_BINARY_DIR} )
set ( LIB ${BIN}/lib )
file ( COPY ${SRC}/lib/ DESTINATION ${LIB} )
add_custom_target ( bootstrap ALL COMMAND ${LUAC} -o ${LIB}/metalua/bytecode.lua
${SRC}/compiler/lopcodes.lua ${SRC}/compiler/lcode.lua ${SRC}/compiler/ldump.lua
${SRC}/compiler/compile.lua COMMAND ${LUAC} -o ${LIB}/metalua/mlp.lua ${SRC}/compiler/lexer.lua
${SRC}/compiler/gg.lua ${SRC}/compiler/mlp_lexer.lua ${SRC}/compiler/mlp_misc.lua
${SRC}/compiler/mlp_table.lua ${SRC}/compiler/mlp_meta.lua ${SRC}/compiler/mlp_expr.lua
${SRC}/compiler/mlp_stat.lua ${SRC}/compiler/mlp_ext.lua COMMAND ${LUA} ${SRC}/build-utils/bootstrap.lua
${SRC}/compiler/mlc.mlua output=${LIB}/metalua/mlc.lua COMMAND ${LUA} ${SRC}/build-utils/bootstrap.lua
${SRC}/compiler/metalua.mlua output=${LIB}/metalua.lua COMMAND ${LUA} ${LIB}/metalua.lua
-vb -f ${SRC}/compiler/mlc.mlua -o ${LIB}/metalua/mlc.lua COMMAND ${LUA} ${LIB}/metalua.lua
-vb -f ${SRC}/compiler/metalua.mlua -o ${LIB}/metalua.lua WORKING_DIRECTORY ${LIB}
VERBATIM )
file ( GLOB_RECURSE SRCS RELATIVE ${LIB} "${LIB}/*.mlua" )
foreach ( S ${SRCS} )
get_filename_component ( P ${S} PATH )
get_filename_component ( D ${S} NAME_WE )
add_custom_command ( OUTPUT ${P}/${D}.lua COMMAND ${LUA} ${LIB}/metalua.lua ${S} -o ${P}/${D}.lua WORKING_DIRECTORY ${LIB} DEPENDS bootstrap )
endforeach ( )
install_lua_executable ( metalua ${LIB}/metalua.lua )
# When building the executable wrapper make sure to do it after bootstrap
if ( TARGET metalua )
add_dependencies ( metalua bootstrap )
endif ()
install ( DIRECTORY ${LIB}/ DESTINATION ${INSTALL_LMOD} COMPONENT Runtime PATTERN "*.in" EXCLUDE )
install_doc ( doc/ )
install_foo ( junk/ )
install_data ( INSTALL.TXT README.TXT LICENSE )