Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac restore r #73

Merged
merged 12 commits into from
May 28, 2022
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ jobs:
- name: build & install the unmanaged dependencies
run: util/deps-build.sh
- name: build
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} --unity --build-qt
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} --unity --build-qt --build-r
- name: run demo
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} --unity --build-qt --run-demo
run: ./ci-default --compiler ${{ matrix.compiler }} ${{ matrix.linkage }} --unity --build-qt --build-r --run-demo
# It doesn't make sense for now, since we're not linking Boost statically yet.
# - uses: actions/upload-artifact@v2
# if: ${{ matrix.compiler == 'gcc' && matrix.linkage == '--lto' }}
Expand Down Expand Up @@ -111,9 +111,9 @@ jobs:
- name: build & install the unmanaged dependencies
run: util/deps-build.sh
- name: build
run: ./ci-default --unity --lto
run: ./ci-default --unity --lto --build-r
- name: run demo
run: ./ci-default --unity --lto --run-demo
run: ./ci-default --unity --lto --build-r --run-demo
- uses: actions/upload-artifact@v2
with:
name: tsqsim-${{ matrix.os }}
Expand Down
30 changes: 20 additions & 10 deletions util/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,24 @@ def get_parser():
# TODO: select clang or mingw, if gcc is not available
return parser

def get_r_path(search_dir = '.'):
prev_dir = os.getcwd()
os.chdir(search_dir)
exports_r = ""
if platform.system() == 'Linux':
exports_r = "&& export R_HOME=/usr/lib/R && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$R_HOME/lib"
elif platform.system() == 'Darwin':
dir_framework = '/Library/Frameworks/R.framework/Resources'
dir_osx11 = '/usr/local/Cellar/r/4.2.0/lib/R'
if os.path.isdir(dir_osx11):
dir_framework = dir_osx11
if not os.path.isdir(dir_framework):
raise IOError("The R Framework's dir: {} wasn't found".format(dir_framework))
exports_r = "&& export R_HOME={} && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$R_HOME/lib".format(dir_framework)
os.chdir(prev_dir)

return exports_r

def build(args):
print("Args = ", args)
if args.lto and args.shared:
Expand Down Expand Up @@ -140,17 +158,9 @@ def build(args):

#print(cmd)
def run_demo(args):
exports_r = get_r_path(DIR_BIN)
os.chdir(DIR_BIN)
exports_r = ""
if platform.system() == 'Linux':
exports_r = "&& export R_HOME=/usr/lib/R && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$R_HOME/lib"
elif platform.system() == 'Darwin':
dir_framework = '/Library/Frameworks/R.framework/Resources'
dir_osx11 = '/usr/local/Cellar/r/4.1.2/lib/R'
if os.path.isdir(dir_osx11):
dir_framework = dir_osx11
exports_r = "&& export R_HOME={} && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$R_HOME/lib".format(dir_framework)


cmd = ""
cmd += ' export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:lib' # TODO: Solve in CMake?
cmd += exports_r
Expand Down
4 changes: 2 additions & 2 deletions util/deps-pull.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +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:
# TODO:
#Rscript src/tsqsim-lib/static/scripts/r-path.R
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