Add make commands for tests
This adds the make commands required to build and run tests.
This commit is contained in:
23
tests/cpp/xgboost_test.mk
Normal file
23
tests/cpp/xgboost_test.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
UTEST_ROOT=tests/cpp
|
||||
UTEST_OBJ_ROOT=build_$(UTEST_ROOT)
|
||||
UNITTEST=$(UTEST_ROOT)/xgboost_test
|
||||
UNITTEST_SRC=$(wildcard $(UTEST_ROOT)/*.cc $(UTEST_ROOT)/*/*.cc)
|
||||
UNITTEST_OBJ=$(patsubst $(UTEST_ROOT)%.cc, $(UTEST_OBJ_ROOT)%.o, $(UNITTEST_SRC))
|
||||
|
||||
GTEST_LIB=$(GTEST_PATH)/lib/
|
||||
GTEST_INC=$(GTEST_PATH)/include/
|
||||
|
||||
UNITTEST_CFLAGS=$(CFLAGS)
|
||||
UNITTEST_LDFLAGS=$(LDFLAGS) -L$(GTEST_LIB) -lgtest
|
||||
UNITTEST_DEPS=lib/libxgboost.a $(DMLC_CORE)/libdmlc.a $(RABIT)/lib/$(LIB_RABIT)
|
||||
|
||||
$(UTEST_OBJ_ROOT)/%.o: $(UTEST_ROOT)/%.cc
|
||||
@mkdir -p $(@D)
|
||||
$(CXX) $(UNITTEST_CFLAGS) -I$(GTEST_INC) -o $@ -c $<
|
||||
|
||||
$(UNITTEST): $(UNITTEST_OBJ) $(UNITTEST_DEPS)
|
||||
$(CXX) $(UNITTEST_CFLAGS) -o $@ $^ $(UNITTEST_LDFLAGS)
|
||||
|
||||
|
||||
ALL_TEST=$(UNITTEST)
|
||||
ALL_TEST_OBJ=$(UNITTEST_OBJ)
|
||||
Reference in New Issue
Block a user