Skip to content

Commit

Permalink
Add caching and cleaning for UCRT check
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Sep 27, 2023
1 parent 373c783 commit 55e59f7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
15 changes: 13 additions & 2 deletions make/compiler_flags
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,19 @@ ifeq ($(OS),Windows_NT)
CXXFLAGS_OS ?= -m64
endif

UCRT_STRING := $(shell echo "\#include <windows.h>" | $(CXX) -E -dM - | grep -i _UCRT)
ifneq (,$(UCRT_STRING))
ifeq (,$(wildcard $(MATH)make/ucrt))
UCRT_STRING := $(shell echo "#include <windows.h>" | $(CXX) -E -dM - | findstr _UCRT)
ifneq (,$(UCRT_STRING))
IS_UCRT ?= true
else
IS_UCRT ?= false
endif
$(shell echo "IS_UCRT ?= $(IS_UCRT)" > $(MATH)make/ucrt)
else
-include $(MATH)make/ucrt
endif

ifeq ($(IS_UCRT),true)
CXXFLAGS_OS += -D_UCRT
endif

Expand Down
2 changes: 1 addition & 1 deletion make/libraries
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ ifeq (Linux, $(OS))
endif

ifeq (Windows_NT, $(OS))
ifneq (,$(UCRT_STRING))
ifeq ($(IS_UCRT),true)
TBB_CXXFLAGS += -D_UCRT
endif
endif
Expand Down
1 change: 1 addition & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ clean-deps:
@$(RM) $(call findfiles,test,*.d.*)
@$(RM) $(call findfiles,lib,*.d.*)
@$(RM) $(call findfiles,stan,*.dSYM)
@$(RM) $(call findfiles,make,ucrt)

clean-all: clean clean-doxygen clean-deps clean-libraries

Expand Down

0 comments on commit 55e59f7

Please sign in to comment.