Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
qno committed Jan 7, 2023
1 parent 07fd476 commit 01d87df
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions RackSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ message(STATUS "Load RackSDK.cmake (mapping based on Rack-SDK-${RACK_SDK_VERSION

if ("${RACK_SDK_DIR}" STREQUAL "")
message(FATAL_ERROR "Path to Rack SDK is missing! Add -DRACK_SDK_DIR=<PATH> to the cmake call.")
else ()
elseif (EXISTS "${RACK_SDK_DIR}/include/rack.hpp")
message(STATUS "Using Rack-SDK in '${RACK_SDK_DIR}'")
else ()
message(FATAL_ERROR "Couldn't find 'include/rack.hpp' in '${RACK_SDK_DIR}'")
endif ()

if ("${PLUGIN_NAME}" STREQUAL "")
Expand Down Expand Up @@ -45,19 +47,19 @@ add_compile_options(-g)
# Optimization
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS "Skipping Optimizations for Debug Build")
else()
else ()
message(STATUS "Enabling Optimizations for Non-Debug Build")
add_compile_options(-O3 -funsafe-math-optimizations -fno-omit-frame-pointer)
endif()
endif ()
# Warnings
add_compile_options(-Wall -Wextra -Wno-unused-parameter)
# C++ standard
if (DEFINED CMAKE_CXX_STANDARD)
message(STATUS "Retaining CMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}")
else()
else ()
set(CMAKE_CXX_STANDARD 11)
message(STATUS "Defaulting CMAKE_CXX_STANDARD to ${CMAKE_CXX_STANDARD}")
endif()
endif ()

add_library(${RACK_PLUGIN_LIB} MODULE)
set_target_properties(${RACK_PLUGIN_LIB} PROPERTIES PREFIX "")
Expand Down Expand Up @@ -107,10 +109,14 @@ install(TARGETS ${RACK_PLUGIN_LIB} LIBRARY DESTINATION ${PROJECT_BINARY_DIR}/${P
install(DIRECTORY ${PROJECT_BINARY_DIR}/${PLUGIN_NAME}/ DESTINATION ${PLUGIN_NAME})
file(COPY ${PLUGIN_DISTRIBUTABLES} DESTINATION ${PLUGIN_NAME})

set(STABLE_PLUGIN_BUILD_TARGET build_plugin)
add_custom_target(${STABLE_PLUGIN_BUILD_TARGET})
add_dependencies(${STABLE_PLUGIN_BUILD_TARGET} ${RACK_PLUGIN_LIB})

# A quick installation target to copy the plugin library and plugin.json into VCV Rack plugin folder for development.
# CMAKE_INSTALL_PREFIX needs to point to the VCV Rack plugin folder in user documents.
add_custom_target(${RACK_PLUGIN_LIB}_quick_install
add_custom_target(${STABLE_PLUGIN_BUILD_TARGET}_quick_install
COMMAND cmake -E copy $<TARGET_FILE:${RACK_PLUGIN_LIB}> ${CMAKE_INSTALL_PREFIX}/${PLUGIN_NAME}
COMMAND cmake -E copy ${CMAKE_SOURCE_DIR}/plugin.json ${CMAKE_INSTALL_PREFIX}/${PLUGIN_NAME}
)
add_dependencies(${RACK_PLUGIN_LIB}_quick_install ${RACK_PLUGIN_LIB})
add_dependencies(${STABLE_PLUGIN_BUILD_TARGET}_quick_install ${RACK_PLUGIN_LIB})

0 comments on commit 01d87df

Please sign in to comment.