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.

283 lines
10.0KB

  1. RACK_DIR ?= ../..
  2. # Essential compiler flags
  3. CXXFLAGS += -std=c++17 -Wall -Wextra -Wno-unused-parameter
  4. # Include paths
  5. FLAGS += -I$(RACK_DIR)/include -Idep/include
  6. # Source files
  7. SOURCES += src/Prototype.cpp
  8. DISTRIBUTABLES += res examples
  9. DISTRIBUTABLES += $(wildcard LICENSE*)
  10. include $(RACK_DIR)/arch.mk
  11. DUKTAPE ?= 0
  12. QUICKJS ?= 1
  13. LUAJIT ?= 0 # 1
  14. PYTHON ?= 0
  15. SUPERCOLLIDER ?= 0 # 1
  16. VULT ?= 0 # 1
  17. LIBPD ?= 0 # 1
  18. FAUST ?= 0 # 1
  19. # Vult depends on both LuaJIT and QuickJS
  20. ifeq ($(VULT), 1)
  21. QUICKJS := 1
  22. LUAJIT := 1
  23. endif
  24. # Entropia File System Watcher
  25. ifdef false #added to debug
  26. ifdef ARCH_WIN
  27. efsw := dep/lib/efsw-static-release.lib
  28. else
  29. efsw := dep/lib/libefsw-static-release.a
  30. endif
  31. DEPS += $(efsw)
  32. OBJECTS += $(efsw)
  33. $(efsw):
  34. ifdef ARCH_WIN
  35. cd efsw && premake5 gmake
  36. cd efsw && $(MAKE) -C make/* config=release_x86_64 efsw-static-lib
  37. else
  38. cd efsw && premake4 gmake
  39. cd efsw && $(MAKE) -C make/* config=release efsw-static-lib
  40. endif
  41. mkdir -p dep/lib dep/include
  42. ifdef ARCH_WIN
  43. cd efsw && cp lib/efsw-static-release.lib $(DEP_PATH)/lib/
  44. else
  45. cd efsw && cp lib/libefsw-static-release.a $(DEP_PATH)/lib/
  46. endif
  47. cd efsw && cp -R include/efsw $(DEP_PATH)/include/
  48. endif #added to debug
  49. # Duktape
  50. ifeq ($(DUKTAPE), 1)
  51. SOURCES += src/DuktapeEngine.cpp
  52. duktape := dep/duktape-2.4.0/src/duktape.c
  53. DEPS += $(duktape)
  54. SOURCES += $(duktape)
  55. FLAGS += -Idep/duktape-2.4.0/src
  56. $(duktape):
  57. $(WGET) "https://duktape.org/duktape-2.4.0.tar.xz"
  58. $(SHA256) duktape-2.4.0.tar.xz 86a89307d1633b5cedb2c6e56dc86e92679fc34b05be551722d8cc69ab0771fc
  59. cd dep && $(UNTAR) ../duktape-2.4.0.tar.xz
  60. endif
  61. # QuickJS
  62. ifeq ($(QUICKJS), 1)
  63. SOURCES += src/QuickJSEngine.cpp
  64. quickjs := dep/lib/quickjs/libquickjs.a
  65. DEPS += $(quickjs)
  66. OBJECTS += $(quickjs)
  67. QUICKJS_MAKE_FLAGS += prefix="$(DEP_PATH)"
  68. ifdef ARCH_WIN
  69. QUICKJS_MAKE_FLAGS += CONFIG_WIN32=y
  70. endif
  71. $(quickjs):
  72. cd dep && git clone "https://github.com/JerrySievert/QuickJS.git"
  73. cd dep/QuickJS && git checkout 807adc8ca9010502853d471bd8331cdc1d376b94
  74. cd dep/QuickJS && $(MAKE) $(QUICKJS_MAKE_FLAGS) install
  75. endif
  76. # LuaJIT
  77. ifeq ($(LUAJIT), 1)
  78. SOURCES += src/LuaJITEngine.cpp
  79. luajit := dep/lib/libluajit-5.1.a
  80. OBJECTS += $(luajit)
  81. DEPS += $(luajit)
  82. $(luajit):
  83. $(WGET) "http://luajit.org/download/LuaJIT-2.0.5.tar.gz"
  84. $(SHA256) LuaJIT-2.0.5.tar.gz 874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979
  85. cd dep && $(UNTAR) ../LuaJIT-2.0.5.tar.gz
  86. cd dep/LuaJIT-2.0.5 && $(MAKE) BUILDMODE=static PREFIX="$(DEP_PATH)" install
  87. endif
  88. # SuperCollider
  89. ifeq ($(SUPERCOLLIDER), 1)
  90. SOURCES += src/SuperColliderEngine.cpp
  91. FLAGS += -Idep/supercollider/include -Idep/supercollider/include/common -Idep/supercollider/lang -Idep/supercollider/common -Idep/supercollider/include/plugin_interface
  92. # FLAGS += -DSC_VCV_ENGINE_TIMING # uncomment to turn on timing printing while running
  93. supercollider := dep/supercollider/build/lang/libsclang.a
  94. OBJECTS += $(supercollider)
  95. DEPS += $(supercollider)
  96. DISTRIBUTABLES += dep/supercollider/SCClassLibrary
  97. DISTRIBUTABLES += support/supercollider_extensions
  98. SUPERCOLLIDER_CMAKE_FLAGS += -DSUPERNOVA=0 -DSC_EL=0 -DSC_VIM=0 -DSC_ED=0 -DSC_IDE=0 -DSC_ABLETON_LINK=0 -DSC_QT=0 -DCMAKE_BUILD_TYPE=Release -DSCLANG_SERVER=0 -DBUILD_TESTING=0 -DNO_LIBSNDFILE=1
  99. SUPERCOLLIDER_SUBMODULES += external_libraries/hidapi external_libraries/nova-simd external_libraries/nova-tt external_libraries/portaudio_sc_org external_libraries/yaml-cpp
  100. SUPERCOLLIDER_BRANCH := topic/vcv-prototype-support
  101. OBJECTS += dep/supercollider/build/external_libraries/libtlsf.a
  102. OBJECTS += dep/supercollider/build/external_libraries/hidapi/linux/libhidapi.a
  103. OBJECTS += dep/supercollider/build/external_libraries/hidapi/hidapi_parser/libhidapi_parser.a
  104. OBJECTS += dep/supercollider/build/external_libraries/libboost_thread_lib.a
  105. OBJECTS += dep/supercollider/build/external_libraries/libboost_system_lib.a
  106. OBJECTS += dep/supercollider/build/external_libraries/libboost_regex_lib.a
  107. OBJECTS += dep/supercollider/build/external_libraries/libboost_filesystem_lib.a
  108. OBJECTS += dep/supercollider/build/external_libraries/libyaml.a
  109. LDFLAGS += -lpthread -lasound -ludev
  110. $(supercollider):
  111. cd dep && git clone "https://github.com/supercollider/supercollider" --branch $(SUPERCOLLIDER_BRANCH) --depth 1
  112. cd dep/supercollider && git checkout 84b14d10d49edce6dd8303045a884fb7f2bc92e8
  113. cd dep/supercollider && git submodule update --depth 1 --init -- $(SUPERCOLLIDER_SUBMODULES)
  114. cd dep/supercollider && mkdir build
  115. cd dep/supercollider/build && $(CMAKE) .. $(SUPERCOLLIDER_CMAKE_FLAGS)
  116. cd dep/supercollider/build && $(MAKE) libsclang
  117. endif
  118. # Python
  119. ifeq ($(PYTHON), 1)
  120. SOURCES += src/PythonEngine.cpp
  121. # Note this is a dynamic library, not static.
  122. python := dep/lib/libpython3.8.so.1.0
  123. DEPS += $(python) $(numpy)
  124. FLAGS += -Idep/include/python3.8
  125. # TODO Test these flags on all platforms
  126. # Make dynamic linker look in the plugin folder for libpython.
  127. LDFLAGS += -Wl,-rpath,'$$ORIGIN'/dep/lib
  128. LDFLAGS += -Ldep/lib -lpython3.8
  129. LDFLAGS += -lcrypt -lpthread -ldl -lutil -lm
  130. DISTRIBUTABLES += $(python)
  131. DISTRIBUTABLES += dep/lib/python3.8
  132. $(python):
  133. $(WGET) "https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz"
  134. $(SHA256) Python-3.8.0.tar.xz b356244e13fb5491da890b35b13b2118c3122977c2cd825e3eb6e7d462030d84
  135. cd dep && $(UNTAR) ../Python-3.8.0.tar.xz
  136. cd dep/Python-3.8.0 && $(CONFIGURE) --build=$(MACHINE) --enable-shared --enable-optimizations
  137. cd dep/Python-3.8.0 && $(MAKE) build_all
  138. cd dep/Python-3.8.0 && $(MAKE) install
  139. numpy := dep/lib/python3.8/site-packages/numpy
  140. FLAGS += -Idep/lib/python3.8/site-packages/numpy/core/include
  141. $(numpy): $(python)
  142. $(WGET) "https://github.com/numpy/numpy/releases/download/v1.17.3/numpy-1.17.3.tar.gz"
  143. $(SHA256) numpy-1.17.3.tar.gz c93733dbebc2599d2747ceac4b18825a73767d289176ed8e02090325656d69aa
  144. cd dep && $(UNTAR) ../numpy-1.17.3.tar.gz
  145. # Don't try to find an external BLAS and LAPACK library.
  146. # Don't install to an egg folder.
  147. # Make sure to use our built Python.
  148. cd dep/numpy-1.17.3 && LD_LIBRARY_PATH=../lib NPY_BLAS_ORDER= NPY_LAPACK_ORDER= "$(DEP_PATH)"/bin/python3.8 setup.py build -j4 install --single-version-externally-managed --root=/
  149. # scipy: $(numpy)
  150. # $(WGET) "https://github.com/scipy/scipy/releases/download/v1.3.1/scipy-1.3.1.tar.xz"
  151. # $(SHA256) scipy-1.3.1.tar.xz 326ffdad79f113659ed0bca80f5d0ed5e28b2e967b438bb1f647d0738073a92e
  152. # cd dep && $(UNTAR) ../scipy-1.3.1.tar.xz
  153. # cd dep/scipy-1.3.1 && "$(DEP_PATH)"/bin/python3.7 setup.py build -j4 install
  154. endif
  155. # # Julia
  156. # julia := dep/lib/libjulia.a
  157. # DEPS += $(julia)
  158. # $(julia):
  159. # $(WGET) "https://github.com/JuliaLang/julia/releases/download/v1.2.0/julia-1.2.0-full.tar.gz"
  160. # $(SHA256) julia-1.2.0-full.tar.gz 2419b268fc5c3666dd9aeb554815fe7cf9e0e7265bc9b94a43957c31a68d9184
  161. # cd dep && $(UNTAR) ../julia-1.2.0-full.tar.gz
  162. # # Csound
  163. # csound := dep/lib/libcsound.a
  164. # DEPS += $(csound)
  165. # $(csound):
  166. # $(WGET) "https://github.com/csound/csound/archive/6.13.0.tar.gz"
  167. # $(SHA256) 6.13.0.tar.gz 183beeb3b720bfeab6cc8af12fbec0bf9fef2727684ac79289fd12d0dfee728b
  168. # cd dep && $(UNTAR) ../6.13.0.tar.gz
  169. # # LLVM
  170. # llvm := dep/lib/libllvm.a
  171. # DEPS += $(llvm)
  172. # $(llvm):
  173. # $(WGET) "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz"
  174. # $(SHA256) llvm-8.0.1.src.tar.xz 44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7
  175. # cd dep && $(UNTAR) ../llvm-8.0.1.src.tar.xz
  176. # cd dep/llvm-8.0.1.src && mkdir -p build
  177. # cd dep/llvm-8.0.1.src/build && $(CMAKE) ..
  178. # cd dep/llvm-8.0.1.src/build && $(MAKE)
  179. # cd dep/llvm-8.0.1.src/build && $(MAKE) install
  180. # Vult
  181. ifeq ($(VULT), 1)
  182. SOURCES += src/VultEngine.cpp
  183. vult := dep/vult/vultc.h
  184. $(vult):
  185. cd dep && mkdir -p vult
  186. cd dep/vult && $(WGET) "https://github.com/modlfo/vult/releases/download/v0.4.12/vultc.h"
  187. $(SHA256) $(vult) 3e80f6d30defe7df2804568f0314dbb33e6bf69d53d18a804c8b8132cf5ad146
  188. FLAGS += -Idep/vult
  189. DEPS += $(vult)
  190. endif
  191. # LibPD
  192. ifeq ($(LIBPD), 1)
  193. libpd := dep/lib/libpd.a
  194. SOURCES += src/LibPDEngine.cpp
  195. OBJECTS += $(libpd)
  196. DEPS += $(libpd)
  197. FLAGS += -Idep/include/libpd -DHAVE_LIBDL
  198. ifdef ARCH_WIN
  199. # PD_INTERNAL leaves the function declarations for libpd unchanged
  200. # not specifying that flag would enable the "EXTERN __declspec(dllexport) extern" macro
  201. # which throws a linker error. I guess this macro should only be used for the windows
  202. # specific .dll dynamic linking format.
  203. # The corresponding #define resides in "m_pd.h" inside th Pure Data sources
  204. FLAGS += -DPD_INTERNAL -Ofast
  205. LDFLAGS += -Wl,--export-all-symbols
  206. LDFLAGS += -lws2_32
  207. endif
  208. $(libpd):
  209. cd dep && git clone "https://github.com/libpd/libpd.git" --recursive
  210. cd dep/libpd && git checkout 5772a612527f06597d44d195843307ad0e3578fe
  211. ifdef ARCH_MAC
  212. # libpd's Makefile is handmade, and it doesn't honor CFLAGS and LDFLAGS environments.
  213. # So in order for Mac 10.15 (for example) to make a build that works on Mac 10.7+, we have to manually add DEP_MAC_SDK_FLAGS to CFLAGS and LDFLAGS.
  214. # We can't just add the environment's CFLAGS/LDFLAGS because `-march=nocona` makes libpd segfault when initialized.
  215. # Perhaps inline assembly is used in libpd? Who knows.
  216. cd dep/libpd && $(MAKE) MULTI=true STATIC=true ADDITIONAL_CFLAGS='-DPD_LONGINTTYPE="long long" $(DEP_MAC_SDK_FLAGS) -stdlib=libc++' ADDITIONAL_LDFLAGS='$(DEP_MAC_SDK_FLAGS) -stdlib=libc++'
  217. else
  218. cd dep/libpd && $(MAKE) MULTI=true STATIC=true ADDITIONAL_CFLAGS='-DPD_LONGINTTYPE="long long"'
  219. endif
  220. cd dep/libpd && $(MAKE) install prefix="$(DEP_PATH)"
  221. endif
  222. # Faust
  223. ifeq ($(FAUST), 1)
  224. libfaust := dep/lib/libfaust.a
  225. SOURCES += src/FaustEngine.cpp
  226. OBJECTS += $(libfaust)
  227. DEPS += $(libfaust)
  228. FLAGS += -DINTERP
  229. DISTRIBUTABLES += faust_libraries
  230. # Test using LLVM
  231. #LDFLAGS += -L/usr/local/lib -lfaust
  232. # Test using MIR
  233. #LDFLAGS += -L/usr/local/lib -lfaust dep/lib/mir-gen.o dep/lib/mir.o
  234. $(libfaust):
  235. cd dep && git clone "https://github.com/grame-cncm/faust.git" --recursive
  236. cd dep/faust && git checkout 1dfc452a8250f3123b5100edf8c882e1cea407a1
  237. cd dep/faust/build && make cmake BACKENDS=interp.cmake TARGETS=interp.cmake
  238. cd dep/faust/build && make install PREFIX="$(DEP_PATH)"
  239. cp -r dep/faust/libraries/* faust_libraries/
  240. rm -rf faust_libraries/doc
  241. rm -rf faust_libraries/docs
  242. endif
  243. include $(RACK_DIR)/plugin.mk