Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ you specify the AU format, a few more arguments become neccessary - the argument
MANUFACTURER_CODE "Brat" # REQUIRED FOR AU, UNUSED OTHERWISE - Your unique 4 character manufacturer code.
SUBTYPE_CODE "Bpi1" # REQUIRED FOR AU, UNUSED OTHERWISE - A 4 character identifier for your plugin.
AU_TYPE "aufx" # REQUIRED FOR AU, UNUSED OTHERWISE - The AU plugin type for your plugin. [2]

STRIP TRUE # OPTIONAL, DEFAULTS TO FALSE - On macOS, if provided, will add a post-build symbol strip step to your plugin
# targets, and compile with -fvisibility=hidden. Does nothing on Windows.
SIGN_ID "Developer ID Application: ...." # OPTIONAL - On macOS, if provided, will be used to sign plugin targets
)
```

Expand Down
45 changes: 45 additions & 0 deletions cmake/mostly_harmless.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@

function(mostly_harmless_enable_stripping_static_lib target location name)
if(APPLE)
target_compile_options(${target} PUBLIC $<$<CONFIG:Release>:-fvisibility=hidden>)
set(target_file ${location}/lib${name}_SharedCode.a)
add_custom_command(
TARGET ${target}
COMMAND "$<$<CONFIG:Release>:strip;-x;${target_file}>"
VERBATIM
POST_BUILD
COMMAND_EXPAND_LISTS
)
endif()
endfunction()

function(mostly_harmless_enable_stripping target name extension)
if(APPLE)
target_compile_options(${target} PUBLIC $<$<CONFIG:Release>:-fvisibility=hidden>)
set(target_file ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${name}.${extension}/Contents/MacOS/${name})
add_custom_command(
TARGET ${target}
COMMAND "$<$<CONFIG:Release>:strip;-x;${target_file}>"
VERBATIM
POST_BUILD
COMMAND_EXPAND_LISTS
)
endif()
endfunction()

function(mostly_harmless_add_binary_data pluginTarget)
set(ARGS
TARGET_NAME
Expand Down Expand Up @@ -63,6 +91,7 @@ function(mostly_harmless_add_plugin targetName)
SUBTYPE_CODE # REQUIRED IF AU
AU_TYPE # REQUIRED IF AU

STRIP # OPTIONAL, DEFAULT FALSE - if true, will strip symbols in release builds
SIGN_ID # OPTIONAL, if provided, will codesign
)

Expand Down Expand Up @@ -141,6 +170,10 @@ function(mostly_harmless_add_plugin targetName)
if (NOT DEFINED PLUGIN_FEATURES)
message(FATAL_ERROR "At least one feature is required")
endif ()
if(NOT DEFINED PLUGIN_STRIP)
set(PLUGIN_STRIP FALSE)
endif()

configure_file(
${CMAKE_CURRENT_FUNCTION_LIST_DIR}/mostlyharmless_Descriptor.cpp
${CMAKE_CURRENT_BINARY_DIR}/mostlyharmless_Descriptor.cpp
Expand All @@ -149,6 +182,9 @@ function(mostly_harmless_add_plugin targetName)
target_sources(${PLUGIN_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/mostlyharmless_Descriptor.cpp)
target_link_libraries(${PLUGIN_NAME} PUBLIC MostlyHarmless)
set_target_properties(${PLUGIN_NAME} PROPERTIES OUTPUT_NAME ${PLUGIN_NAME}_SharedCode)
if(${PLUGIN_STRIP})
mostly_harmless_enable_stripping_static_lib(${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR} ${PLUGIN_NAME})
endif()

list(FIND PLUGIN_FORMATS "CLAP" INDEX)
if (${INDEX} GREATER -1)
Expand All @@ -166,6 +202,9 @@ function(mostly_harmless_add_plugin targetName)
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PLUGIN_VERSION}
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/mostly_harmless.plist.in
)
if(${PLUGIN_STRIP})
mostly_harmless_enable_stripping(${PLUGIN_NAME}_CLAP ${PLUGIN_NAME} "clap")
endif()
if (NOT ${PLUGIN_SIGN_ID} STREQUAL "")
mostly_harmless_sign_target(${PLUGIN_NAME}_CLAP ${PLUGIN_NAME} ${PLUGIN_SIGN_ID})
endif ()
Expand Down Expand Up @@ -199,6 +238,9 @@ function(mostly_harmless_add_plugin targetName)
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PLUGIN_VERSION}
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/mostly_harmless.plist.in
)
if(${PLUGIN_STRIP})
mostly_harmless_enable_stripping(${PLUGIN_NAME}_VST3 ${PLUGIN_NAME} "vst3")
endif()
if (NOT ${PLUGIN_SIGN_ID} STREQUAL "")
mostly_harmless_sign_target(${PLUGIN_NAME}_VST3 ${PLUGIN_NAME} ${PLUGIN_SIGN_ID})
endif ()
Expand Down Expand Up @@ -244,6 +286,9 @@ function(mostly_harmless_add_plugin targetName)
SUBTYPE_CODE ${PLUGIN_SUBTYPE_CODE}
INSTRUMENT_TYPE ${PLUGIN_AU_TYPE}
)
if(${PLUGIN_STRIP})
mostly_harmless_enable_stripping(${PLUGIN_NAME}_AU ${PLUGIN_NAME} "component")
endif()
if (NOT ${PLUGIN_SIGN_ID} STREQUAL "")
mostly_harmless_sign_target(${PLUGIN_NAME}_AU ${PLUGIN_NAME} ${PLUGIN_SIGN_ID})
endif ()
Expand Down