ubuntu编译

This commit is contained in:
fasiondog 2017-06-17 16:59:15 +08:00
parent b446ab548a
commit 3b2a275f2e
26 changed files with 96 additions and 68 deletions

View File

@ -3,7 +3,8 @@
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# MSVC configuration
using clang ;
using gcc ;
#using clang ;
#using msvc : : : <compileflags>/wd4819 ;
#using msvc ;
@ -13,23 +14,21 @@ using clang ;
# Specify the path to the Boost project. If you move this project,
# adjust this path to refer to the Boost root directory.
use-project boost
: /home/fasiondog/src/boost ;
# : d:\\src\\boost ;
import os ;
path-constant BOOST_ROOT : [ os.environ BOOST_ROOT ] ;
use-project boost : $(BOOST_ROOT) ;
#指定boost头文件所在目录根据需要进行修改
BOOST_INCLUDE_DIR = /home/fasiondog/src/boost ;
BOOST_INCLUDE_DIR = $(BOOST_ROOT) ;
#工程所在目录,根据需要修改
HKU_DIR = /home/fasiondog/workspace/hikyuu ;
HKU_DIR = . ;
#该变量不需要修改
HKU_INCLUDE_DIR = $(HKU_DIR)/libs ;
use-project /hikyuu : $(HKU_DIR)/libs/hikyuu ;
#use-project /fsd_galaxy_instance : $(FSD_DIR)/libs/galaxy_instance ;
use-project /hikyuu_utils : $(HKU_DIR)/libs/hikyuu_utils ;
#use-project /sqlite3 : $(HKU_DIR)/extern-libs/sqlite3 ;
# project : default-build release ;
project : default-build release

View File

@ -4,4 +4,4 @@
# Edit this path to point at the tools/build/v2 subdirectory of your
# Boost installation. Absolute paths work, too.
boost-build /home/fasiondog/src/boost/tools/build/v2 ;
boost-build $(BOOST_ROOT)/tools/build/src/kernel ;

7
build.sh Normal file → Executable file
View File

@ -1,13 +1,14 @@
#!/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
work_dir=/home/fasiondog/workspace/hikyuu
build_dir=$work_dir/build
toolset=clang-linux-3.3
#toolset=clang-linux-3.8
toolset = gcc-5.4.0
#cd ./libs
#doxygen

View File

@ -23,11 +23,12 @@ project : requirements <library>/boost//date_time
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>gcc
;

View File

