| 1 | |
| 2 | |
| 3 | @@ -0,0 +1,267 @@
|
| 4 | +cmake_minimum_required(VERSION 3.15)
|
| 5 | +project(JUCE VERSION 7.0.8)
|
| 6 | +
|
| 7 | +set(CMAKE_CXX_STANDARD 17)
|
| 8 | +set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
| 9 | +set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
| 10 | +
|
| 11 | +# Find required packages
|
| 12 | +find_package(PkgConfig REQUIRED)
|
| 13 | +pkg_check_modules(FREETYPE REQUIRED freetype2)
|
| 14 | +pkg_check_modules(ALSA REQUIRED alsa)
|
| 15 | +
|
| 16 | +# Each JUCE module has ONE main .cpp file (unity build)
|
| 17 | +# These files include all other implementation files
|
| 18 | +
|
| 19 | +# juce_core - the foundation module
|
| 20 | +add_library(juce_core STATIC
|
| 21 | + ${CMAKE_SOURCE_DIR}/modules/juce_core/juce_core.cpp
|
| 22 | +)
|
| 23 | +target_include_directories(juce_core PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 24 | +target_compile_definitions(juce_core PUBLIC
|
| 25 | + JUCE_WEB_BROWSER=0
|
| 26 | + JUCE_USE_CURL=0
|
| 27 | + JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1
|
| 28 | +)
|
| 29 | +target_compile_options(juce_core PRIVATE -w)
|
| 30 | +target_link_libraries(juce_core PUBLIC dw pthread dl)
|
| 31 | +
|
| 32 | +# juce_events
|
| 33 | +add_library(juce_events STATIC
|
| 34 | + ${CMAKE_SOURCE_DIR}/modules/juce_events/juce_events.cpp
|
| 35 | +)
|
| 36 | +target_include_directories(juce_events PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 37 | +target_compile_options(juce_events PRIVATE -w)
|
| 38 | +target_link_libraries(juce_events PUBLIC juce_core)
|
| 39 | +
|
| 40 | +# juce_data_structures
|
| 41 | +add_library(juce_data_structures STATIC
|
| 42 | + ${CMAKE_SOURCE_DIR}/modules/juce_data_structures/juce_data_structures.cpp
|
| 43 | +)
|
| 44 | +target_include_directories(juce_data_structures PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 45 | +target_compile_options(juce_data_structures PRIVATE -w)
|
| 46 | +target_link_libraries(juce_data_structures PUBLIC juce_core)
|
| 47 | +
|
| 48 | +# juce_graphics
|
| 49 | +add_library(juce_graphics STATIC
|
| 50 | + ${CMAKE_SOURCE_DIR}/modules/juce_graphics/juce_graphics.cpp
|
| 51 | +)
|
| 52 | +target_include_directories(juce_graphics PUBLIC
|
| 53 | + ${CMAKE_SOURCE_DIR}/modules
|
| 54 | + ${FREETYPE_INCLUDE_DIRS}
|
| 55 | +)
|
| 56 | +target_compile_options(juce_graphics PRIVATE -w)
|
| 57 | +target_link_libraries(juce_graphics PUBLIC juce_core ${FREETYPE_LIBRARIES} X11)
|
| 58 | +
|
| 59 | +# juce_gui_basics
|
| 60 | +add_library(juce_gui_basics STATIC
|
| 61 | + ${CMAKE_SOURCE_DIR}/modules/juce_gui_basics/juce_gui_basics.cpp
|
| 62 | +)
|
| 63 | +target_include_directories(juce_gui_basics PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 64 | +target_compile_options(juce_gui_basics PRIVATE -w)
|
| 65 | +target_link_libraries(juce_gui_basics PUBLIC juce_core juce_graphics juce_events X11 Xext Xrandr Xcomposite Xcursor)
|
| 66 | +
|
| 67 | +# juce_gui_extra
|
| 68 | +add_library(juce_gui_extra STATIC
|
| 69 | + ${CMAKE_SOURCE_DIR}/modules/juce_gui_extra/juce_gui_extra.cpp
|
| 70 | +)
|
| 71 | +target_include_directories(juce_gui_extra PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 72 | +target_compile_options(juce_gui_extra PRIVATE -w)
|
| 73 | +target_link_libraries(juce_gui_extra PUBLIC juce_gui_basics)
|
| 74 | +
|
| 75 | +# juce_audio_basics
|
| 76 | +add_library(juce_audio_basics STATIC
|
| 77 | + ${CMAKE_SOURCE_DIR}/modules/juce_audio_basics/juce_audio_basics.cpp
|
| 78 | +)
|
| 79 | +target_include_directories(juce_audio_basics PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 80 | +target_compile_options(juce_audio_basics PRIVATE -w)
|
| 81 | +target_link_libraries(juce_audio_basics PUBLIC juce_core)
|
| 82 | +
|
| 83 | +# juce_audio_devices
|
| 84 | +add_library(juce_audio_devices STATIC
|
| 85 | + ${CMAKE_SOURCE_DIR}/modules/juce_audio_devices/juce_audio_devices.cpp
|
| 86 | +)
|
| 87 | +target_include_directories(juce_audio_devices PUBLIC
|
| 88 | + ${CMAKE_SOURCE_DIR}/modules
|
| 89 | + ${ALSA_INCLUDE_DIRS}
|
| 90 | +)
|
| 91 | +target_compile_options(juce_audio_devices PRIVATE -w)
|
| 92 | +target_link_libraries(juce_audio_devices PUBLIC juce_audio_basics juce_events ${ALSA_LIBRARIES})
|
| 93 | +
|
| 94 | +# juce_audio_formats
|
| 95 | +add_library(juce_audio_formats STATIC
|
| 96 | + ${CMAKE_SOURCE_DIR}/modules/juce_audio_formats/juce_audio_formats.cpp
|
| 97 | +)
|
| 98 | +target_include_directories(juce_audio_formats PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 99 | +target_compile_options(juce_audio_formats PRIVATE -w)
|
| 100 | +target_link_libraries(juce_audio_formats PUBLIC juce_audio_basics)
|
| 101 | +
|
| 102 | +# juce_audio_processors
|
| 103 | +add_library(juce_audio_processors STATIC
|
| 104 | + ${CMAKE_SOURCE_DIR}/modules/juce_audio_processors/juce_audio_processors.cpp
|
| 105 | +)
|
| 106 | +target_include_directories(juce_audio_processors PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 107 | +target_compile_options(juce_audio_processors PRIVATE -w)
|
| 108 | +target_link_libraries(juce_audio_processors PUBLIC juce_gui_basics juce_audio_basics)
|
| 109 | +
|
| 110 | +# juce_audio_utils
|
| 111 | +add_library(juce_audio_utils STATIC
|
| 112 | + ${CMAKE_SOURCE_DIR}/modules/juce_audio_utils/juce_audio_utils.cpp
|
| 113 | +)
|
| 114 | +target_include_directories(juce_audio_utils PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 115 | +target_compile_options(juce_audio_utils PRIVATE -w)
|
| 116 | +target_link_libraries(juce_audio_utils PUBLIC juce_gui_extra juce_audio_devices juce_audio_formats juce_audio_processors)
|
| 117 | +
|
| 118 | +# juce_audio_plugin_client (special module - only build if .cpp exists)
|
| 119 | +if(EXISTS ${CMAKE_SOURCE_DIR}/modules/juce_audio_plugin_client/juce_audio_plugin_client.cpp)
|
| 120 | +add_library(juce_audio_plugin_client STATIC
|
| 121 | + ${CMAKE_SOURCE_DIR}/modules/juce_audio_plugin_client/juce_audio_plugin_client.cpp
|
| 122 | +)
|
| 123 | +target_include_directories(juce_audio_plugin_client PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 124 | +target_compile_options(juce_audio_plugin_client PRIVATE -w)
|
| 125 | +target_link_libraries(juce_audio_plugin_client PUBLIC juce_audio_processors juce_gui_basics)
|
| 126 | +endif()
|
| 127 | +
|
| 128 | +# juce_dsp
|
| 129 | +add_library(juce_dsp STATIC
|
| 130 | + ${CMAKE_SOURCE_DIR}/modules/juce_dsp/juce_dsp.cpp
|
| 131 | +)
|
| 132 | +target_include_directories(juce_dsp PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 133 | +target_compile_options(juce_dsp PRIVATE -w)
|
| 134 | +target_link_libraries(juce_dsp PUBLIC juce_audio_basics)
|
| 135 | +
|
| 136 | +# juce_cryptography
|
| 137 | +add_library(juce_cryptography STATIC
|
| 138 | + ${CMAKE_SOURCE_DIR}/modules/juce_cryptography/juce_cryptography.cpp
|
| 139 | +)
|
| 140 | +target_include_directories(juce_cryptography PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 141 | +target_compile_options(juce_cryptography PRIVATE -w)
|
| 142 | +target_link_libraries(juce_cryptography PUBLIC juce_core)
|
| 143 | +
|
| 144 | +# juce_opengl
|
| 145 | +add_library(juce_opengl STATIC
|
| 146 | + ${CMAKE_SOURCE_DIR}/modules/juce_opengl/juce_opengl.cpp
|
| 147 | +)
|
| 148 | +target_include_directories(juce_opengl PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 149 | +target_compile_options(juce_opengl PRIVATE -w)
|
| 150 | +target_link_libraries(juce_opengl PUBLIC juce_gui_extra GL)
|
| 151 | +
|
| 152 | +# juce_osc
|
| 153 | +add_library(juce_osc STATIC
|
| 154 | + ${CMAKE_SOURCE_DIR}/modules/juce_osc/juce_osc.cpp
|
| 155 | +)
|
| 156 | +target_include_directories(juce_osc PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 157 | +target_compile_options(juce_osc PRIVATE -w)
|
| 158 | +target_link_libraries(juce_osc PUBLIC juce_core juce_events)
|
| 159 | +
|
| 160 | +# juce_video
|
| 161 | +add_library(juce_video STATIC
|
| 162 | + ${CMAKE_SOURCE_DIR}/modules/juce_video/juce_video.cpp
|
| 163 | +)
|
| 164 | +target_include_directories(juce_video PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 165 | +target_compile_options(juce_video PRIVATE -w)
|
| 166 | +target_link_libraries(juce_video PUBLIC juce_gui_extra)
|
| 167 | +
|
| 168 | +# juce_analytics
|
| 169 | +add_library(juce_analytics STATIC
|
| 170 | + ${CMAKE_SOURCE_DIR}/modules/juce_analytics/juce_analytics.cpp
|
| 171 | +)
|
| 172 | +target_include_directories(juce_analytics PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 173 | +target_compile_options(juce_analytics PRIVATE -w)
|
| 174 | +target_link_libraries(juce_analytics PUBLIC juce_core)
|
| 175 | +
|
| 176 | +# juce_animation (if exists - some versions may not have this)
|
| 177 | +if(EXISTS ${CMAKE_SOURCE_DIR}/modules/juce_animation/juce_animation.cpp)
|
| 178 | +add_library(juce_animation STATIC
|
| 179 | + ${CMAKE_SOURCE_DIR}/modules/juce_animation/juce_animation.cpp
|
| 180 | +)
|
| 181 | +target_include_directories(juce_animation PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 182 | +target_compile_options(juce_animation PRIVATE -w)
|
| 183 | +target_link_libraries(juce_animation PUBLIC juce_gui_basics)
|
| 184 | +endif()
|
| 185 | +
|
| 186 | +# juce_box2d
|
| 187 | +add_library(juce_box2d STATIC
|
| 188 | + ${CMAKE_SOURCE_DIR}/modules/juce_box2d/juce_box2d.cpp
|
| 189 | +)
|
| 190 | +target_include_directories(juce_box2d PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 191 | +target_compile_options(juce_box2d PRIVATE -w)
|
| 192 | +target_link_libraries(juce_box2d PUBLIC juce_graphics)
|
| 193 | +
|
| 194 | +# juce_javascript (if exists - depends on version)
|
| 195 | +if(EXISTS ${CMAKE_SOURCE_DIR}/modules/juce_javascript/juce_javascript.cpp)
|
| 196 | +add_library(juce_javascript STATIC
|
| 197 | + ${CMAKE_SOURCE_DIR}/modules/juce_javascript/juce_javascript.cpp
|
| 198 | +)
|
| 199 | +target_include_directories(juce_javascript PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 200 | +target_compile_options(juce_javascript PRIVATE -w)
|
| 201 | +target_link_libraries(juce_javascript PUBLIC juce_core)
|
| 202 | +endif()
|
| 203 | +
|
| 204 | +# juce_midi_ci (if exists - newer versions)
|
| 205 | +if(EXISTS ${CMAKE_SOURCE_DIR}/modules/juce_midi_ci/juce_midi_ci.cpp)
|
| 206 | +add_library(juce_midi_ci STATIC
|
| 207 | + ${CMAKE_SOURCE_DIR}/modules/juce_midi_ci/juce_midi_ci.cpp
|
| 208 | +)
|
| 209 | +target_include_directories(juce_midi_ci PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 210 | +target_compile_options(juce_midi_ci PRIVATE -w)
|
| 211 | +target_link_libraries(juce_midi_ci PUBLIC juce_audio_basics)
|
| 212 | +endif()
|
| 213 | +
|
| 214 | +# juce_product_unlocking
|
| 215 | +add_library(juce_product_unlocking STATIC
|
| 216 | + ${CMAKE_SOURCE_DIR}/modules/juce_product_unlocking/juce_product_unlocking.cpp
|
| 217 | +)
|
| 218 | +target_include_directories(juce_product_unlocking PUBLIC ${CMAKE_SOURCE_DIR}/modules)
|
| 219 | +target_compile_options(juce_product_unlocking PRIVATE -w)
|
| 220 | +target_link_libraries(juce_product_unlocking PUBLIC juce_cryptography)
|
| 221 | +
|
| 222 | +# Install targets
|
| 223 | +install(TARGETS
|
| 224 | + juce_core
|
| 225 | + juce_events
|
| 226 | + juce_data_structures
|
| 227 | + juce_graphics
|
| 228 | + juce_gui_basics
|
| 229 | + juce_gui_extra
|
| 230 | + juce_audio_basics
|
| 231 | + juce_audio_devices
|
| 232 | + juce_audio_formats
|
| 233 | + juce_audio_processors
|
| 234 | + juce_audio_utils
|
| 235 | + juce_dsp
|
| 236 | + juce_cryptography
|
| 237 | + juce_opengl
|
| 238 | + juce_osc
|
| 239 | + juce_video
|
| 240 | + juce_analytics
|
| 241 | + juce_box2d
|
| 242 | + juce_product_unlocking
|
| 243 | + ARCHIVE DESTINATION lib
|
| 244 | + LIBRARY DESTINATION lib
|
| 245 | +)
|
| 246 | +
|
| 247 | +# Install conditional targets
|
| 248 | +if(TARGET juce_audio_plugin_client)
|
| 249 | + install(TARGETS juce_audio_plugin_client ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
|
| 250 | +endif()
|
| 251 | +if(TARGET juce_animation)
|
| 252 | + install(TARGETS juce_animation ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
|
| 253 | +endif()
|
| 254 | +if(TARGET juce_javascript)
|
| 255 | + install(TARGETS juce_javascript ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
|
| 256 | +endif()
|
| 257 | +if(TARGET juce_midi_ci)
|
| 258 | + install(TARGETS juce_midi_ci ARCHIVE DESTINATION lib LIBRARY DESTINATION lib)
|
| 259 | +endif()
|
| 260 | +
|
| 261 | +install(DIRECTORY modules/
|
| 262 | + DESTINATION include/JUCE-${PROJECT_VERSION}/modules
|
| 263 | + FILES_MATCHING PATTERN "*.h"
|
| 264 | +)
|
| 265 | +
|
| 266 | +# Install manually created scripts
|
| 267 | +install(PROGRAMS ${CMAKE_SOURCE_DIR}/juce-config DESTINATION bin)
|
| 268 | +install(FILES ${CMAKE_SOURCE_DIR}/JUCEConfig.cmake DESTINATION lib/cmake/JUCE)
|
| 269 | +install(FILES ${CMAKE_SOURCE_DIR}/juce.pc DESTINATION lib/pkgconfig)
|
| 270 | +
|