Skip to content

Commit

Permalink
Issue #1988 Making spell and lint optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeandersson committed Apr 20, 2017
1 parent dfbd64f commit d2cd07a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 26 deletions.
12 changes: 10 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ option(WITH_REFCOUNT_WARNINGS "Issue warnings upon reference counting failure" O
option(WITH_SELFCONTAINED "Make the install directory self-contained" OFF)
option(WITH_DEPRECATED_FEATURES "Compile with syntax that is scheduled to be deprecated" ON)
option(WITH_EXTENDING_CASADI "Compile a demonstration that shows how a project that depends on CasADi can be implemented." OFF)
option(WITH_LINT "Compile with support for linting (syntax checking)" ON)
option(WITH_SPELL "Compile with support for spell-checking" ON)

# static on windows, shared on linux/osx by default
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
Expand Down Expand Up @@ -633,8 +635,14 @@ if(WITH_PYTHON OR WITH_MATLAB OR WITH_OCTAVE OR WITH_JSON)
add_subdirectory(swig)
endif()

include(CppLint)
include(SpellCheck)
if(WITH_LINT)
include(CppLint)
endif()

if(WITH_SPELL)
include(SpellCheck)
endif()

include(embed_resources)
include(GenerateExportHeader)

Expand Down
43 changes: 22 additions & 21 deletions casadi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,17 @@ macro(casadi_library name)
)
endif()

# Lint etc
add_style_check_target(${name} "${ARGN}")
set_property(GLOBAL APPEND PROPERTY LINT_TARGETS "lint_${name}")
add_spell_check_target(${name} "${ARGN}")
set_property(GLOBAL APPEND PROPERTY SPELL_TARGETS "spell_${name}")
set(SPELL_TARGETS ${SPELL_TARGETS} "spell_${name}" PARENT_SCOPE)
if(WITH_LINT)
add_style_check_target(${name} "${ARGN}")
set_property(GLOBAL APPEND PROPERTY LINT_TARGETS "lint_${name}")
endif()

if(WITH_SPELL)
add_spell_check_target(${name} "${ARGN}")
set_property(GLOBAL APPEND PROPERTY SPELL_TARGETS "spell_${name}")
set(SPELL_TARGETS ${SPELL_TARGETS} "spell_${name}" PARENT_SCOPE)
endif()

set_property(GLOBAL APPEND PROPERTY CASADI_MODULES ${name})
endmacro()

Expand All @@ -95,22 +100,18 @@ endif()
add_definitions(-DSHARED_LIBRARY_PREFIX="\\"${CMAKE_SHARED_LIBRARY_PREFIX}\\"")
add_definitions(-DSHARED_LIBRARY_SUFFIX="\\"${CMAKE_SHARED_LIBRARY_SUFFIX}\\"")

add_subdirectory(core) # needed by all except external_packages
add_subdirectory(interfaces) # needs external_packages
add_subdirectory(solvers) # needs interfaces
add_subdirectory(core)
add_subdirectory(interfaces)
add_subdirectory(solvers)

get_property(LINT_TARGETS GLOBAL PROPERTY LINT_TARGETS)
get_property(SPELL_TARGETS GLOBAL PROPERTY SPELL_TARGETS)

# add a dummy custom target which does nothing but
# depend on the other lint targets
add_custom_target(lint
DEPENDS ${LINT_TARGETS}
VERBATIM)

add_custom_target(spell
DEPENDS ${SPELL_TARGETS}
VERBATIM)
if(WITH_LINT)
get_property(LINT_TARGETS GLOBAL PROPERTY LINT_TARGETS)
add_custom_target(lint DEPENDS ${LINT_TARGETS} VERBATIM)
endif()
if(WITH_SPELL)
get_property(SPELL_TARGETS GLOBAL PROPERTY SPELL_TARGETS)
add_custom_target(spell DEPENDS ${SPELL_TARGETS} VERBATIM)
endif()

get_property(CASADI_MODULES GLOBAL PROPERTY CASADI_MODULES)
get_property(CASADI_PLUGINS GLOBAL PROPERTY CASADI_PLUGINS)
Expand Down
11 changes: 8 additions & 3 deletions casadi/interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ if(BLOCKSQP_FOUND)
add_subdirectory(blocksqp)
endif()


if(HPMPC_FOUND)
add_subdirectory(hpmpc)
endif()
Expand All @@ -79,6 +78,12 @@ if(SLICOT_FOUND)
add_subdirectory(slicot)
endif()

set(LINT_TARGETS ${LINT_TARGETS} PARENT_SCOPE)
set(SPELL_TARGETS ${SPELL_TARGETS} PARENT_SCOPE)
if(WITH_LINT)
set(LINT_TARGETS ${LINT_TARGETS} PARENT_SCOPE)
endif()

if(WITH_SPELL)
set(SPELL_TARGETS ${SPELL_TARGETS} PARENT_SCOPE)
endif()

set(CASADI_MODULES ${CASADI_MODULES} PARENT_SCOPE)

0 comments on commit d2cd07a

Please sign in to comment.