代码拉取完成,页面将自动刷新
同步操作将从 墨客实验室/墨干理工套件 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
-------------------------------------------------------------------------------
--
-- MODULE : xmake.lua
-- DESCRIPTION : Xmake config file for Mogan STEM Suite
-- COPYRIGHT : (C) 2022-2023 jingkaimori
-- 2022-2023 Darcy Shen
--
-- This software falls under the GNU general public license version 3 or later.
-- It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
-- in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
set_xmakever("2.8.3")
-- Check CXX Types/Includes/Funcs
includes("check_cxxtypes.lua")
includes("check_cxxincludes.lua")
includes("check_cxxfuncs.lua")
configvar_check_cxxincludes("HAVE_UNISTD_H", "unistd.h")
configvar_check_cxxtypes("HAVE_INTPTR_T", "intptr_t", {includes = {"memory"}})
configvar_check_cxxincludes("HAVE_INTTYPES_H", "inttypes.h")
configvar_check_cxxincludes("HAVE_STDINT_H", "stdint.h")
configvar_check_cxxincludes("HAVE_SYS_STAT_H", "sys/stat.h")
configvar_check_cxxincludes("HAVE_SYS_TYPES_H", "sys/types.h")
configvar_check_cxxincludes("HAVE_UTIL_H", "util.h")
---
--- Project: Mogan STEM Suite
---
set_project("Mogan STEM Suite")
local TEXMACS_VERSION = "2.1.2"
local XMACS_VERSION="1.2.0"
local CONFIG_USER = "XmacsLabs"
local DEVEL_VERSION = TEXMACS_VERSION
local DEVEL_RELEASE = 1
local STABLE_VERSION = TEXMACS_VERSION
local STABLE_RELEASE = 1
local TM_CONFIGURE_VARS = {
CONFIG_USER = CONFIG_USER,
XMACS_VERSION = XMACS_VERSION,
tm_devel = "Texmacs-" .. DEVEL_VERSION,
tm_devel_release = "Texmacs-" .. DEVEL_VERSION .. "-" .. DEVEL_RELEASE,
tm_stable = "Texmacs-" .. STABLE_VERSION,
tm_stable_release = "Texmacs-" .. STABLE_VERSION .. "-" .. STABLE_RELEASE,
LOLLY_VERSION = LOLLY_VERSION,
}
set_allowedplats("wasm", "linux", "macosx", "mingw", "windows")
if is_plat("wasm") then
set_configvar("OS_WASM", true)
else
set_configvar("OS_WASM", false)
end
if is_plat("linux") then
set_configvar("OS_GNU_LINUX", true)
else
set_configvar("OS_GNU_LINUX", false)
end
if is_plat("macosx") then
set_configvar("OS_MACOS", true)
else
set_configvar("OS_MACOS", false)
end
if is_plat("mingw") then
set_configvar("OS_MINGW", true)
else
set_configvar("OS_MINGW", false)
end
if is_plat("windows") then
set_configvar("OS_WIN", true)
else
set_configvar("OS_WIN", false)
end
if is_plat("mingw") and is_host("windows") then
add_requires("mingw-w64 11.2.0")
set_toolchains("mingw@mingw-w64")
end
if is_plat("wasm") then
add_requires("emscripten 3.1.25")
set_toolchains("emcc@emscripten")
end
-- add releasedbg, debug and release modes.
set_allowedmodes("releasedbg", "release", "debug")
add_rules("mode.releasedbg", "mode.release", "mode.debug")
--
-- Add packages from xrepo or platform package manager
--
includes("xmake/packages.lua")
add_requires_of_mogan()
function build_glue_on_config()
on_config(function (target)
import("core.project.depend")
-- use relative path here to avoid import failure on windows
local scheme_path = path.join("src", "Scheme")
local build_glue_path = path.join("src", "Scheme", "Glue")
local build_glue = import("build_glue", {rootdir = build_glue_path})
for _, filepath in ipairs(os.filedirs(path.join(scheme_path, "**/glue_*.lua"))) do
depend.on_changed(function ()
local glue_name = path.basename(filepath)
local glue_dir = path.directory(filepath)
local glue_table = import(glue_name, {rootdir = glue_dir})()
io.writefile(
path.join("$(buildir)/glue", glue_name .. ".cpp"),
build_glue(glue_table, glue_name))
cprint("generating scheme glue %s ... %s", glue_name, "${color.success}${text.success}")
end, {
values = {true},
files = {filepath, path.join(build_glue_path, "build_glue.lua")},
always_changed = false
})
end
end)
end
function add_tm_configure(target_name, variables)
if target_name == "libmogan" then
add_configfiles("src/System/tm_configure.hpp.xmake", {
filename = "tm_configure.hpp",
pattern = "@(.-)@",
variables = variables
})
else
add_configfiles("src/System/tm_configure.hpp.xmake", {
filename = target_name .. "/tm_configure.hpp",
pattern = "@(.-)@",
variables = variables
})
end
end
--
-- Experimental options of Mogan
--
option("experimental")
set_description("Enable experimental style rewriting code")
set_default(false)
set_values(false, true)
option_end()
if has_config("experimental") then
set_configvar("EXPERIMENTAL", true)
end
option("sanity-checks")
set_description("Enable sanity checks")
set_default(false)
set_values(false, true)
option_end()
if has_config("sanity-checks") then
set_configvar("SANITY_CHECKS", true)
end
option("use-exceptions")
set_description("Use C++ exception mechanism")
set_default(false)
set_values(false, true)
option_end()
if has_config("use-exceptions") then
set_configvar("USE_EXCEPTIONS", true)
end
--
-- Library: L3 Kernel
--
includes ("xmake/L3.lua")
target("libkernel_l3") do
---------------------------------------------------------------------------
-- generate config files. see also:
-- * https://github.com/xmake-io/xmake/issues/320
-- * https://github.com/xmake-io/xmake/issues/342
---------------------------------------------------------------------------
add_configfiles("src/System/config_l3.h.xmake", {
filename = "L3/config.h",
variables = {
QTTEXMACS = false,
}
})
add_configfiles("src/System/tm_configure_l3.hpp.xmake", {
filename = "L3/tm_configure.hpp",
pattern = "@(.-)@",
variables = {
CONFIG_USER = CONFIG_USER,
CONFIG_OS = CONFIG_OS,
VERSION = TEXMACS_VERSION,
LOLLY_VERSION = LOLLY_VERSION,
XMACS_VERSION = XMACS_VERSION,
}
})
add_target_L3()
end
set_configvar("QTTEXMACS", 1)
local INSTALL_DIR = "$(buildir)"
if is_plat("mingw", "windows") then
INSTALL_DIR = path.join("$(buildir)", "packages/app.mogan/data/")
elseif is_plat("macosx") then
INSTALL_DIR = path.join("$(buildir)", "macosx/$(arch)/$(mode)/Mogan.app/Contents/Resources/")
else
if os.getenv("INSTALL_DIR") == nil then
INSTALL_DIR = path.join("$(buildir)", "packages/app.mogan/")
else
INSTALL_DIR = os.getenv("INSTALL_DIR")
end
end
local RUN_ENVS = {TEXMACS_PATH=path.join(os.projectdir(), "TeXmacs")}
if not is_plat("wasm") then
set_configvar("QTPIPES", 1)
set_configvar("USE_QT_PRINTER", 1)
end
set_configvar("USE_ICONV", 1)
set_configvar("USE_FREETYPE", 1)
set_configvar("USE_PLUGIN_PDF", true)
set_configvar("PDFHUMMUS_NO_TIFF", true)
set_configvar("USE_PLUGIN_BIBTEX", true)
set_configvar("USE_PLUGIN_LATEX_PREVIEW", true)
set_configvar("USE_PLUGIN_TEX", true)
set_configvar("USE_PLUGIN_ISPELL", true)
set_configvar("USE_PLUGIN_SPARKLE", false)
set_configvar("USE_PLUGIN_HTML", true)
set_configvar("TM_DYNAMIC_LINKING", false)
if is_plat("mingw", "windows") then
set_configvar("GS_EXE", "bin/gs.exe")
else
set_configvar("GS_EXE", "/usr/bin/gs")
end
if is_plat("macosx") then
set_configvar("AQUATEXMACS", true)
end
set_version(XMACS_VERSION, {build = "%Y-%m-%d"})
add_configfiles("src/System/config.h.xmake", {
filename = "config.h",
variables = {
GS_FONTS = "../share/ghostscript/fonts:/usr/share/fonts:",
GS_LIB = "../share/ghostscript/9.06/lib:",
NOMINMAX = is_plat("windows"),
MACOSX_EXTENSIONS = is_plat("macosx"),
SIZEOF_VOID_P = 8,
USE_FONTCONFIG = is_plat("linux"),
USE_STACK_TRACE = (not is_plat("mingw")) and (not is_plat("wasm")) and (not is_plat("windows")),
USE_PLUGIN_GS = not is_plat("wasm"),
}
})
libmogan_srcs = {
"src/Data/**.cpp",
"src/Edit/**.cpp",
"src/Graphics/**.cpp",
"src/Kernel/**.cpp",
"src/Scheme/Scheme/**.cpp",
"src/Scheme/S7/**.cpp",
"src/Scheme/L1/**.cpp",
"src/Scheme/L2/**.cpp",
"src/Scheme/L3/**.cpp",
"src/Scheme/L4/**.cpp",
"src/Scheme/L5/**.cpp",
"src/Scheme/Plugins/**.cpp",
"src/System/**.cpp",
"src/Texmacs/Data/**.cpp",
"src/Texmacs/Server/**.cpp",
"src/Texmacs/Window/**.cpp",
"src/Typeset/**.cpp",
}
libmogan_headers = {
"src/Data/Convert",
"src/Data/Document",
"src/Data/Drd",
"src/Data/History",
"src/Data/Observers",
"src/Data/Parser",
"src/Data/Scheme",
"src/Data/String",
"src/Data/Tree",
"src/Edit",
"src/Edit/Editor",
"src/Edit/Interface",
"src/Edit/Modify",
"src/Edit/Process",
"src/Edit/Replace",
"src/Graphics/Bitmap_fonts",
"src/Graphics/Colors",
"src/Graphics/Fonts",
"src/Graphics/Gui",
"src/Graphics/Handwriting",
"src/Graphics/Mathematics",
"src/Graphics/Pictures",
"src/Graphics/Renderer",
"src/Graphics/Spacial",
"src/Graphics/Types",
"src/Kernel/Abstractions",
"src/Kernel/Types",
"src/Plugins",
"src/Scheme",
"src/Scheme/S7",
"src/Scheme/L1",
"src/Scheme/L2",
"src/Scheme/L3",
"src/Scheme/L4",
"src/Scheme/L5",
"src/Scheme/Plugins",
"src/Scheme/Scheme",
"src/Style/Environment",
"src/Style/Evaluate",
"src/Style/Memorizer",
"src/System",
"src/System/Boot",
"src/System/Classes",
"src/System/Config",
"src/System/Files",
"src/System/Language",
"src/System/Link",
"src/System/Misc",
"src/Texmacs",
"src/Texmacs/Data",
"src/Typeset",
"src/Typeset/Bridge",
"src/Typeset/Concat",
"src/Typeset/Page",
"$(buildir)/glue",
"TeXmacs/include",
"src/Mogan"
}
plugin_qt_srcs_on_wasm = {
"src/Plugins/Qt/*.cpp|QTMPipeLink.cpp|QTMPrintDialog.cpp|QTMPrinterSettings.cpp|qt_printer_widget.cpp",
"src/Plugins/Qt/*.hpp|QTMPipeLink.hpp|QTMPrintDialog.hpp|QTMPrinterSettings.hpp",
}
plugin_qt_srcs = {
"src/Plugins/Qt/**.cpp",
"src/Plugins/Qt/**.hpp"
}
plugin_macos_srcs = {
"src/Plugins/MacOS/HIDRemote.m",
"src/Plugins/MacOS/mac_spellservice.mm",
"src/Plugins/MacOS/mac_utilities.mm",
"src/Plugins/MacOS/mac_app.mm"
}
plugin_pdf_srcs = { "src/Plugins/Pdf/**.cpp" }
plugin_xml_srcs = { "src/Plugins/Xml/**.cpp" }
plugin_html_srcs = { "src/Plugins/Html/**.cpp" }
plugin_database_srcs = { "src/Plugins/Database/**.cpp" }
plugin_freetype_srcs = { "src/Plugins/Freetype/**.cpp" }
plugin_metafont_srcs = { "src/Plugins/Metafont/**.cpp" }
plugin_ghostscript_srcs = { "src/Plugins/Ghostscript/**.cpp" }
plugin_ispell_srcs = { "src/Plugins/Ispell/**.cpp" }
plugin_tex_srcs = {"src/Plugins/Tex/**.cpp"}
plugin_latex_preview_srcs = {"src/Plugins/LaTeX_Preview/**.cpp"}
plugin_bibtex_srcs = { "src/Plugins/Bibtex/**.cpp" }
plugin_openssl_srcs = { "src/Plugins/Openssl/**.cpp" }
plugin_updater_srcs = { "src/Plugins/Updater/**.cpp" }
target("libmogan") do
set_enabled(not is_plat ("wasm"))
set_basename("mogan")
set_version(TEXMACS_VERSION, {build = "%Y-%m-%d"})
set_languages("c++17")
set_policy("check.auto_ignore_flags", false)
if is_plat("linux") then
add_rules("qt.shared")
set_installdir(INSTALL_DIR)
elseif is_plat("macosx") then
on_install(function (target)
print("No need to install libmogan on macOS")
end)
add_rules("qt.static")
else
add_rules("qt.static")
end
add_frameworks("QtGui", "QtWidgets", "QtCore", "QtPrintSupport", "QtSvg")
build_glue_on_config()
add_tm_configure("libmogan", TM_CONFIGURE_VARS)
add_packages("lolly")
add_packages("libiconv")
add_packages("freetype")
add_packages("pdfhummus")
add_packages("s7")
if is_plat("linux") then
add_packages("fontconfig")
end
if is_plat("mingw") then
add_syslinks("wsock32", "ws2_32", "crypt32","secur32", {public = true})
elseif is_plat("windows") then
add_syslinks("secur32", {public = true})
end
---------------------------------------------------------------------------
-- add source and header files
---------------------------------------------------------------------------
add_includedirs(libmogan_headers, {public = true})
add_includedirs("$(buildir)")
add_files(libmogan_srcs)
if is_plat("macosx") then
add_includedirs("src/Plugins/MacOS", {public = true})
add_files(plugin_macos_srcs)
end
add_files(plugin_qt_srcs)
add_files(plugin_bibtex_srcs)
add_files(plugin_freetype_srcs)
add_files(plugin_database_srcs)
add_files(plugin_ghostscript_srcs)
add_files(plugin_ispell_srcs)
add_files(plugin_metafont_srcs)
add_files(plugin_tex_srcs)
add_files(plugin_latex_preview_srcs)
add_files(plugin_openssl_srcs)
add_files(plugin_updater_srcs)
add_files(plugin_xml_srcs)
add_files(plugin_html_srcs)
add_files(plugin_pdf_srcs)
add_mxflags("-fno-objc-arc")
before_build(function (target)
target:add("forceincludes", path.absolute("$(buildir)/config.h"))
target:add("forceincludes", path.absolute("$(buildir)/tm_configure.hpp"))
end)
end
includes("xmake/tm2html.lua")
if not is_plat("wasm") then
target ("tm2html") do
set_version(XMACS_VERSION)
set_installdir(INSTALL_DIR)
set_configdir(INSTALL_DIR)
set_configvar("DEVEL_VERSION", DEVEL_VERSION)
set_configvar("PACKAGE", "Mogan Research")
set_configvar("XMACS_VERSION", XMACS_VERSION)
add_target_tm2html()
end
end
includes("xmake/draw.lua")
if is_plat("wasm", "linux") then
target("draw") do
set_version(XMACS_VERSION, {build = "%Y-%m-%d"})
add_tm_configure("draw", TM_CONFIGURE_VARS)
add_target_draw()
end
end
includes("xmake/code.lua")
if is_plat("wasm", "linux") then
target("code") do
set_version(XMACS_VERSION, {build = "%Y-%m-%d"})
add_tm_configure("code", TM_CONFIGURE_VARS)
add_target_code()
end
end
if is_plat("mingw", "windows") then
target("research_windows_icon") do
set_version(XMACS_VERSION)
set_kind("object")
add_configfiles("$(projectdir)/packages/windows/resource.rc.in", {
filename = "resource.rc"
})
add_configfiles("$(projectdir)/packages/windows/TeXmacs.ico", {
onlycopy = true
})
add_files("$(buildir)/resource.rc")
end
end
includes("xmake/research.lua")
target("research") do
set_version(XMACS_VERSION, {build = "%Y-%m-%d"})
if is_plat("wasm") then
add_tm_configure("research", TM_CONFIGURE_VARS)
add_target_research_on_wasm()
else
set_installdir(INSTALL_DIR)
set_configdir(INSTALL_DIR)
set_configvar("DEVEL_VERSION", DEVEL_VERSION)
set_configvar("XMACS_VERSION", XMACS_VERSION)
add_target_research_on_others()
on_run(function (target)
name = target:name()
if is_plat("mingw", "windows") then
os.execv(target:installdir().."/bin/MGResearch.exe")
elseif is_plat("linux", "macosx") then
print("Launching " .. target:targetfile())
os.execv(target:targetfile(), {}, {envs=RUN_ENVS})
else
print("Unsupported plat $(plat)")
end
end)
end
end
target("macos_installer") do
set_enabled(is_plat("macosx") and is_mode("release"))
set_kind("phony")
set_installdir(INSTALL_DIR)
if is_plat("macosx") then
add_deps("research")
end
after_install(function (target, opt)
local app_dir = target:installdir() .. "/../../"
os.execv("hdiutil create Mogan-v" .. XMACS_VERSION .. ".dmg -fs HFS+ -srcfolder " .. app_dir)
end)
end
target("windows_installer") do
set_kind("phony")
set_enabled(is_plat("mingw", "windows") and is_mode("release"))
add_packages("qtifw")
add_deps("research")
set_configvar("PACKAGE_DATE", os.date("%Y-%m-%d"))
set_configvar("XMACS_VERSION", XMACS_VERSION)
set_installdir("$(buildir)")
add_configfiles(
"packages/windows/(config/config.in.xml)",{
filename = "config.xml",
}
)
add_configfiles(
"packages/windows/(packages/app.mogan/meta/package.in.xml)",{
filename = "package.xml",
}
)
add_installfiles({
"packages/windows/packages/app.mogan/meta/installscript.qs",
"LICENSE"}, {prefixdir = "packages/app.mogan/meta/"})
add_installfiles({
"packages/windows/config/TeXmacs-small.png",
"packages/windows/config/TeXmacs-large.png",
"packages/windows/TeXmacs.ico",
}, {prefixdir = "config/"})
after_install(function (target, opt)
print("after_install of target windows_installer")
import("core.project.config")
import("lib.detect.find_tool")
local qtifw_dir = target:pkg("qtifw"):installdir()
local binarycreator_path = path.join(qtifw_dir, "/bin/binarycreator.exe")
-- generate windows package
local buildir = config.buildir()
local package_argv = {
"--config", path.join(buildir, "config/config.xml"),
"--packages", path.join(buildir, "packages"),
path.join(buildir, "Mogan-v"..XMACS_VERSION.."-64bit-installer.exe")
}
os.iorunv(binarycreator_path, package_argv)
end)
end
function add_test_target (filepath, dep)
local testname = path.basename(filepath)
target(testname) do
set_enabled(not is_plat("wasm"))
add_runenvs("TEXMACS_PATH", path.join(os.projectdir(), "TeXmacs"))
set_group("tests")
add_deps(dep)
set_languages("c++17")
set_policy("check.auto_ignore_flags", false)
if is_plat("windows") then
set_encodings("utf-8") -- eliminate warning C4819 on msvc
add_ldflags("/LTCG")
end
if is_plat("windows", "mingw") then
add_syslinks("secur32")
end
add_rules("qt.console")
add_frameworks("QtGui", "QtWidgets", "QtCore", "QtPrintSupport", "QtSvg", "QtTest")
if not is_plat("windows") then
add_syslinks("pthread")
end
if is_plat ("mingw") then
add_packages("mingw-w64")
end
add_packages("s7")
add_packages("lolly")
add_includedirs({"$(buildir)", "tests/Base"})
add_includedirs(libmogan_headers)
build_glue_on_config()
add_files("tests/Base/base.cpp")
add_files(filepath)
add_files(filepath, {rules = "qt.moc"})
before_build(function (target)
target:add("forceincludes", path.absolute("$(buildir)/config.h"))
end)
if is_plat("wasm") then
on_run(function (target)
node = os.getenv("EMSDK_NODE")
cmd = node .. " $(buildir)/wasm/wasm32/$(mode)/" .. testname .. ".js"
print("> " .. cmd)
os.exec(cmd)
end)
end
end
end
-- Tests in C++
l3_cpp_tests = os.files("tests/L3/**_test.cpp")
all_cpp_tests = os.files("tests/**_test.cpp")
for _, filepath in ipairs(l3_cpp_tests) do
add_test_target (filepath, "libkernel_l3")
end
for _, filepath in ipairs(all_cpp_tests) do
if not table.contains(l3_cpp_tests, filepath) then
add_test_target (filepath, "libmogan")
end
end
for _, filepath in ipairs(os.files("TeXmacs/tests/*.scm")) do
local testname = path.basename(filepath)
target(testname) do
set_enabled(not is_plat("wasm"))
set_kind("phony")
set_group("integration_tests")
add_deps("research")
on_run(function (target)
name = target:name()
params = {
"-headless",
"-b", path.join("TeXmacs","tests",name..".scm"),
"-x", "(test_"..name..")",
"-q"
}
if is_plat("macosx", "linux") then
binary = target:deps()["research"]:targetfile()
elseif is_plat("mingw", "windows") then
binary = path.join(INSTALL_DIR,"bin","MGResearch.exe")
else
print("Unsupported plat $(plat)")
end
cmd = binary
if is_plat("macosx", "linux") then
os.execv(cmd, params, {envs=RUN_ENVS})
else
os.execv(cmd, params)
end
end)
end
end
-- xmake plugins
add_configfiles(
"misc/doxygen/Doxyfile.in", {
filename = "doxyfile",
pattern = "@(.-)@",
variables = {
PACKAGE = "Mogan STEM Suite",
DOXYGEN_DIR = get_config("buildir"),
DEVEL_VERSION = DEVEL_VERSION,
}
}
)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。