Skip to content

Commit

Permalink
Documenation and error checking
Browse files Browse the repository at this point in the history
- Document usage: submodues, plugins
- List available values: submodules, plugins
- Abort on bad values: submodules, plugins
  • Loading branch information
tresf committed Sep 14, 2019
1 parent f3ca7ab commit 5df372f
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 49 deletions.
35 changes: 34 additions & 1 deletion cmake/modules/CheckSubmodules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SET(DEPTH_VALUE 100)
# Number of times git commands will retry before failing
SET(MAX_ATTEMPTS 2)

MESSAGE("\nValidating submodules...")
MESSAGE("\nChecking submodules...")
IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/.gitmodules")
MESSAGE("Skipping the check because .gitmodules not detected."
"Please make sure you have all submodules in the source tree!"
Expand All @@ -46,6 +46,7 @@ SET(ENV{LANG} "en_US")
STRING(REGEX MATCHALL "path = [-0-9A-Za-z/]+" SUBMODULE_LIST ${SUBMODULE_DATA})
STRING(REGEX MATCHALL "url = [.:%-0-9A-Za-z/]+" SUBMODULE_URL_LIST ${SUBMODULE_DATA})

SET(SKIP_COUNT 0)
FOREACH(_part ${SUBMODULE_LIST})
STRING(REPLACE "path = " "" SUBMODULE_PATH ${_part})

Expand All @@ -59,6 +60,9 @@ FOREACH(_part ${SUBMODULE_LIST})
IF(${SUBMODULE_PATH} MATCHES "^plugins/")
SET(REMOVE_PLUGIN true)
FOREACH(_plugin ${PLUGIN_LIST})
IF(_plugin STREQUAL "")
CONTINUE()
ENDIF()
IF(${SUBMODULE_PATH} MATCHES "${_plugin}")
SET(REMOVE_PLUGIN false)
ENDIF()
Expand All @@ -76,6 +80,8 @@ FOREACH(_part ${SUBMODULE_LIST})
IF(${SUBMODULE_PATH} MATCHES ${_skip})
MESSAGE("-- Skipping ${SUBMODULE_PATH} matches \"${_skip}\" ${SKIP_REASON}")
SET(SKIP true)
MATH(EXPR SKIP_COUNT "${SKIP_COUNT}+1")
BREAK()
ENDIF()
ENDFOREACH()
ENDIF()
Expand All @@ -87,6 +93,33 @@ FOREACH(_part ${SUBMODULE_LIST})
LIST(REMOVE_ITEM SUBMODULE_URL_LIST ${_url})
ENDFOREACH()

# Count provided values
SET(SKIP_SUBMODULES_LENGTH 0)
FOREACH(_skip ${SKIP_SUBMODULES})
MATH(EXPR SKIP_SUBMODULES_LENGTH "${SKIP_SUBMODULES_LENGTH}+1")
ENDFOREACH()

# Abort if skip count differs from provided values
IF(NOT SKIP_SUBMODULES_LENGTH EQUAL SKIP_COUNT)
SET(FATAL_MSG "One or more submodule(s) \"${SKIP_SUBMODULES}\" was not found, aborting.\
\nFor a list of supported values try -DLIST_SUBMODULES=True\n")
UNSET(SKIP_SUBMODULES CACHE)
MESSAGE(FATAL_ERROR "${FATAL_MSG}")
ENDIF()

IF(LIST_SUBMODULES)
UNSET(LIST_SUBMODULES CACHE)
MESSAGE("\nAll possible -DSKIP_SUBMODULES values")
FOREACH(item IN LISTS SUBMODULE_LIST)
MESSAGE(" ${item}")
ENDFOREACH()
MESSAGE(
"\n"
"NOTE: A simple and more effective way to skip submodules is via -DPLUGIN_LIST.\n\n"
"See also -DLIST_PLUGINS=True for a complete list.\n"
)
MESSAGE(FATAL_ERROR "Information was requested, aborting build!")
ENDIF()

# Once called, status is stored in GIT_RESULT respectively.
# Note: Git likes to write to stderr. Don't assume stderr is error; Check GIT_RESULT instead.
Expand Down
117 changes: 69 additions & 48 deletions cmake/modules/PluginList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,56 +20,77 @@ IF(LMMS_MINIMAL)
SET(PLUGIN_LIST ${MINIMAL_LIST} ${PLUGIN_LIST})
ENDIF()

SET(LMMS_PLUGIN_LIST
${MINIMAL_LIST}
Amplifier
BassBooster
bit_invader
Bitcrush
carlabase
carlapatchbay
carlarack
CrossoverEQ
Delay
DualFilter
dynamics_processor
Eq
Flanger
HydrogenImport
ladspa_browser
LadspaEffect
lb302
MidiImport
MidiExport
MultitapEcho
monstro
nes
OpulenZ
organic
FreeBoy
patman
peak_controller_effect
GigPlayer
ReverbSC
sf2_player
sfxr
sid
SpectrumAnalyzer
stereo_enhancer
stereo_matrix
stk
vst_base
vestige
VstEffect
watsyn
waveshaper
vibed
Xpressive
zynaddsubfx
)

IF("${PLUGIN_LIST}" STREQUAL "")
SET(PLUGIN_LIST
${MINIMAL_LIST}
Amplifier
BassBooster
bit_invader
Bitcrush
carlabase
carlapatchbay
carlarack
CrossoverEQ
Delay
DualFilter
dynamics_processor
Eq
Flanger
HydrogenImport
ladspa_browser
LadspaEffect
lb302
MidiImport
MidiExport
MultitapEcho
monstro
nes
OpulenZ
organic
FreeBoy
patman
peak_controller_effect
GigPlayer
ReverbSC
sf2_player
sfxr
sid
SpectrumAnalyzer
stereo_enhancer
stereo_matrix
stk
vst_base
vestige
VstEffect
watsyn
waveshaper
vibed
Xpressive
zynaddsubfx
)
SET(PLUGIN_LIST ${LMMS_PLUGIN_LIST})
ENDIF()

ENDIF("${PLUGIN_LIST}" STREQUAL "")
MACRO(LIST_ALL_PLUGINS)
MESSAGE("\n\nAll possible -DPLUGIN_LIST values")
MESSAGE("\n KEYWORD:")
MESSAGE(" LMMS_MINIMAL")
FOREACH(item IN LISTS MINIMAL_LIST)
MESSAGE(" ${item}")
ENDFOREACH()
MESSAGE("\n NAME:")
FOREACH(item IN LISTS LMMS_PLUGIN_LIST)
MESSAGE(" ${item}")
ENDFOREACH()
MESSAGE("\nNote: This value also impacts the fetching of git submodules.\n")
MESSAGE(FATAL_ERROR "Information was requested, aborting build!")
ENDMACRO()

IF(LIST_PLUGINS)
UNSET(LIST_PLUGINS CACHE)
LIST_ALL_PLUGINS()
ENDIF()

IF(MSVC)
SET(MSVC_INCOMPATIBLE_PLUGINS
Expand Down

0 comments on commit 5df372f

Please sign in to comment.