Skip to content

Commit

Permalink
Merge pull request #3 from stan-dev/feature/fix-cross-compilation
Browse files Browse the repository at this point in the history
Feature/fix cross compilation
  • Loading branch information
syclik committed Mar 8, 2014
2 parents 78f485f + 70c599c commit a4d2bf4
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
/src/test/test-models/*
!/src/test/test-models/*.stan
!/src/test/test-models/*.R

# local make include
make/local
4 changes: 4 additions & 0 deletions make/local
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
##
# Can put stuff that is specific to your computer here, e.g.
# CFLAGS += -march=native
##
2 changes: 1 addition & 1 deletion make/models
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ $(patsubst %.stan,%,$(wildcard $(addsuffix .stan,$(MAKECMDGOALS)))) : %$(EXE) :
%.cpp : %.stan $(MODEL_HEADER) bin/stanc$(EXE)
@echo ''
@echo '--- Translating Stan model to C++ code ---'
bin/stanc$(EXE) $< --o=$@ --no_main
$(WINE) bin$(PATH_SEPARATOR)stanc$(EXE) $< --o=$@ --no_main

9 changes: 4 additions & 5 deletions make/os_linux
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ ifeq (g++,$(CC_TYPE))
endif
endif
ifeq (mingw32-g++,$(CC_TYPE))
CFLAGS += -m32
CFLAGS_GTEST += -DGTEST_HAS_PTHREAD=0
LDLIBS_STANC += -static-libgcc
LDLIBS_STANC += -static-libstdc++
LDLIBS += -static-libgcc
LDLIBS += -static-libstdc++
LDLIBS_STANC += -static
LDLIBS += -static
LDFLAGS += -lwinpthread
EXE = .exe
WINE = wine
endif
ifeq (clang++,$(CC_TYPE))
# CFLAGS += -stdlib=libc++
Expand Down
4 changes: 2 additions & 2 deletions make/tests
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test/%$(EXE) : test/%.o bin/libstan.a
@mkdir -p $(dir $@)
$(LINK.c) -O$O $(GTEST_MAIN) $< $(CFLAGS_GTEST) $(OUTPUT_OPTION) $(LIBGTEST) $(LDLIBS)
ifeq ($(strip $(findstring src/test/,$(MAKECMDGOALS))), )
$@ --gtest_output="xml:$(basename $@).xml"
$(WINE) $@ --gtest_output="xml:$(basename $@).xml"
endif

####
Expand All @@ -95,7 +95,7 @@ endef
.SECONDEXPANSION:
.PHONY: $(TEST_TARGETS)
$(TEST_TARGETS): src/test/%: $$(filter $$(patsubst src/$$(PERCENT),$$(PERCENT),$$@)/$$(PERCENT),$$(ALL_TEST_EXECUTABLES))
$(foreach test,$^,$(test) --gtest_output="xml:$(basename $(test)).xml"; $n)
$(foreach test,$^,$(WINE) $(test) --gtest_output="xml:$(basename $(test)).xml"; $n)
@echo ''
@echo 'Ran '$(words $(filter test/%,$^))' tests for '$@
else
Expand Down

0 comments on commit a4d2bf4

Please sign in to comment.