Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/lib-base/src/TimeUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
#include <chrono>
#include <ctime>

//#if defined(_MSC_VER)
//# define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL : Tm)
//#endif

#ifdef WIN32
#define LOCALTIME(time, localTime) localtime_s(localTime, time)
#else
#define LOCALTIME(time, localTime) localtime_r(time, localTime)
#endif

TimeUtil::TimeUtil(){}
TimeUtil::~TimeUtil(){}

Expand All @@ -30,7 +40,7 @@ int TimeUtil::GetCurrentTimeComponent(const char fmt) const
{
std::time_t t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
std::tm ltime;
localtime_r(&t, &ltime);
LOCALTIME(&t, &ltime);
EnjoLib::Osstream oss;
const EnjoLib::Str fmtStr = EnjoLib::Str("%") + fmt;
oss.OStr() << std::put_time(&ltime, fmtStr.c_str());
Expand Down
2 changes: 2 additions & 0 deletions util/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def get_parser():
parser.add_argument('-p', '--pch', default=False, action='store_true', help="build pch (Dev case; default: OFF)")
parser.add_argument('-u', '--unity', default=False, action='store_true', help="build unity (CI case; default: OFF)")
parser.add_argument('-q', '--build-qt', default=False, action='store_true', help="build QT apps (default: OFF)")
parser.add_argument('--build-r', default=False, action='store_true', help="build R support (default: OFF)")
parser.add_argument('-w', '--no-wx', default=False, action='store_true', help="don't build WX apps (default: OFF)")
parser.add_argument('-t', '--no-tests', default=False, action='store_true', help="don't build Tests (default: OFF)")
parser.add_argument('-r', '--run-demo', default=False, action='store_true', help="run demo (default: OFF)")
Expand Down Expand Up @@ -109,6 +110,7 @@ def build(args):
cmd += NL + '-DBUILD_WX={}' .format(OFF if args.no_wx else ON ) # Optional
cmd += NL + '-DBUILD_TESTS={}'.format(OFF if args.no_tests else ON ) # Optional
cmd += NL + '-DBUILD_BOOST={}'.format(ON) # Required
cmd += NL + '-DWITH_FEATURE_R={}'.format(ON if args.build_r else OFF) # TODO: Disabled for now
if args.compiler:
cmd += NL + '-DCMAKE_C_COMPILER="{}"'.format(cccompiler)
cmd += NL + '-DCMAKE_CXX_COMPILER="{}"'.format(cpcompiler)
Expand Down
5 changes: 3 additions & 2 deletions util/deps-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ if [ "$(uname)" == "Darwin" ]; then
fi
#HOMEBREW_NO_AUTO_UPDATE=1 brew install qt5
#brew link -v qt5 --force
HOMEBREW_NO_AUTO_UPDATE=1 brew install boost ccache gnuplot eigen gsl unittest-cpp wxwidgets r # openssl zmq
HOMEBREW_NO_AUTO_UPDATE=1 brew install boost ccache gnuplot eigen gsl unittest-cpp wxwidgets # r # openssl zmq
# TODO: install qt instead of qt5, after moving to latest QCustomPlot. Then the "--prefix" and "link" aren't needed.
# Expose R_HOME path:
Rscript src/tsqsim-lib/static/scripts/r-path.R
# TODO:
#Rscript src/tsqsim-lib/static/scripts/r-path.R
elif [ "$(uname)" == "Linux" ]; then
sudo apt update; sudo apt -y install build-essential cmake ccache gnuplot libeigen3-dev libunittest++-dev libgsl-dev libboost-system-dev libboost-filesystem-dev libboost-iostreams-dev libboost-serialization-dev libboost-program-options-dev libboost-date-time-dev libboost-atomic-dev libwxgtk3.0-gtk3-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools r-base-dev python3-statsmodels # libssl-dev
else
Expand Down