cmake_minimum_required(VERSION 3.23) project(Pascalcompressor VERSION 1.0.0 LANGUAGES C CXX OBJC OBJCXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") message(FATAL_ERROR "Pascalcompressor targets macOS arm64 (VST3 + AU).") endif() set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0 CACHE STRING "Minimum macOS deployment target") set(CMAKE_OSX_ARCHITECTURES arm64 CACHE STRING "Architecture") set(JUCE_TAG "8.0.15" CACHE STRING "JUCE git tag to fetch") include(FetchContent) if(JUCE_DIR) add_subdirectory(${JUCE_DIR} juce) else() set(JUCE_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(JUCE_BUILD_EXTRAS OFF CACHE BOOL "" FORCE) FetchContent_Declare(juce GIT_REPOSITORY https://github.com/juce-framework/JUCE.git GIT_TAG ${JUCE_TAG} GIT_SHALLOW TRUE) FetchContent_MakeAvailable(juce) endif() set(PASCAL_GENERATED_DIR "${CMAKE_BINARY_DIR}/generated") file(MAKE_DIRECTORY "${PASCAL_GENERATED_DIR}") execute_process( COMMAND /bin/sh -c "date '+%Y-%m-%d %H:%M:%S %Z'" OUTPUT_VARIABLE PASCAL_BUILD_TIME OUTPUT_STRIP_TRAILING_WHITESPACE) if(NOT PASCAL_BUILD_TIME) string(TIMESTAMP PASCAL_BUILD_TIME "%Y-%m-%d %H:%M:%S %Z") endif() file(WRITE "${PASCAL_GENERATED_DIR}/BuildInfo.h" "#pragma once\n" "#define PASCAL_BUILD_TIME \"${PASCAL_BUILD_TIME}\"\n") juce_add_plugin(Pascalcompressor PRODUCT_NAME Pascalcompressor COMPANY_NAME "Pascal" BUNDLE_ID com.pascal.pascalcompressor PLUGIN_MANUFACTURER_CODE PscC PLUGIN_CODE Pscp FORMATS AU VST3 IS_SYNTH NO NEEDS_MIDI_INPUT NO NEEDS_MIDI_OUTPUT NO IS_MIDI_EFFECT NO COPY_PLUGIN_AFTER_BUILD FALSE) target_include_directories(Pascalcompressor PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/Source" "${PASCAL_GENERATED_DIR}") target_compile_definitions(Pascalcompressor PUBLIC JUCE_VST3_CAN_REPLACE_VST2=0) target_sources(Pascalcompressor PRIVATE Source/Compressor.cpp Source/PluginProcessor.cpp Source/PluginEditor.cpp) target_link_libraries(Pascalcompressor PRIVATE juce::juce_core juce::juce_events juce::juce_graphics juce::juce_gui_basics juce::juce_gui_extra juce::juce_audio_basics juce::juce_audio_processors juce::juce_audio_utils juce::juce_dsp) set(PASCAL_BUILDINFO "${PASCAL_GENERATED_DIR}/BuildInfo.h") set_source_files_properties(Source/PluginEditor.cpp PROPERTIES OBJECT_DEPENDS "${PASCAL_BUILDINFO}") # Sign each format bundle from its own target. Signing on the shared-library # target rewrote the bundle binaries' mtimes every build, which made make treat # them as always up to date and never relinked them. add_custom_command(TARGET Pascalcompressor_AU POST_BUILD COMMAND codesign --force --sign - "${CMAKE_BINARY_DIR}/Pascalcompressor_artefacts/$/AU/Pascalcompressor.component" VERBATIM) add_custom_command(TARGET Pascalcompressor_VST3 POST_BUILD COMMAND codesign --force --sign - "${CMAKE_BINARY_DIR}/Pascalcompressor_artefacts/$/VST3/Pascalcompressor.vst3" VERBATIM)