Skip to content

Commit

Permalink
edit 'share/cmake/Modules/rack-sdk.cmake' - add compile options to pl…
Browse files Browse the repository at this point in the history
…ugin and modules

Signed-off-by: Nathan <nathanjhood@googlemail.com>
  • Loading branch information
nathanjhood authored Jan 13, 2025
1 parent fc96101 commit 6ad4b47
Showing 1 changed file with 46 additions and 7 deletions.
53 changes: 46 additions & 7 deletions share/cmake/Modules/rack-sdk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,34 @@ function(vcvrack_add_plugin)
PUBLIC
unofficial-vcvrack::rack-sdk::lib
)
set_property(
TARGET plugin
PROPERTY "plugin_IS_VCVRACK_LIBRARY" TRUE # custom validation
)

# Minimum C/C++ language requirements
target_compile_features(plugin PUBLIC cxx_std_11)
target_compile_features(plugin PUBLIC c_std_11)
vcvrack_add_compile_features(plugin PUBLIC cxx_std_11)
vcvrack_add_compile_features(plugin PUBLIC c_std_11)

# Generate dependency files alongside the object files
vcvrack_add_compile_options(plugin PUBLIC "-MMD" "-MP")
# Debugger symbols. These are removed with `strip`.
vcvrack_add_compile_options(plugin PUBLIC "-g")
# Optimization
vcvrack_add_compile_options(plugin PUBLIC "-O3" "-funsafe-math-optimizations" "-fno-omit-frame-pointer")
# Warnings
vcvrack_add_compile_options(plugin PUBLIC "-Wall" "-Wextra" "-Wno-unused-parameter")
if(UNIX)
if(APPLE)
vcvrack_add_compile_options(plugin PUBLIC "-stdlib=libc++")
else() # LINUX
vcvrack_add_compile_options(plugin PUBLIC "-Wsuggest-override")
endif()
endif()
if(WIN32)
vcvrack_add_compile_definitions(plugin PUBLIC "-D_USE_MATH_DEFINES")
vcvrack_add_compile_options(plugin PUBLIC "-municode" "-Wsuggest-override")
endif()

set_target_properties(plugin
PROPERTIES
Expand All @@ -197,11 +221,6 @@ function(vcvrack_add_plugin)
NO_SONAME TRUE
)

set_property(
TARGET plugin
PROPERTY "plugin_IS_VCVRACK_LIBRARY" TRUE # custom validation
)

if(DEFINED ARG_VERSION)
set_target_properties(plugin
PROPERTIES
Expand Down Expand Up @@ -444,6 +463,26 @@ function(vcvrack_add_module name)
)
endif()

# Generate dependency files alongside the object files
vcvrack_add_compile_options(${name} PUBLIC "-MMD" "-MP")
# Debugger symbols. These are removed with `strip`.
vcvrack_add_compile_options(${name} PUBLIC "-g")
# Optimization
vcvrack_add_compile_options(${name} PUBLIC "-O3" "-funsafe-math-optimizations" "-fno-omit-frame-pointer")
# Warnings
vcvrack_add_compile_options(${name} PUBLIC "-Wall" "-Wextra" "-Wno-unused-parameter")
if(UNIX)
if(APPLE)
vcvrack_add_compile_options(${name} PUBLIC "-stdlib=libc++")
else() # LINUX
vcvrack_add_compile_options(${name} PUBLIC "-Wsuggest-override")
endif()
endif()
if(WIN32)
target_compile_definitions(${name} PUBLIC "-D_USE_MATH_DEFINES")
vcvrack_add_compile_options(${name} PUBLIC "-municode" "-Wsuggest-override")
endif()

vcvrack_add_compile_options(${name}
PUBLIC
"-fPIC"
Expand Down

0 comments on commit 6ad4b47

Please sign in to comment.