@ -8,7 +8,12 @@
#ifndef MYSQLBASEINFODRIVER_H_
#define MYSQLBASEINFODRIVER_H_
#include <mysql.h>
#if defined(BOOST_WINDOWS)
#include <mysql.h>
#else
#include <mysql/mysql.h>
#endif
#include "../../BaseInfoDriver.h"
namespace hku {

View File

@ -13,7 +13,7 @@
#if defined(BOOST_MSVC)
#include <cpp/H5Cpp.h>
#else
#include <H5Cpp.h>
#include <hdf5/serial/H5Cpp.h>
#endif
namespace hku {

View File

@ -8,7 +8,12 @@
#ifndef MYSQLKDATADRIVERIMP_H_
#define MYSQLKDATADRIVERIMP_H_
#include <mysql.h>
#if defined(BOOST_WINDOWS)
#include <mysql.h>
#else
#include <mysql/mysql.h>
#endif
#include "../../KDataDriverImp.h"
namespace hku {

View File

@ -7,7 +7,7 @@
#include <fstream>
#include <cmath>
#include <sys\stat.h>
#include <sys/stat.h>
#include "TdxKDataDriverImp.h"
namespace hku {
@ -554,8 +554,8 @@ _getBaseCount(const string& market, const string& code, KQuery::KType ktype) {
}
size_t count = 0;
struct _stat info;
if (0 == _stat(filename.c_str(), &info)) {
struct stat info;
if (0 == stat(filename.c_str(), &info)) {
count = info.st_size / sizeof(TdxDayData);
}

View File

@ -8,7 +8,7 @@
#ifndef INDICATOR_IMP_WEAVE_H_
#define INDICATOR_IMP_WEAVE_H_
#include "../indicator.h"
#include "../Indicator.h"
namespace hku {

View File

@ -18,8 +18,10 @@ namespace boost {
namespace serialization {
template<class Archive>
void save(Archive & ar, const hku::Block& blk, unsigned int version) {
ar & boost::serialization::make_nvp("category", blk.category());
ar & boost::serialization::make_nvp("name", blk.name());
hku::string category = blk.category();
hku::string name = blk.name();
ar & boost::serialization::make_nvp("category", category);
ar & boost::serialization::make_nvp("name", name);
hku::StockList stock_list;
stock_list.reserve(blk.size());
for (auto iter = blk.begin(); iter != blk.end(); ++iter) {

View File

@ -104,7 +104,7 @@ double HKU_API roundDown(double number, int ndigits) {
}
//#if defined(BOOST_WINDOWS) && (PY_VERSION_HEX < 0x03000000)
#if defined(BOOST_WINDOWS) && (PY_VERSION_HEX < 0x03000000)
/**
* UTF8编码的字符串转换为GB2312编码的字符串
* @param szinput UTF8编码的字符串
@ -198,6 +198,6 @@ string HKU_API gb_to_utf8(const string& szinput) {
return gb_to_utf8(szinput.c_str());
}
//#endif /* defined(BOOST_WINDOWS) */
#endif /* defined(BOOST_WINDOWS) */
} /*namespace*/

View File

@ -2,6 +2,8 @@
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import python ;
project : build-dir ../../build/hikyuu_python ;
project : requirements <library>/boost/python//boost_python

View File

@ -20,15 +20,15 @@ Indicator (*indicator_sub)(const Indicator&, const Indicator&) = operator-;
Indicator (*indicator_mul)(const Indicator&, const Indicator&) = operator*;
Indicator (*indicator_div)(const Indicator&, const Indicator&) = operator/;
string (Indicator::*read_name)() const = &Indicator::name;
void (Indicator::*write_name)(const string&) = &Indicator::name;
string (Indicator::*ind_read_name)() const = &Indicator::name;
void (Indicator::*ind_write_name)(const string&) = &Indicator::name;
void export_Indicator() {
class_<Indicator>("Indicator", init<>())
.def(init<IndicatorImpPtr>())
.def(self_ns::str(self))
.add_property("name", read_name, write_name)
.add_property("name", ind_read_name, ind_write_name)
.add_property("long_name", &Indicator::long_name)
.add_property("discard", &Indicator::discard)
.def("setDiscard", &Indicator::setDiscard)

View File

@ -12,8 +12,8 @@
using namespace boost::python;
using namespace hku;
string (Operand::*read_name)() const = &Operand::name;
void (Operand::*write_name)(const string&) = &Operand::name;
string (Operand::*op_read_name)() const = &Operand::name;
void (Operand::*op_write_name)(const string&) = &Operand::name;
Indicator (Operand::*bracket1)(const Indicator&) = &Operand::operator();
Operand (Operand::*bracket2)(const Operand&) = &Operand::operator();
@ -24,7 +24,7 @@ void export_Operand() {
.def(init<const Indicator&>())
.def(init<const Operand&>())
.def(init<const Operand&, const Operand&>())
.add_property("name", read_name, write_name)
.add_property("name", op_read_name, op_write_name)
.def(self_ns::str(self))
.def("__call__", bracket1)
.def("__call__", bracket2)

View File

@ -41,15 +41,15 @@ public:
};
string (ConditionBase::*get_name)() const = &ConditionBase::name;
void (ConditionBase::*set_name)(const string&) = &ConditionBase::name;
string (ConditionBase::*cn_get_name)() const = &ConditionBase::name;
void (ConditionBase::*cn_set_name)(const string&) = &ConditionBase::name;
void export_Condition() {
class_<ConditionWrap, boost::noncopyable>("ConditionBase", init<>())
.def(init<const string&>())
.def(self_ns::str(self))
.add_property("name", get_name, set_name)
.add_property("name", cn_get_name, cn_set_name)
.def("getParam", &ConditionBase::getParam<boost::any>)
.def("setParam", &ConditionBase::setParam<object>)
.def("isValid", &ConditionBase::isValid)

View File

@ -44,13 +44,13 @@ public:
}
};
string (EnvironmentBase::*get_name)() const = &EnvironmentBase::name;
void (EnvironmentBase::*set_name)(const string&) = &EnvironmentBase::name;
string (EnvironmentBase::*ev_get_name)() const = &EnvironmentBase::name;
void (EnvironmentBase::*ev_set_name)(const string&) = &EnvironmentBase::name;
void export_Environment() {
class_<EnvironmentWrap, boost::noncopyable>("EnvironmentBase", init<const string&>())
.def(self_ns::str(self))
.add_property("name", get_name, set_name)
.add_property("name", ev_get_name, ev_set_name)
.def("getParam", &EnvironmentBase::getParam<boost::any>)
.def("setParam", &EnvironmentBase::setParam<object>)
.def("setQuery", &EnvironmentBase::setQuery)

View File

@ -96,15 +96,15 @@ public:
};
string (MoneyManagerBase::*get_name)() const = &MoneyManagerBase::name;
void (MoneyManagerBase::*set_name)(const string&) = &MoneyManagerBase::name;
string (MoneyManagerBase::*mm_get_name)() const = &MoneyManagerBase::name;
void (MoneyManagerBase::*mm_set_name)(const string&) = &MoneyManagerBase::name;
void export_MoneyManager() {
class_<MoneyManagerWrap, boost::noncopyable>("MoneyManagerBase", init<>())
.def(init<const string&>())
.def(self_ns::str(self))
.add_property("name", get_name, set_name)
.add_property("name", mm_get_name, mm_set_name)
.def("getParam", &MoneyManagerBase::getParam<boost::any>)
.def("setParam", &MoneyManagerBase::setParam<object>)
.def("setTM", &MoneyManagerBase::setTM)

View File

@ -12,8 +12,8 @@
using namespace boost::python;
using namespace hku;
void (Portfolio::*set_name)(const string&) = &Portfolio::name;
string (Portfolio::*get_name)() const= &Portfolio::name;
void (Portfolio::*pf_set_name)(const string&) = &Portfolio::name;
string (Portfolio::*pf_get_name)() const= &Portfolio::name;
void export_Portfolio() {
class_<Portfolio>("Portfolio", init<>())
@ -26,7 +26,7 @@ void export_Portfolio() {
.add_property("params",
make_function(&Portfolio::getParameter,
return_internal_reference<>()))
.add_property("name", get_name, set_name)
.add_property("name", pf_get_name, pf_set_name)
.add_property("am", &Portfolio::getAM, &Portfolio::setAM)
.add_property("tm", &Portfolio::getTM, &Portfolio::setTM)
.add_property("sys", &Portfolio::getSYS, &Portfolio::setSYS)

View File

@ -59,14 +59,14 @@ public:
}
};
string (ProfitGoalBase::*get_name)() const = &ProfitGoalBase::name;
void (ProfitGoalBase::*set_name)(const string&) = &ProfitGoalBase::name;
string (ProfitGoalBase::*pg_get_name)() const = &ProfitGoalBase::name;
void (ProfitGoalBase::*pg_set_name)(const string&) = &ProfitGoalBase::name;
void export_ProfitGoal() {
class_<ProfitGoalWrap, boost::noncopyable>("ProfitGoalBase", init<>())
.def(init<const string&>())
.def(self_ns::str(self))
.add_property("name", get_name, set_name)
.add_property("name", pg_get_name, pg_set_name)
.def("getParam", &ProfitGoalBase::getParam<boost::any>)
.def("setParam", &ProfitGoalBase::setParam<object>)
.def("setTM", &ProfitGoalBase::setTM)

View File

@ -40,14 +40,14 @@ public:
};
string (SignalBase::*get_name)() const = &SignalBase::name;
void (SignalBase::*set_name)(const string&) = &SignalBase::name;
string (SignalBase::*sg_get_name)() const = &SignalBase::name;
void (SignalBase::*sg_set_name)(const string&) = &SignalBase::name;
void export_Signal() {
class_<SignalWrap, boost::noncopyable>("SignalBase", init<>())
.def(init<const string&>())
.def(self_ns::str(self))
.add_property("name", get_name, set_name)
.add_property("name", sg_get_name, sg_set_name)
//因为Indicator无法使用params['name']的形式所以统一使用setParm/getParam
//.add_property("params",
// make_function(&SignalBase::getParameter,

View File

@ -48,15 +48,15 @@ public:
};
string (SlippageBase::*get_name)() const = &SlippageBase::name;
void (SlippageBase::*set_name)(const string&) = &SlippageBase::name;
string (SlippageBase::*sp_get_name)() const = &SlippageBase::name;
void (SlippageBase::*sp_set_name)(const string&) = &SlippageBase::name;
void export_Slippage() {
class_<SlippageWrap, boost::noncopyable>("SlippageBase", init<>())
.def(init<const string&>())
.def(self_ns::str(self))
.add_property("name", get_name, set_name)
.add_property("name", sp_get_name, sp_set_name)
.def("getParam", &SlippageBase::getParam<boost::any>)
.def("setParam", &SlippageBase::setParam<object>)
.def("setTO", &SlippageBase::setTO)

View File

@ -55,14 +55,14 @@ public:
}
};
string (StoplossBase::*get_name)() const = &StoplossBase::name;
void (StoplossBase::*set_name)(const string&) = &StoplossBase::name;
string (StoplossBase::*st_get_name)() const = &StoplossBase::name;
void (StoplossBase::*st_set_name)(const string&) = &StoplossBase::name;
void export_Stoploss() {
class_<StoplossWrap, boost::noncopyable>("StoplossBase", init<>())
.def(init<const string&>())
.def(self_ns::str(self))
.add_property("name", get_name, set_name)
.add_property("name", st_get_name, st_set_name)
.def("getParam", &StoplossBase::getParam<boost::any>)
.def("setParam", &StoplossBase::setParam<object>)
.def("setTM", &StoplossBase::setTM)

View File

@ -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 ;

View File

@ -2,11 +2,6 @@
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# Specify the path to the Boost project. If you move this project,
# adjust this path to refer to the Boost root directory.
# use-project boost
# : /home/fasiondog/src/boost_1_43_0 ;
#指定默认编译版本否则每次都要在bjam后带release参数暂时屏蔽
# project : default-build release
project : build-dir ../../build/importdata
@ -20,13 +15,14 @@ project : build-dir ../../build/importdata
<toolset>msvc:<define>HKU_API="__declspec(dllimport)"
;
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>gcc
<define>H5_USE_16_API
;

View File

@ -25,8 +25,14 @@
#include <iconv.h>
#endif
#if defined(BOOST_MSVC)
#include <hdf5.h>
#include <hdf5_hl.h>
#else
#include <hdf5/serial/hdf5.h>
#include <hdf5/serial/hdf5_hl.h>
#endif
#include "sqlite3callback.h"
#include "importdata.h"

View File

@ -17,7 +17,7 @@
#if defined(BOOST_MSVC)
#include <cpp/H5Cpp.h>
#else
#include <H5Cpp.h>
#include <hdf5/serial/H5Cpp.h>
#endif
#if !(defined(WIN32) && defined(_WIN32))