diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-04-15 09:53:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-15 09:53:52 +0800 |
commit | 4b7b30d6049a38c7bb3f6506daa3d009d04deb12 (patch) | |
tree | 274a7de55a738cf1a6a882900ba9bccd720ff97d | |
parent | 4634aeb159e395330f90b0e1bf2f8da8762c2a1d (diff) | |
parent | 083f613300c19f451f0b8f622873e4a63f78df66 (diff) | |
download | lua-language-server-4b7b30d6049a38c7bb3f6506daa3d009d04deb12.zip |
Merge pull request #19 from young40/master
新增macOS编译支持
m--------- | 3rd/lni | 0 | ||||
-rw-r--r-- | make.lua | 46 | ||||
-rw-r--r-- | make/install.lua | 44 |
3 files changed, 60 insertions, 30 deletions
diff --git a/3rd/lni b/3rd/lni -Subproject 4f6c80a8b4fc96449c2d4632f2a9156058a9358 +Subproject d56cff6179e85303c8063ccfa58256ddca32f38 @@ -5,30 +5,46 @@ lm:import '3rd/bee.lua/make.lua' lm.arch = 'x64' lm.rootdir = '3rd/' +local lua = 'lua54' +local includes = nil +local lpeglabel_ldflags = '/EXPORT:luaopen_lpeglabel' +if lm.plat == 'macos' then + lua = 'lua' + includes = {'bee.lua/3rd/lua/src'} + lpeglabel_ldflags = nil +end + lm:shared_library 'lni' { - deps = 'lua54', + deps = lua, sources = { 'lni/src/main.cpp', - } + }, + includes = includes } lm:shared_library 'lpeglabel' { - deps = 'lua54', + deps = lua, sources = 'lpeglabel/*.c', - ldflags = '/EXPORT:luaopen_lpeglabel' + ldflags = lpeglabel_ldflags, + includes = includes } -lm:executable 'rcedit' { - sources = 'rcedit/src/*.cc', - defines = { - '_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING' - }, - flags = { - '/wd4477', - '/wd4244', - '/wd4267', +local rcedit = nil +if lm.plat ~= 'macos' then + rcedit = 'rcedit' + + lm:executable 'rcedit' { + sources = 'rcedit/src/*.cc', + defines = { + '_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING' + }, + flags = { + '/wd4477', + '/wd4244', + '/wd4267', + } } -} +end lm:build 'install' { '$luamake', 'lua', 'make/install.lua', @@ -37,7 +53,7 @@ lm:build 'install' { 'lni', 'lpeglabel', 'bee', - 'rcedit' + rcedit } } diff --git a/make/install.lua b/make/install.lua index 448c266f..4aa544de 100644 --- a/make/install.lua +++ b/make/install.lua @@ -1,27 +1,41 @@ local fs = require 'bee.filesystem' local sp = require 'bee.subprocess' +local is_macos = package.cpath:sub(-3) == '.so' + local CWD = fs.current_path() local output = CWD / 'server' / 'bin' local bindir = CWD / 'build' / 'msvc' / 'bin' -fs.create_directories(output) -fs.copy_file(bindir / 'lni.dll', output / 'lni.dll', true) -fs.copy_file(bindir / 'lpeglabel.dll', output / 'lpeglabel.dll', true) -fs.copy_file(bindir / 'bee.dll', output / 'bee.dll', true) -fs.copy_file(bindir / 'lua54.dll', output / 'lua54.dll', true) -fs.copy_file(bindir / 'lua.exe', output / 'lua-language-server.exe', true) +local lib_ext = ".dll" +local exc_ext = ".exe" +if is_macos then + bindir = CWD / 'build' / 'macos' / 'bin' + lib_ext = ".so" + exc_ext = "" +end + +fs.create_directories(output) +fs.copy_file(bindir / 'lni'..lib_ext, output / 'lni'..lib_ext, true) +fs.copy_file(bindir / 'lpeglabel'..lib_ext, output / 'lpeglabel'..lib_ext, true) +fs.copy_file(bindir / 'bee'..lib_ext, output / 'bee'..lib_ext, true) +fs.copy_file(bindir / 'lua'..exc_ext, output / 'lua-language-server'..exc_ext, true) -local process = assert(sp.spawn { - bindir / 'rcedit.exe', - output / 'lua-language-server.exe', - '--set-icon', - CWD / 'images' / 'icon.ico' -}) -assert(process:wait()) +if not is_macos then + fs.copy_file(bindir / 'lua54'..lib_ext, output / 'lua54'..lib_ext, true) +end +if not is_macos then + local process = assert(sp.spawn { + bindir / 'rcedit.exe', + output / 'lua-language-server.exe', + '--set-icon', + CWD / 'images' / 'icon.ico' + }) + assert(process:wait()) -local msvc_crt = dofile 'make/msvc_crt.lua' -msvc_crt('x86', output) + local msvc_crt = dofile 'make/msvc_crt.lua' + msvc_crt('x86', output) +end |