Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. .PHONY: all
  2. all: lib extras examples
  3. GG=g++
  4. #GG=clang++
  5. #GG=/usr/bin/g++ 17s
  6. #GG=/usr/bin/clang++ 14s
  7. #GG=g++-mp-4.3 15.5s
  8. #GG=g++-mp-4.7 19.9s
  9. # Shared flags etc.
  10. include Makefile.conf
  11. $(info Hello, $(IGL_USERNAME)!)
  12. # optimized default settings
  13. all: LFLAGS +=
  14. OPTFLAGS+=-O3 -DNDEBUG $(OPENMP)
  15. #debug: OPTFLAGS= -g -Wall -Werror
  16. debug: OPTFLAGS= -g -Wall
  17. debug: DEBUG=debug
  18. CFLAGS += $(OPTFLAGS)
  19. #CFLAGS += -DIGL_NO_OPENGL -DIGL_NO_ANTTWEAKBAR
  20. EXTRA_DIRS=
  21. ifeq ($(IGL_WITH_TETGEN),1)
  22. # append tetgen extra dir
  23. EXTRA_DIRS+=include/igl/tetgen
  24. endif
  25. ifeq ($(IGL_WITH_MATLAB),1)
  26. EXTRA_DIRS+=include/igl/matlab
  27. endif
  28. ifeq ($(IGL_WITH_BBW),1)
  29. EXTRA_DIRS+=include/igl/BBW
  30. endif
  31. ifeq ($(IGL_WITH_MOSEK),1)
  32. EXTRA_DIRS+=include/igl/mosek
  33. endif
  34. ifeq ($(IGL_WITH_PNG),1)
  35. EXTRA_DIRS+=include/igl/png
  36. endif
  37. ifeq ($(IGL_WITH_XML),1)
  38. EXTRA_DIRS+=include/igl/xml
  39. endif
  40. ifeq ($(IGL_WITH_EMBREE),1)
  41. EXTRA_DIRS+=include/igl/embree
  42. endif
  43. ifeq ($(IGL_WITH_BOOST),1)
  44. EXTRA_DIRS+=include/igl/boost
  45. endif
  46. .PHONY: examples
  47. .PHONY: extras
  48. debug: lib extras
  49. lib: lib/libigl.a
  50. examples: lib extras
  51. make -C examples
  52. extras:
  53. for p in $(EXTRA_DIRS); \
  54. do \
  55. echo "cd $$p" ; \
  56. $(MAKE) -C $$p $(DEBUG); \
  57. done
  58. #############################################################################
  59. # SOURCE
  60. #############################################################################
  61. CPP_FILES=$(wildcard include/igl/*.cpp)
  62. OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))
  63. # include igl headers
  64. INC+=-Iinclude/
  65. #############################################################################
  66. # DEPENDENCIES
  67. #############################################################################
  68. INC+=$(OPENGL_INC)
  69. # Eigen dependency
  70. ifndef EIGEN3_INC
  71. EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
  72. endif
  73. INC+=$(EIGEN3_INC)
  74. # AntTweakBar dependency
  75. #ANTTWEAKBAR_INC=-I$(DEFAULT_PREFIX)/include
  76. ANTTWEAKBAR_INC=-Iexternal/AntTweakBar/include
  77. INC+=$(ANTTWEAKBAR_INC)
  78. ## OpenGL dependency
  79. #LIB+=-framework OpenGL
  80. #LIB+=-framework GLUT
  81. #LIB+=-framework AppKit
  82. obj:
  83. mkdir -p obj
  84. lib/libigl.a: $(OBJ_FILES)
  85. mkdir -p lib
  86. rm -f $@
  87. ar cqs $@ $(OBJ_FILES)
  88. obj/%.o: include/igl/%.cpp include/igl/%.h
  89. $(GG) $(CFLAGS) $(AFLAGS) -c -o $@ $< $(INC)
  90. clean:
  91. rm -f obj/*.o
  92. rm -f lib/libigl.a
  93. make -C examples clean
  94. for p in $(EXTRA_DIRS); \
  95. do \
  96. echo "cd $$p" ; \
  97. $(MAKE) -C $$p clean; \
  98. done