summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
m---------3rd/lni0
-rw-r--r--make.lua46
-rw-r--r--make/install.lua44
3 files changed, 60 insertions, 30 deletions
diff --git a/3rd/lni b/3rd/lni
-Subproject 4f6c80a8b4fc96449c2d4632f2a9156058a9358
+Subproject d56cff6179e85303c8063ccfa58256ddca32f38
diff --git a/make.lua b/make.lua
index 4754f912..a9262943 100644
--- a/make.lua
+++ b/make.lua
@@ -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