CMakeLists.txt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Create blank config.h
  2. FILE(WRITE ladspa/config.h "")
  3. # Precompiler PIC Macro
  4. IF(LMMS_BUILD_WIN32)
  5. SET(PIC_FLAGS "")
  6. ELSE()
  7. SET(PIC_FLAGS "-fPIC -DPIC")
  8. ENDIF()
  9. # Additional compile flags
  10. SET(COMPILE_FLAGS "${COMPILE_FLAGS} -O3 -Wall")
  11. SET(COMPILE_FLAGS "${COMPILE_FLAGS} -fomit-frame-pointer -funroll-loops -ffast-math -c -fno-strict-aliasing")
  12. SET(COMPILE_FLAGS "${COMPILE_FLAGS} ${PIC_FLAGS}")
  13. # Loop over every XML file
  14. FILE(GLOB XML_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/*.xml")
  15. LIST(SORT XML_SOURCES)
  16. FOREACH(_item ${XML_SOURCES})
  17. # Get library name and (soon to be) C file
  18. GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE)
  19. SET(_out_file "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/${_plugin}.c")
  20. # Coerce XML source file to C
  21. ADD_CUSTOM_COMMAND(
  22. OUTPUT "${_out_file}"
  23. COMMAND ./makestub.pl "${_item}" > "${_out_file}"
  24. DEPENDS "${_item}"
  25. WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ladspa"
  26. VERBATIM
  27. )
  28. # Add a library target for this C file, which depends on success of makestup.pl
  29. ADD_LIBRARY("${_plugin}" MODULE "${_out_file}")
  30. # Vocoder does not use fftw
  31. IF(NOT ("${_plugin}" STREQUAL "vocoder_1337"))
  32. TARGET_LINK_LIBRARIES("${_plugin}" ${FFTW3F_LIBRARIES})
  33. ENDIF()
  34. IF(NOT MSVC)
  35. TARGET_LINK_LIBRARIES("${_plugin}" m)
  36. ENDIF()
  37. SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES PREFIX "")
  38. SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
  39. SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
  40. INSTALL(TARGETS "${_plugin}" LIBRARY DESTINATION "${PLUGIN_DIR}/ladspa")
  41. ENDFOREACH()
  42. ADD_DEFINITIONS(-DFFTW3)
  43. INCLUDE_DIRECTORIES(
  44. "${CMAKE_SOURCE_DIR}/include"
  45. "${CMAKE_CURRENT_SOURCE_DIR}/ladspa"
  46. "${FFTW3F_INCLUDE_DIRS}"
  47. "${CMAKE_BINARY_DIR}"
  48. )
  49. ADD_LIBRARY(iir STATIC ladspa/util/iir.c)
  50. SET_TARGET_PROPERTIES(iir PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
  51. TARGET_LINK_LIBRARIES(bandpass_a_iir_1893 iir)
  52. TARGET_LINK_LIBRARIES(bandpass_iir_1892 iir)
  53. TARGET_LINK_LIBRARIES(butterworth_1902 iir)
  54. TARGET_LINK_LIBRARIES(highpass_iir_1890 iir)
  55. TARGET_LINK_LIBRARIES(lowpass_iir_1891 iir)
  56. TARGET_LINK_LIBRARIES(notch_iir_1894 iir)
  57. FILE(GLOB GSM_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/ladspa/gsm/*.c")
  58. LIST(SORT GSM_SOURCES)
  59. ADD_LIBRARY(gsm STATIC ${GSM_SOURCES})
  60. SET_TARGET_PROPERTIES(gsm PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
  61. TARGET_LINK_LIBRARIES(gsm_1215 gsm)
  62. ADD_LIBRARY(gverb STATIC ladspa/gverb/gverb.c ladspa/gverb/gverbdsp.c)
  63. SET_TARGET_PROPERTIES(gverb PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
  64. TARGET_LINK_LIBRARIES(gverb_1216 gverb)
  65. ADD_LIBRARY(blo STATIC ladspa/util/blo.c)
  66. SET_TARGET_PROPERTIES(blo PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
  67. TARGET_LINK_LIBRARIES(analogue_osc_1416 blo)
  68. TARGET_LINK_LIBRARIES(fm_osc_1415 blo)
  69. TARGET_LINK_LIBRARIES(hermes_filter_1200 blo)
  70. ADD_LIBRARY(rms STATIC ladspa/util/rms.c)
  71. ADD_LIBRARY(db STATIC ladspa/util/db.c)
  72. SET_TARGET_PROPERTIES(rms PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
  73. SET_TARGET_PROPERTIES(db PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
  74. TARGET_LINK_LIBRARIES(sc1_1425 rms db)
  75. TARGET_LINK_LIBRARIES(sc2_1426 rms db)
  76. TARGET_LINK_LIBRARIES(sc3_1427 rms db)
  77. TARGET_LINK_LIBRARIES(sc4_1882 rms db)
  78. TARGET_LINK_LIBRARIES(sc4m_1916 rms db)
  79. TARGET_LINK_LIBRARIES(se4_1883 rms db)
  80. ADD_LIBRARY(pitchscale STATIC ladspa/util/pitchscale.c)
  81. SET_TARGET_PROPERTIES(pitchscale PROPERTIES COMPILE_FLAGS "${PIC_FLAGS}")
  82. TARGET_LINK_LIBRARIES(pitchscale -lfftw3f)
  83. TARGET_LINK_LIBRARIES(pitch_scale_1193 pitchscale)
  84. TARGET_LINK_LIBRARIES(pitch_scale_1194 pitchscale)