mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-11-30 10:59:43 +08:00
linux编译
This commit is contained in:
parent
a6791d1308
commit
83f75009b7
1
.gitignore
vendored
1
.gitignore
vendored
@ -35,5 +35,6 @@
|
||||
/project/msvc10/output
|
||||
/project/msvc10/ipch
|
||||
/project/msvc
|
||||
/hikyuu_extern_libs
|
||||
*~
|
||||
|
||||
|
@ -45,7 +45,6 @@ project : default-build release
|
||||
|
||||
build-project libs/hikyuu_utils ;
|
||||
build-project libs/hikyuu ;
|
||||
#build-project libs/galaxy_instance ;
|
||||
build-project libs/hikyuu_python ;
|
||||
build-project test ;
|
||||
#build-project test ;
|
||||
build-project tools/importdata ;
|
||||
|
38
build.sh
38
build.sh
@ -1,35 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
#cp boost-build.jam.linux boost-build.jam
|
||||
#cp Jamroot.linux Jamroot
|
||||
cp boost-build.jam.linux boost-build.jam
|
||||
cp Jamroot.linux Jamroot
|
||||
|
||||
bjam -j 4 link=shared
|
||||
b2 -j 4 link=shared
|
||||
|
||||
work_dir=/home/fasiondog/workspace/hikyuu
|
||||
build_dir=$work_dir/build
|
||||
#toolset=clang-linux-3.8
|
||||
toolset = gcc-5.4.0
|
||||
toolset=gcc-5.4.0
|
||||
|
||||
#cd ./libs
|
||||
#doxygen
|
||||
#cd ..
|
||||
|
||||
cp -s -v -f $build_dir/hikyuu_python/$toolset/release/*.so $work_dir/tools/hikyuu
|
||||
cp -s -v -f $build_dir/hikyuu_python/$toolset/release/indicator/*.so $work_dir/tools/hikyuu/indicator
|
||||
cp -s -v -f $build_dir/hikyuu_python/$toolset/release/trade_manage/*.so $work_dir/tools/hikyuu/trade_manage
|
||||
cp -s -v -f $build_dir/hikyuu_python/$toolset/release/trade_sys/*.so $work_dir/tools/hikyuu/trade_sys
|
||||
rm -v -f ./tools/hikyuu/*.so
|
||||
|
||||
cp -s -v -f $build_dir/hikyuu/$toolset/release/*.so $work_dir/bin
|
||||
cp -s -v -f $build_dir/hikyuu_utils/$toolset/release/*.so $work_dir/bin
|
||||
cp -v -f ./build/hikyuu_python/$toolset/release/_hikyuu.so ./tools/hikyuu
|
||||
cp -v -f ./build/hikyuu_python/$toolset/release/indicator/_indicator.so ./tools/hikyuu/indicator
|
||||
cp -v -f ./build/hikyuu_python/$toolset/release/trade_manage/_trade_manage.so ./tools/hikyuu/trade_manage
|
||||
cp -v -f ./build/hikyuu_python/$toolset/release/trade_sys/_trade_sys.so ./tools/hikyuu/trade_sys
|
||||
cp -v -f ./build/hikyuu_python/$toolset/release/trade_instance/_trade_instance.so ./tools/hikyuu/trade_instance
|
||||
|
||||
cp -s -v -f $work_dir/bin/*.so /home/fasiondog/lib
|
||||
|
||||
python $work_dir/tools/hikyuu/test/test.py
|
||||
cp -v -f ./build/hikyuu/$toolset/release/libhikyuu.so ./tools/hikyuu
|
||||
cp -v -f ./build/hikyuu_utils/$toolset/release/libhikyuu_utils.so ./tools/hikyuu
|
||||
|
||||
cp -v -f ./hikyuu_extern_libs/linux64/*.so ./tools/hikyuu
|
||||
|
||||
cd ./test
|
||||
b2 -j 4 link=shared
|
||||
cd ..
|
||||
|
||||
#python $work_dir/tools/hikyuu/test/test.py
|
||||
|
||||
#cp -s -v -f $build_dir/hikyuu/$toolset/release/*.so $work_dir/tools/cstock/cstock
|
||||
#cp -s -v -f $build_dir/cstock/$toolset/release/indicator/*.so $work_dir/tools/cstock/cstock/indicator
|
||||
#cp -s -v -f $build_dir/cstock/$toolset/release/tradesys/*.so $work_dir/tools/cstock/cstock/tradesys
|
||||
#cp -s -v -f $build_dir/cstock/$toolset/release/instance/*.so $work_dir/tools/cstock/cstock/instance
|
||||
|
||||
|
||||
|
||||
|
@ -35,11 +35,12 @@ lib hikyuu : [ glob-tree *.cpp ]
|
||||
lib hikyuu : [ glob-tree *.cpp ]
|
||||
/usr/lib/x86_64-linux-gnu/libsqlite3.so
|
||||
/usr/lib/x86_64-linux-gnu/libpthread.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5_hl.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5_cpp.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5_hl_cpp.so
|
||||
/usr/lib/liblog4cplus.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_serial.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_serial_hl.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_cpp.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_hl_cpp.so
|
||||
../../hikyuu_extern_libs/linux64/liblog4cplus.so
|
||||
../../hikyuu_extern_libs/linux64/libmysqlclient.so
|
||||
: <toolset>clang
|
||||
;
|
||||
|
||||
|
@ -134,7 +134,7 @@ bool SQLiteBaseInfoDriver::loadStockTypeInfo(StockTypeInfoMap& out) {
|
||||
//from stockTypeInfo
|
||||
int SQLiteBaseInfoDriver::_getStockTypeInfoTableCallBack(
|
||||
void *out, int nCol, char **azVals, char **azCols){
|
||||
assert(nCol == 6);
|
||||
assert(nCol == 7);
|
||||
int result = 0;
|
||||
try{
|
||||
hku_uint32 type = boost::lexical_cast<hku_uint32>(azVals[0]);
|
||||
|
@ -9,6 +9,9 @@
|
||||
|
||||
#if defined(BOOST_WINDOWS)
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <iconv.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace hku {
|
||||
@ -198,6 +201,35 @@ string HKU_API gb_to_utf8(const string& szinput) {
|
||||
return gb_to_utf8(szinput.c_str());
|
||||
}
|
||||
|
||||
#else /* else for defined(BOOST_WINDOWS) */
|
||||
string HKU_API utf8_to_gb(const string& szinput) {
|
||||
char *inbuf=const_cast<char*>(szinput.c_str());
|
||||
size_t inlen = strlen(inbuf);
|
||||
size_t outlen = inlen;
|
||||
char *outbuf = (char *)malloc(outlen);
|
||||
memset(outbuf, 0, outlen);
|
||||
char *in = inbuf;
|
||||
char *out = outbuf;
|
||||
iconv_t cd=iconv_open("UTF8","GB2312");
|
||||
iconv(cd, &in, &inlen, &out, &outlen);
|
||||
iconv_close(cd);
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
string HKU_API gb_to_utf8(const string& szinput) {
|
||||
char *inbuf=const_cast<char*>(szinput.c_str());
|
||||
size_t inlen = strlen(inbuf);
|
||||
size_t outlen = (inlen + 1) * 4;
|
||||
char *outbuf = (char *)malloc(outlen);
|
||||
memset(outbuf, 0, outlen);
|
||||
char *in = inbuf;
|
||||
char *out = outbuf;
|
||||
iconv_t cd=iconv_open("GB2312","UTF8");
|
||||
iconv(cd, &in, &inlen, &out, &outlen);
|
||||
iconv_close(cd);
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
#endif /* defined(BOOST_WINDOWS) */
|
||||
|
||||
} /*namespace*/
|
||||
|
@ -34,6 +34,9 @@ string HKU_API utf8_to_gb(const char* szinput);
|
||||
string HKU_API utf8_to_gb(const string& szinput);
|
||||
string HKU_API gb_to_utf8(const char* szinput);
|
||||
string HKU_API gb_to_utf8(const string& szinput);
|
||||
#else
|
||||
string HKU_API utf8_to_gb(const string& szinput);
|
||||
string HKU_API gb_to_utf8(const string& szinput);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
11
test/Jamfile
11
test/Jamfile
@ -26,5 +26,16 @@ project : requirements <library>/boost//filesystem
|
||||
|
||||
unit-test test_all_in_one : [ glob-tree *.cpp ]
|
||||
../extern-libs/log4cplus/dll/log4cplus.lib
|
||||
: <toolset>msvc
|
||||
: <define>TEST_ALL_IN_ONE ;
|
||||
|
||||
unit-test test_all_in_one : [ glob-tree *.cpp ]
|
||||
../hikyuu_extern_libs/linux64/liblog4cplus.so
|
||||
: <toolset>gcc
|
||||
: <define>TEST_ALL_IN_ONE ;
|
||||
|
||||
unit-test test_all_in_one : [ glob-tree *.cpp ]
|
||||
../hikyuu_extern_libs/linux64/liblog4cplus.so
|
||||
: <toolset>clang
|
||||
: <define>TEST_ALL_IN_ONE ;
|
||||
|
||||
|
@ -1,18 +1,127 @@
|
||||
[database]
|
||||
baseinfo = /home/fasiondog/workspace/hikyuu/test/data/stock.db
|
||||
kdata = /home/fasiondog/workspace/hikyuu/test/data
|
||||
|
||||
[tmpdir]
|
||||
tmpdir = /home/fasiondog/workspace/hikyuu/test/data/tmp
|
||||
tmpdir = ./data/tmp
|
||||
|
||||
[block]
|
||||
type = qianlong
|
||||
dir = ./data/block
|
||||
指数板块 = zsbk.ini
|
||||
行业板块 = hybk.ini
|
||||
地域板块 = dybk.ini
|
||||
概念板块 = gnbk.ini
|
||||
self = self.ini
|
||||
|
||||
[logger]
|
||||
properties = /home/fasiondog/workspace/hikyuu/test/data/logger.properties
|
||||
properties = ./data/logger.properties
|
||||
|
||||
[preload]
|
||||
day = true
|
||||
week = false
|
||||
month = false
|
||||
quarter = false
|
||||
halfyear = false
|
||||
year = false
|
||||
day = 1
|
||||
week = 0
|
||||
month = 0
|
||||
quarter = 0
|
||||
halfyear = 0
|
||||
year = 0
|
||||
|
||||
[baseinfo]
|
||||
type = sqlite3
|
||||
db = ./data/stock.db
|
||||
|
||||
[sh_day]
|
||||
type = hdf5
|
||||
file = ./data/sh_day.h5
|
||||
;type = mysql
|
||||
;host = 127.0.0.1
|
||||
;port = 3306
|
||||
;usr = root
|
||||
;database = test_sh_day
|
||||
|
||||
[sh_week]
|
||||
type = hdf5
|
||||
file = ./data/sh_day.h5
|
||||
|
||||
[sh_month]
|
||||
type = hdf5
|
||||
file = ./data/sh_day.h5
|
||||
|
||||
[sh_quarter]
|
||||
type = hdf5
|
||||
file = ./data/sh_day.h5
|
||||
|
||||
[sh_halfyear]
|
||||
type = hdf5
|
||||
file = ./data/sh_day.h5
|
||||
|
||||
[sh_year]
|
||||
type = hdf5
|
||||
file = ./data/sh_day.h5
|
||||
|
||||
[sh_1min]
|
||||
type = hdf5
|
||||
file = ./data/sh_1min.h5
|
||||
|
||||
[sh_5min]
|
||||
type = hdf5
|
||||
file = ./data/sh_5min.h5
|
||||
|
||||
[sh_15min]
|
||||
type = hdf5
|
||||
file = ./data/sh_5min.h5
|
||||
|
||||
[sh_30min]
|
||||
type = hdf5
|
||||
file = ./data/sh_5min.h5
|
||||
|
||||
[sh_60min]
|
||||
type = hdf5
|
||||
file = ./data/sh_5min.h5
|
||||
|
||||
|
||||
|
||||
;深圳证券
|
||||
[sz_day]
|
||||
type = hdf5
|
||||
file = ./data/sz_day.h5
|
||||
;type = mysql
|
||||
;host = 127.0.0.1
|
||||
;port = 3306
|
||||
;usr = root
|
||||
;database = test_sz_day
|
||||
|
||||
[sz_week]
|
||||
type = hdf5
|
||||
file = ./data/sz_day.h5
|
||||
|
||||
[sz_month]
|
||||
type = hdf5
|
||||
file = ./data/sz_day.h5
|
||||
|
||||
[sz_quarter]
|
||||
type = hdf5
|
||||
file = ./data/sz_day.h5
|
||||
|
||||
[sz_halfyear]
|
||||
type = hdf5
|
||||
file = ./data/sz_day.h5
|
||||
|
||||
[sz_year]
|
||||
type = hdf5
|
||||
file = ./data/sz_day.h5
|
||||
|
||||
[sz_1min]
|
||||
type = hdf5
|
||||
file = ./data/sz_1min.h5
|
||||
|
||||
[sz_5min]
|
||||
type = hdf5
|
||||
file = ./data/sz_5min.h5
|
||||
|
||||
[sz_15min]
|
||||
type = hdf5
|
||||
file = ./data/sz_5min.h5
|
||||
|
||||
[sz_30min]
|
||||
type = hdf5
|
||||
file = ./data/sz_5min.h5
|
||||
|
||||
[sz_60min]
|
||||
type = hdf5
|
||||
file = ./data/sz_5min.h5
|
||||
|
@ -24,6 +24,8 @@ GConfig::GConfig() {
|
||||
#if defined(BOOST_WINDOWS)
|
||||
hikyuu_init(current.string() + "/hikyuu_win.ini");
|
||||
#else
|
||||
std::cout << "当前路径: " << current_path() << std::endl;
|
||||
std::cout << "配置文件: " << current.string() << "/hikyuu_linux.ini" << std::endl;
|
||||
hikyuu_init(current.string() + "/hikyuu_linux.ini");
|
||||
#endif
|
||||
}
|
||||
|
@ -139,8 +139,13 @@ BOOST_AUTO_TEST_CASE( test_StockManager_getAllMarket ) {
|
||||
/** @arg 检测测试数据中的Market */
|
||||
MarketList result(sm.getAllMarket());
|
||||
BOOST_CHECK(result.size() == 2);
|
||||
#if defined(BOOST_WINDOWS)
|
||||
BOOST_CHECK(result[0] == "SH");
|
||||
BOOST_CHECK(result[1] == "SZ");
|
||||
#else
|
||||
BOOST_CHECK(result[0] == "SZ");
|
||||
BOOST_CHECK(result[1] == "SH");
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @par 检测点 */
|
||||
|
@ -30,10 +30,10 @@ exe importdata : [ glob-tree *.cpp ]
|
||||
exe importdata : [ glob-tree *.cpp ]
|
||||
/usr/lib/x86_64-linux-gnu/libsqlite3.so
|
||||
/usr/lib/x86_64-linux-gnu/libpthread.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5_hl.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5_cpp.so
|
||||
/usr/lib/x86_64-linux-gnu/libhdf5_hl_cpp.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_serial.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_serial_hl.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_cpp.so
|
||||
../../hikyuu_extern_libs/linux64/libhdf5_hl_cpp.so
|
||||
: <toolset>clang
|
||||
<define>H5_USE_16_API
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user