You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.8KB

  1. # makefile fragment to make test.exe, the unit test program.
  2. #include "../../arch.mk"
  3. include $(RACK_DIR)/arch.mk
  4. TEST_SOURCES = $(wildcard test/*.cpp)
  5. TEST_SOURCES += $(wildcard dsp/**/*.cpp)
  6. TEST_SOURCES += $(wildcard dsp/third-party/falco/*.cpp)
  7. TEST_SOURCES += $(wildcard sqsrc/**/*.cpp)
  8. TEST_SOURCES += dsp/third-party/src/minblep.cpp
  9. TEST_SOURCES += dsp/third-party/kiss_fft130/tools/kiss_fftr.c
  10. TEST_SOURCES += dsp/third-party/kiss_fft130/kiss_fft.c
  11. ## This is a list of full paths to the .o files we want to build
  12. TEST_OBJECTS = $(patsubst %, build_test/%.o, $(TEST_SOURCES))
  13. build_test/%.cpp.o: %.cpp
  14. mkdir -p $(@D)
  15. $(CXX) $(CXXFLAGS) -c -o $@ $<
  16. build_test/%.c.o: %.c
  17. mkdir -p $(@D)
  18. $(CXX) $(CXXFLAGS) -c -o $@ $<
  19. # Always define _PERF for the perf tests.
  20. perf.exe : PERFFLAG = -D _PERF
  21. # Turn off asserts for perf, unless user overrides on command line
  22. perf.exe : FLAGS += $(ASSERTOFF)
  23. FLAGS += $(PERFFLAG)
  24. ifeq ($(ARCH), win)
  25. # don't need these yet
  26. # -lcomdlg32 -lole32 -ldsound -lwinmm
  27. test.exe perf.exe : LDFLAGS = -static \
  28. -mwindows \
  29. -lpthread -lopengl32 -lgdi32 -lws2_32
  30. endif
  31. ifeq ($(ARCH), lin)
  32. test.exe perf.exe : LDFLAGS = -rdynamic \
  33. -lpthread -lGL -ldl \
  34. $(shell pkg-config --libs gtk+-2.0)
  35. endif
  36. ifeq ($(ARCH), mac)
  37. test.exe perf.exe : LDFLAGS = -stdlib=libc++ -lpthread -ldl \
  38. -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
  39. endif
  40. test : test.exe
  41. ## Note that perf and test targets both used build_test for object files,
  42. ## So you need to be careful to delete/clean when switching between the two.
  43. ## Consider fixing this in the future.
  44. perf : perf.exe
  45. ## cleantest will clean out all the test and perf build products
  46. cleantest :
  47. rm -rfv build_test
  48. rm -fv test.exe
  49. rm -fv perf.exe
  50. test.exe : $(TEST_OBJECTS)
  51. $(CXX) -o $@ $^ $(LDFLAGS)
  52. perf.exe : $(TEST_OBJECTS)
  53. $(CXX) -o $@ $^ $(LDFLAGS)