hikyuu2/xmake.lua

122 lines
3.8 KiB
Lua
Raw Normal View History

set_xmakever("2.5.4")
-- project
set_project("hikyuu")
2021-11-21 21:39:35 +08:00
add_rules("mode.debug", "mode.release")
2021-11-30 01:28:43 +08:00
if not is_plat("windows") then
add_rules("mode.coverage")
end
2021-11-21 21:39:35 +08:00
-- version
set_version("1.1.9", {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
set_configvar("CHECK_ACCESS_BOUND", 1)
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
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)
-- 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
-- set language: C99, c++ standard
2019-09-20 02:58:03 +08:00
set_languages("cxx17", "C99")
add_plugindirs("./xmake_plugins")
2020-09-28 17:17:37 +08:00
add_requires("fmt", {system=false, configs = {header_only = true, vs_runtime = "MD"}})
add_requires("spdlog", {system=false, configs = {header_only = true, fmt_external=true, vs_runtime = "MD"}})
add_requires("flatbuffers", {system=false, configs = {vs_runtime="MD"}})
2021-04-02 23:49:21 +08:00
add_requires("nng", {system=false, configs = {vs_runtime="MD", cxflags="-fPIC"}})
2021-03-28 00:53:51 +08:00
add_requires("nlohmann_json", {system=false})
add_requires("cpp-httplib", {system=false})
2021-06-09 02:11:42 +08:00
add_requires("zlib", {system=false})
2020-09-28 17:24:22 +08:00
if is_plat("linux") and linuxos.name() == "ubuntu" then
add_requires("apt::libhdf5-dev", "apt::libmysqlclient-dev", "apt::libsqlite3-dev")
elseif is_plat("macosx") then
add_requires("brew::hdf5")
else
add_requires("sqlite3", {configs = {shared=true, vs_runtime="MD", cxflags="-fPIC"}})
end
add_defines("SPDLOG_DISABLE_DEFAULT_LOGGER") -- 禁用 spdlog 默认 logger
set_objectdir("$(buildir)/$(mode)/$(plat)/$(arch)/.objs")
set_targetdir("$(buildir)/$(mode)/$(plat)/$(arch)/lib")
add_includedirs("$(env BOOST_ROOT)")
add_linkdirs("$(env BOOST_LIB)")
-- modifed to use boost static library, except boost.python, serialization
--add_defines("BOOST_ALL_DYN_LINK")
add_defines("BOOST_SERIALIZATION_DYN_LINK")
2018-09-09 16:43:04 +08:00
if is_host("linux") then
if is_arch("x86_64") then
2020-09-28 17:17:37 +08:00
add_linkdirs("/usr/lib64")
2018-09-09 16:43:04 +08:00
add_linkdirs("/usr/lib/x86_64-linux-gnu")
end
end
-- is release now
if is_mode("release") then
if is_plat("windows") then
--Unix-like systems hidden symbols will cause the link dynamic libraries to failed!
set_symbols("hidden")
end
end
-- for the windows platform (msvc)
if is_plat("windows") then
add_packagedirs("./hikyuu_extern_libs/pkg")
-- 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")
add_cxflags("-wd4819") --template dll export warning
2019-10-01 18:53:37 +08:00
add_defines("WIN32_LEAN_AND_MEAN")
if is_mode("release") then
add_cxflags("-MD")
elseif is_mode("debug") then
2020-01-09 00:11:37 +08:00
add_cxflags("-Gs", "-RTC1", "/bigobj")
2019-10-19 22:25:06 +08:00
add_cxflags("-MDd")
end
2019-09-22 23:02:08 +08:00
end
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")
end
--add_vectorexts("sse", "sse2", "sse3", "ssse3", "mmx", "avx")
add_subdirs("./hikyuu_cpp/hikyuu")
add_subdirs("./hikyuu_pywrap")
add_subdirs("./hikyuu_cpp/unit_test")
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
before_install("scripts.before_install")
on_install("scripts.on_install")
before_run("scripts.before_run")