File tree Expand file tree Collapse file tree 1 file changed +22
-12
lines changed
Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Original file line number Diff line number Diff line change 4040
4141LDFLAGS = -L$(XLA_EXTENSION_LIB ) -lxla_extension -shared
4242
43- ifeq ($(shell uname -s) , Darwin)
43+ ifeq ($(CROSSCOMPILE ) ,)
44+ # Interrogate the system for local compilation
45+ UNAME_S = $(shell uname -s)
46+
47+ NVCC_RESULT := $(shell which nvcc 2> /dev/null)
48+ NVCC_TEST := $(notdir $(NVCC_RESULT))
49+
50+ ifeq ($(NVCC_TEST ) ,nvcc)
51+ NVCC := nvcc
52+ NVCCFLAGS += -DCUDA_ENABLED
53+ else
54+ NVCC := $(CXX)
55+ NVCCFLAGS = $(CFLAGS)
56+ endif
57+ else
58+ # Determine settings for cross-compiled builds like for Nerves
59+ UNAME_S = Linux
60+ NVCC := $(CXX)
61+ NVCCFLAGS = $(CFLAGS)
62+ endif
63+
64+ ifeq ($(UNAME_S ) , Darwin)
4465 LDFLAGS += -flat_namespace -undefined dynamic_lookup -rpath @loader_path/xla_extension/lib
4566else
4667 # Use a relative RPATH, so at runtime libexla.so looks for libxla_extension.so
@@ -67,17 +88,6 @@ HEADERS = $(EXLA_DIR)/exla_mlir.h $(EXLA_DIR)/custom_calls/qr.h $(EXLA_DIR)/cust
6788OBJECTS = $(patsubst $(EXLA_DIR ) /% .cc,$(EXLA_CACHE_OBJ_DIR ) /% .o,$(SOURCES ) ) $(EXLA_CACHE_OBJ_DIR ) /exla_cuda.o
6889
6990
70- NVCC_RESULT := $(shell which nvcc 2> /dev/null)
71- NVCC_TEST := $(notdir $(NVCC_RESULT ) )
72-
73- ifeq ($(NVCC_TEST ) ,nvcc)
74- NVCC := nvcc
75- NVCCFLAGS += -DCUDA_ENABLED
76- else
77- NVCC := $(CXX )
78- NVCCFLAGS = $(CFLAGS)
79- endif
80-
8191$(EXLA_CACHE_OBJ_DIR ) /exla_cuda.o : $(EXLA_DIR ) /exla_cuda.cc $(EXLA_DIR ) /exla_cuda.h
8292 @ mkdir -p $(EXLA_CACHE_OBJ_DIR )
8393 $(NVCC ) $(NVCCFLAGS ) -c $< -o $@
You can’t perform that action at this time.
0 commit comments