Created
May 15, 2016 19:30
-
-
Save joshbode/1e9600b78ecc4a6ef08fc7650cc73c24 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "R/REmbedded.h" | |
int main(int argc, char *argv[]) { | |
Rf_initEmbeddedR(argc, argv); | |
R_ReplDLLinit(); | |
return R_ReplDLLdo1(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET := embed | |
CC := clang | |
SHELL := /bin/bash | |
FRAMEWORK_PATH ?= /Library/Frameworks | |
$(TARGET): $(TARGET).c | |
@$(CC) -o $(TARGET) $(TARGET).c -lR \ | |
-L$(FRAMEWORK_PATH)/R.framework/Libraries \ | |
-I$(FRAMEWORK_PATH)/R.framework/Headers | |
clean: | |
@$(RM) $(TARGET) | |
all: $(TARGET) | |
.PHONY: test | |
TESTS := "1" "foo" "1 foo" "foo 1" ")" "$$" | |
test: | |
@export R_HOME=$(FRAMEWORK_PATH)/R.Framework/Resources; \ | |
for TEST in $(TESTS); do \ | |
echo " $$TEST:"; \ | |
echo -n " output: "; \ | |
echo "$$TEST" | $(abspath $(TARGET)) --slave --vanilla --no-readline; \ | |
echo -n " return: $$?"; \ | |
echo; \ | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
declare -a R_VERSIONS=( | |
/Library/Frameworks | |
/usr/local/Cellar/r/3.2.5 | |
/usr/local/Cellar/r/3.3.0 | |
) | |
for FRAMEWORK_PATH in ${R_VERSIONS[@]}; do | |
export FRAMEWORK_PATH | |
echo "$FRAMEWORK_PATH:" | |
# homebrew libR.dylib has a reference to /usr/local/opt/r/.../libR.dylib :( | |
if [[ $FRAMEWORK_PATH =~ /([0-9a-zA-Z_-]+)/([0-9.]+)$ ]]; then | |
brew switch ${BASH_REMATCH[1]} ${BASH_REMATCH[2]} > /dev/null | |
fi | |
make clean all test | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment