2021-05-19 01:27:41 +08:00
|
|
|
|
set_xmakever("2.5.4")
|
2023-06-14 16:37:10 +08:00
|
|
|
|
-- Last Modified: 2023-06-14 14:01:23
|
2018-11-17 20:22:06 +08:00
|
|
|
|
|
2018-08-19 16:51:10 +08:00
|
|
|
|
-- project
|
|
|
|
|
set_project("hikyuu")
|
|
|
|
|
|
2021-11-21 21:39:35 +08:00
|
|
|
|
add_rules("mode.debug", "mode.release")
|
2023-06-14 16:37:10 +08:00
|
|
|
|
if not is_plat("windows") then
|
2021-12-02 00:07:09 +08:00
|
|
|
|
add_rules("mode.coverage", "mode.asan", "mode.msan", "mode.tsan", "mode.lsan")
|
2021-11-30 01:28:43 +08:00
|
|
|
|
end
|
2021-11-21 21:39:35 +08:00
|
|
|
|
|
2018-08-19 16:51:10 +08:00
|
|
|
|
-- version
|
2023-06-14 16:37:10 +08:00
|
|
|
|
set_version("1.2.7", {build = "%Y%m%d%H%M"})
|
|
|
|
|
set_configvar("LOG_ACTIVE_LEVEL", 0) -- 激活的日志级别
|
|
|
|
|
-- if is_mode("debug") then
|
|
|
|
|
-- set_configvar("LOG_ACTIVE_LEVEL", 0) -- 激活的日志级别
|
|
|
|
|
-- else
|
|
|
|
|
-- set_configvar("LOG_ACTIVE_LEVEL", 2) -- 激活的日志级别
|
|
|
|
|
-- end
|
2020-05-19 23:31:19 +08:00
|
|
|
|
set_configvar("USE_SPDLOG_LOGGER", 1) -- 是否使用spdlog作为日志输出
|
2020-04-10 01:54:49 +08:00
|
|
|
|
set_configvar("USE_SPDLOG_ASYNC_LOGGER", 0) -- 使用异步的spdlog
|
2019-06-16 20:49:20 +08:00
|
|
|
|
set_configvar("CHECK_ACCESS_BOUND", 1)
|
2023-06-14 16:37:10 +08:00
|
|
|
|
if is_plat("macosx") then
|
2020-08-15 15:51:08 +08:00
|
|
|
|
set_configvar("SUPPORT_SERIALIZATION", 0)
|
|
|
|
|
else
|
|
|
|
|
set_configvar("SUPPORT_SERIALIZATION", is_mode("release") and 1 or 0)
|
|
|
|
|
end
|
2019-06-16 20:49:20 +08:00
|
|
|
|
set_configvar("SUPPORT_TEXT_ARCHIVE", 0)
|
|
|
|
|
set_configvar("SUPPORT_XML_ARCHIVE", 1)
|
|
|
|
|
set_configvar("SUPPORT_BINARY_ARCHIVE", 1)
|
2019-12-15 01:25:00 +08:00
|
|
|
|
set_configvar("HKU_DISABLE_ASSERT", 0)
|
2018-08-19 16:51:10 +08:00
|
|
|
|
|
|
|
|
|
-- set warning all as error
|
2019-09-22 10:57:09 +08:00
|
|
|
|
if is_plat("windows") then
|
|
|
|
|
set_warnings("all", "error")
|
2019-09-22 16:01:15 +08:00
|
|
|
|
else
|
2019-09-22 10:57:09 +08:00
|
|
|
|
set_warnings("all")
|
|
|
|
|
end
|
2018-08-19 16:51:10 +08:00
|
|
|
|
|
|
|
|
|
-- set language: C99, c++ standard
|
2023-03-16 00:03:51 +08:00
|
|
|
|
set_languages("cxx17", "c99")
|
2018-08-19 16:51:10 +08:00
|
|
|
|
|
2023-04-29 01:25:55 +08:00
|
|
|
|
local boost_version = "1.81.0"
|
2022-10-18 01:35:53 +08:00
|
|
|
|
local hdf5_version = "1.12.2"
|
2022-11-13 01:48:37 +08:00
|
|
|
|
local mysql_version = "8.0.31"
|
2023-06-14 16:37:10 +08:00
|
|
|
|
if is_plat("windows") or (is_plat("linux", "cross") and is_arch("aarch64", "arm64.*")) then
|
2022-11-13 01:48:37 +08:00
|
|
|
|
mysql_version = "8.0.21"
|
|
|
|
|
end
|
2022-11-09 01:11:07 +08:00
|
|
|
|
|
|
|
|
|
add_repositories("project-repo hikyuu_extern_libs")
|
2022-01-06 00:41:15 +08:00
|
|
|
|
if is_plat("windows") then
|
2022-11-09 01:11:07 +08:00
|
|
|
|
-- add_repositories("project-repo hikyuu_extern_libs")
|
2022-01-06 00:41:15 +08:00
|
|
|
|
if is_mode("release") then
|
|
|
|
|
add_requires("hdf5 " .. hdf5_version)
|
|
|
|
|
else
|
|
|
|
|
add_requires("hdf5_D " .. hdf5_version)
|
|
|
|
|
end
|
|
|
|
|
add_requires("mysql " .. mysql_version)
|
2023-03-25 23:59:56 +08:00
|
|
|
|
elseif is_plat("linux", "cross") then
|
2022-11-15 01:22:25 +08:00
|
|
|
|
add_requires("hdf5 " .. hdf5_version, {system = false})
|
|
|
|
|
add_requires("mysql " .. mysql_version, {system = false})
|
2022-11-15 00:42:08 +08:00
|
|
|
|
elseif is_plat("macosx") then
|
2023-03-29 23:20:44 +08:00
|
|
|
|
add_requires("brew::hdf5")
|
2022-01-06 00:41:15 +08:00
|
|
|
|
end
|
2023-03-27 02:37:01 +08:00
|
|
|
|
|
2023-06-14 16:37:10 +08:00
|
|
|
|
add_requires("boost " .. boost_version, {
|
|
|
|
|
system = false,
|
2023-03-26 17:27:51 +08:00
|
|
|
|
configs = {
|
2023-06-14 16:37:10 +08:00
|
|
|
|
shared = is_plat("windows") and true or false,
|
|
|
|
|
vs_runtime = "MD",
|
|
|
|
|
data_time = true,
|
|
|
|
|
filesystem = true,
|
|
|
|
|
serialization = true,
|
|
|
|
|
system = true,
|
|
|
|
|
python = true,
|
|
|
|
|
pyver = get_config("pyver")
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-04-19 00:52:30 +08:00
|
|
|
|
|
2022-08-18 01:38:34 +08:00
|
|
|
|
-- add_requires("fmt 8.1.1", {system=false, configs = {header_only = true}})
|
2023-06-14 16:37:10 +08:00
|
|
|
|
add_requires("spdlog", {system = false, configs = {header_only = true, fmt_external = true, vs_runtime = "MD"}})
|
2022-08-18 01:38:34 +08:00
|
|
|
|
add_requireconfs("spdlog.fmt", {override = true, version = "8.1.1", configs = {header_only = true}})
|
2023-06-14 16:37:10 +08:00
|
|
|
|
add_requires("sqlite3", {system = false, configs = {shared = true, vs_runtime = "MD", cxflags = "-fPIC"}})
|
|
|
|
|
add_requires("flatbuffers 2.0.0", {system = false, configs = {vs_runtime = "MD"}})
|
|
|
|
|
add_requires("nng", {system = false, configs = {vs_runtime = "MD", cxflags = "-fPIC"}})
|
|
|
|
|
add_requires("nlohmann_json", {system = false})
|
|
|
|
|
add_requires("cpp-httplib", {system = false})
|
|
|
|
|
add_requires("zlib", {system = false})
|
2020-09-28 17:24:22 +08:00
|
|
|
|
|
2023-06-14 16:37:10 +08:00
|
|
|
|
add_defines("SPDLOG_DISABLE_DEFAULT_LOGGER") -- 禁用 spdlog 默认ogger
|
2019-08-03 21:53:24 +08:00
|
|
|
|
|
2018-08-19 16:51:10 +08:00
|
|
|
|
set_objectdir("$(buildir)/$(mode)/$(plat)/$(arch)/.objs")
|
|
|
|
|
set_targetdir("$(buildir)/$(mode)/$(plat)/$(arch)/lib")
|
|
|
|
|
|
2020-11-01 12:28:23 +08:00
|
|
|
|
-- modifed to use boost static library, except boost.python, serialization
|
2023-04-21 01:16:22 +08:00
|
|
|
|
if is_plat("windows") then
|
|
|
|
|
add_defines("BOOST_ALL_DYN_LINK")
|
|
|
|
|
end
|
2018-08-19 16:51:10 +08:00
|
|
|
|
|
|
|
|
|
-- is release now
|
|
|
|
|
if is_mode("release") then
|
|
|
|
|
if is_plat("windows") then
|
2023-06-14 16:37:10 +08:00
|
|
|
|
-- Unix-like systems hidden symbols will cause the link dynamic libraries to failed!
|
|
|
|
|
set_symbols("hidden")
|
2018-08-19 16:51:10 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- for the windows platform (msvc)
|
2023-06-14 16:37:10 +08:00
|
|
|
|
if is_plat("windows") then
|
2018-08-19 16:51:10 +08:00
|
|
|
|
-- add some defines only for windows
|
|
|
|
|
add_defines("NOCRYPT", "NOGDI")
|
2020-06-26 21:39:53 +08:00
|
|
|
|
add_cxflags("-EHsc", "/Zc:__cplusplus", "/utf-8")
|
2023-06-14 16:37:10 +08:00
|
|
|
|
add_cxflags("-wd4819") -- template dll export warning
|
2019-10-01 18:53:37 +08:00
|
|
|
|
add_defines("WIN32_LEAN_AND_MEAN")
|
2018-08-19 16:51:10 +08:00
|
|
|
|
if is_mode("release") then
|
2023-06-14 16:37:10 +08:00
|
|
|
|
add_cxflags("-MD")
|
2018-08-19 16:51:10 +08:00
|
|
|
|
elseif is_mode("debug") then
|
2023-06-14 16:37:10 +08:00
|
|
|
|
add_cxflags("-Gs", "-RTC1", "/bigobj")
|
2019-10-19 22:25:06 +08:00
|
|
|
|
add_cxflags("-MDd")
|
2018-08-19 16:51:10 +08:00
|
|
|
|
end
|
2023-06-14 16:37:10 +08:00
|
|
|
|
end
|
2019-09-22 23:02:08 +08:00
|
|
|
|
|
|
|
|
|
if not is_plat("windows") then
|
|
|
|
|
-- disable some compiler errors
|
|
|
|
|
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
|
2019-10-19 22:25:06 +08:00
|
|
|
|
add_cxflags("-ftemplate-depth=1023", "-pthread")
|
2019-09-22 23:02:08 +08:00
|
|
|
|
add_shflags("-pthread")
|
|
|
|
|
add_ldflags("-pthread")
|
2018-08-19 16:51:10 +08:00
|
|
|
|
end
|
2023-06-14 16:37:10 +08:00
|
|
|
|
--
|
|
|
|
|
-- add_vectorexts("sse", "sse2", "sse3", "ssse3", "mmx", "avx")
|
|
|
|
|
if not is_plat("cross") and (os.host() == "linux" and is_arch("x86_64", "i386")) then
|
|
|
|
|
-- fedora或者ubuntu,并且不是交叉编译
|
|
|
|
|
add_vectorexts("sse", "sse2", "ssse3", "avx", "avx2")
|
|
|
|
|
end
|
2018-08-19 16:51:10 +08:00
|
|
|
|
|
|
|
|
|
add_subdirs("./hikyuu_cpp/hikyuu")
|
|
|
|
|
add_subdirs("./hikyuu_pywrap")
|
|
|
|
|
add_subdirs("./hikyuu_cpp/unit_test")
|
2018-09-12 01:14:16 +08:00
|
|
|
|
add_subdirs("./hikyuu_cpp/demo")
|
2021-02-28 01:05:03 +08:00
|
|
|
|
add_subdirs("./hikyuu_cpp/hikyuu_server")
|
2018-09-09 16:43:04 +08:00
|
|
|
|
|
2018-09-12 01:14:16 +08:00
|
|
|
|
before_install("scripts.before_install")
|
|
|
|
|
on_install("scripts.on_install")
|
|
|
|
|
before_run("scripts.before_run")
|