mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-12-02 03:48:19 +08:00
for static link boost library
This commit is contained in:
parent
5900654ed1
commit
d733db32f8
@ -10,8 +10,11 @@
|
||||
#include "../Stock.h"
|
||||
#include "../Log.h"
|
||||
|
||||
namespace hku {
|
||||
#if HKU_SUPPORT_SERIALIZATION
|
||||
BOOST_CLASS_EXPORT(hku::IndicatorImp)
|
||||
#endif
|
||||
|
||||
namespace hku {
|
||||
|
||||
HKU_API std::ostream & operator<<(std::ostream& os, const IndicatorImp& imp) {
|
||||
os << "Indicator(" << imp.name() << ", " << imp.getParameter() << ")";
|
||||
|
@ -305,4 +305,5 @@ inline KData IndicatorImp::getContext() const {
|
||||
}
|
||||
|
||||
} /* namespace hku */
|
||||
|
||||
#endif /* INDICATORIMP_H_ */
|
||||
|
@ -21,14 +21,16 @@
|
||||
* @see test_all.cpp
|
||||
*/
|
||||
|
||||
#ifdef BOOST_TEST_DYN_LINK
|
||||
#define BOOST_TEST_MODULE test_all
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
// Linux下在Eclipse中编译必须使用下面的头文件(使用bjam不需要),否则提示无法找到“main“函数,原因未知
|
||||
// 但bjam编译时会有告警,虽然可以编译通过。
|
||||
// Windows下,如果使用下面的头文件将无法编译。
|
||||
#ifdef ECLIPSE_GCC
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#endif
|
||||
|
||||
using namespace boost::unit_test;
|
||||
|
||||
#else
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
std::cout << "using obsolete init" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
#endif /* #ifdef BOOST_TEST_DYN_LINK */
|
||||
|
@ -13,6 +13,8 @@ target("unit-test")
|
||||
set_kind("phony")
|
||||
end
|
||||
|
||||
--add_defines("BOOST_TEST_DYN_LINK")
|
||||
|
||||
add_packages("fmt", "spdlog")
|
||||
|
||||
add_includedirs("..")
|
||||
@ -56,6 +58,8 @@ target("small-test")
|
||||
add_packages("fmt", "spdlog")
|
||||
add_includedirs("..")
|
||||
|
||||
--add_defines("BOOST_TEST_DYN_LINK")
|
||||
|
||||
if is_plat("windows") then
|
||||
add_cxflags("-wd4267")
|
||||
add_cxflags("-wd4251")
|
||||
|
@ -10,6 +10,9 @@ option_end()
|
||||
|
||||
add_includedirs("../hikyuu_cpp")
|
||||
|
||||
-- Can't use static boost.python lib, the function that using 'arg' will load failed!
|
||||
--add_defines("BOOST_PYTHON_STATIC_LIB")
|
||||
|
||||
if is_plat("windows") then
|
||||
add_defines("HKU_API=__declspec(dllimport)")
|
||||
end
|
||||
|
@ -22,31 +22,31 @@ function main(target)
|
||||
if "hikyuu" == targetname then
|
||||
os.cp(targetfile, './hikyuu')
|
||||
if is_plat("windows") then
|
||||
os.cp("$(env BOOST_LIB)/boost_date_time*.dll", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/boost_filesystem*.dll", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/boost_date_time*.dll", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/boost_filesystem*.dll", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/boost_python3*.dll", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/boost_serialization*.dll", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/boost_system*.dll", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/boost_serialization*.dll", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/boost_system*.dll", './hikyuu')
|
||||
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/hdf5.pkg/lib/release/$(plat)/$(arch)/*.dll", './hikyuu')
|
||||
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/mysql.pkg/lib/release/$(plat)/$(arch)/*.dll", './hikyuu')
|
||||
return
|
||||
end
|
||||
|
||||
if is_plat("linux") then
|
||||
os.cp("$(env BOOST_LIB)/libboost_date_time*.so.*", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_filesystem*.so.*", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_date_time*.so.*", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_filesystem*.so.*", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_python3*.so.*", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_serialization*.so.*", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_system*.so.*", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_serialization*.so.*", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_system*.so.*", './hikyuu')
|
||||
return
|
||||
end
|
||||
|
||||
if is_plat("macosx") then
|
||||
os.cp("$(env BOOST_LIB)/libboost_date_time*.dylib", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_filesystem*.dylib", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_date_time*.dylib", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_filesystem*.dylib", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_python3*.dylib", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_serialization*.dylib", './hikyuu')
|
||||
os.cp("$(env BOOST_LIB)/libboost_system*.dylib", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_serialization*.dylib", './hikyuu')
|
||||
--os.cp("$(env BOOST_LIB)/libboost_system*.dylib", './hikyuu')
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -20,32 +20,32 @@ function main(target)
|
||||
end
|
||||
|
||||
if is_plat("windows") then
|
||||
os.cp("$(env BOOST_LIB)/boost_date_time*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/boost_filesystem*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/boost_serialization*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/boost_system*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/boost_unit_test_framework*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/boost_date_time*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/boost_filesystem*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/boost_serialization*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/boost_system*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/boost_unit_test_framework*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/hdf5.pkg/lib/release/$(plat)/$(arch)/*.dll","$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(projectdir)/hikyuu_extern_libs/pkg/mysql.pkg/lib/release/$(plat)/$(arch)/*.dll", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
end
|
||||
|
||||
if is_plat("linux") then
|
||||
os.cp("$(env BOOST_LIB)/libboost_date_time*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_filesystem*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_serialization*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_date_time*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_filesystem*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_serialization*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_system*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_unit_test_framework*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_unit_test_framework*.so.*", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
end
|
||||
|
||||
if is_plat("macosx") then
|
||||
os.cp("$(env BOOST_LIB)/libboost_date_time*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_filesystem*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_serialization*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_system*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_unit_test_framework*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_date_time*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_filesystem*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_serialization*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_system*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_unit_test_framework*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
-- macOSX下unit_test_framework依赖于timer和chrono
|
||||
os.cp("$(env BOOST_LIB)/libboost_timer*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
os.cp("$(env BOOST_LIB)/libboost_chrono*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_timer*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
--os.cp("$(env BOOST_LIB)/libboost_chrono*.dylib", "$(buildir)/$(mode)/$(plat)/$(arch)/lib/")
|
||||
end
|
||||
|
||||
end
|
10
setup.py
10
setup.py
@ -79,10 +79,16 @@ def build_boost():
|
||||
os.chdir(current_boost_root)
|
||||
if not os.path.exists('b2.exe'):
|
||||
os.system('bootstrap.bat')
|
||||
os.system('b2 release link=shared address-model=64 -j 4 --with-python --with-date_time --with-filesystem --with-system --with-serialization --with-test')
|
||||
os.system('b2 release link=static runtime-link=shared address-model=64 -j 4 --with-date_time'
|
||||
' --with-filesystem --with-system --with-serialization --with-test')
|
||||
os.system('b2 release link=shared runtime-link=shared address-model=64 -j 4 --with-python')
|
||||
os.chdir(current_dir)
|
||||
else:
|
||||
cmd = 'cd {boost} ; if [ ! -f "b2" ]; then ./bootstrap.sh ; fi; ./b2 release link=shared address-model=64 -j 4 --with-python --with-date_time --with-filesystem --with-system --with-serialization --with-test; cd {current}'.format(boost=current_boost_root, current=current_dir)
|
||||
cmd = 'cd {boost} ; if [ ! -f "b2" ]; then ./bootstrap.sh ; fi; '\
|
||||
'./b2 release link=shared address-model=64 -j 4 --with-python; '\
|
||||
'./b2 release link=static address-model=64 -j 4 --with-date_time '\
|
||||
'--with-filesystem --with-system --with-serialization --with-test; '\
|
||||
'cd {current}'.format(boost=current_boost_root, current=current_dir)
|
||||
os.system(cmd)
|
||||
|
||||
|
||||
|
@ -38,7 +38,8 @@ add_includedirs("hikyuu_extern_libs/inc")
|
||||
add_includedirs("$(env BOOST_ROOT)")
|
||||
add_linkdirs("$(env BOOST_LIB)")
|
||||
|
||||
add_defines("BOOST_ALL_DYN_LINK")
|
||||
-- modifed to use boost static library, except boost.python
|
||||
--add_defines("BOOST_ALL_DYN_LINK")
|
||||
|
||||
if is_host("linux") then
|
||||
if is_arch("x86_64") then
|
||||
@ -73,14 +74,14 @@ if is_plat("windows") then
|
||||
add_cxflags("-MD")
|
||||
elseif is_mode("debug") then
|
||||
add_cxflags("-Gs", "-RTC1")
|
||||
add_cxflags("-MDd")
|
||||
add_cxflags("-MDd")
|
||||
end
|
||||
end
|
||||
|
||||
if not is_plat("windows") then
|
||||
-- disable some compiler errors
|
||||
add_cxflags("-Wno-error=deprecated-declarations", "-fno-strict-aliasing")
|
||||
add_cxflags("-ftemplate-depth-500", "-pthread")
|
||||
add_cxflags("-ftemplate-depth=1023", "-pthread")
|
||||
add_shflags("-pthread")
|
||||
add_ldflags("-pthread")
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user