Skip to content
Snippets Groups Projects
Select Git revision
  • 4aa85e2663c1531f1ce85fd246c8f378fcb027e3
  • stable default protected
  • MA_Pape_2018
  • MA_2018_Lopatin
  • feature/mesh_viewer
  • feature/#468_access_isosurface_scalar
  • feature/#459_default_primitives
  • master protected
  • feature/#470_Create_a_color_lookup_table
  • feature/#473_resize_companion_window
  • feature/#462_do_not_use_arb_extensions
  • feature/#495_Provide_data_for_larger_isosurfaces
  • feature/#323_default_image
  • feature/#480_Create_a_smaller_test_mesh_for_combustion_demo
  • feature/#236_Get_Integration_tests_running_on_CI
  • feature/#447_Copy_standard_assets_to_build_folder
  • 447-copy-standard-assets-to-build-folder-and-remove-resource-path
  • feature/#445_mesh_render_settings_component
  • feature/#251_Make_sure_tests_cpp_is_compiled_once
  • feature/#455_Remove_navigation_and_improve_interaction_for_combustion_demo
  • feature/446_strange_txt_files
  • v18.06.0
  • v18.05.0
  • #251_bad
  • #251_good
  • v18.03.0
  • v18.02.0
  • v18.01.0
  • v17.12.0
  • v17.11.0
  • v17.10.0
  • v17.09.0
  • v17.07.0
33 results

cpplint.cmake

Blame
  • cpplint.cmake 3.00 KiB
    #-------------------------------------------------------------------------------
    # Project Phoenix
    #
    # Copyright (c) 2017 RWTH Aachen University, Germany,
    # Virtual Reality & Immersive Visualisation Group.
    #-------------------------------------------------------------------------------
    #                                  License
    #
    # Licensed under the Apache License, Version 2.0 (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     http://www.apache.org/licenses/LICENSE-2.0
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #-------------------------------------------------------------------------------
    
    find_package(PythonInterp 2.7 REQUIRED)
    if(NOT PYTHON_EXECUTABLE)
      message(SEND_ERROR
        " ERROR: Could not find any python interpreter.
            Having a python interpreter is a mandatory requirement for cpplint.
            CMake will not generate the project without it. ")
    endif()
    if(NOT (PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR EQUAL 7))
      message(SEND_ERROR
        " ERROR: Did not find python 2.7.
            Having python 2.7 is a mandatory requirement for cpplint.
            CMake will not generate the project without it. ")  
    endif()
    
    set(CONAN_CPPLINT_DIR)
    if(TARGET CONAN_PKG::cpplint)
      # TODO(@tvierjahn) think about a better way of getting the cpplint directory
      get_property(CONAN_CPPLINT_DIR
        TARGET CONAN_PKG::cpplint
        PROPERTY INTERFACE_INCLUDE_DIRECTORIES
        )
      #This path might contain generator expressions, which we do not need here
      if(CONAN_INCLUDE_DIRS_CPPLINT_RELEASE)
    	set(CONAN_CPPLINT_DIR ${CONAN_INCLUDE_DIRS_CPPLINT_RELEASE})
      endif()
      if(EXISTS "${CONAN_CPPLINT_DIR}/cpplint.py")
        set(CPPLINT_COMMAND "${CONAN_CPPLINT_DIR}/cpplint.py")
      endif()
    else()
      message("No cpplint found through conan, try to find an installed one on the system")
      find_file(CPPLINT_COMMAND cpplint.py
        PATHS $ENV{PATH} $ENV{CPPLINT_DIR}
      )
      if(NOT CPPLINT_COMMAND)
      message(SEND_ERROR
        " ERROR: Could not find cpplint.py.
            Having cpplint.py is a mandatory requirement.
            CMake will not generate the project without it.
            Add its location to the environments variables PATH or CPPLINT_DIR.")
      endif()
    endif()
    
    function(ADD_TEST_CPPLINT)
      set(options )
      set(oneValueArgs NAME)
      set(multiValueArgs )
      cmake_parse_arguments(ADD_TEST_CPPLINT
        "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
    
      if(MSVC)
        set(CPPLINT_OUTPUT "--output=vs7")
      else()
        set(CPPLINT_OUTPUT "")
      endif()
    
      add_test(NAME "${ADD_TEST_CPPLINT_NAME}"
        COMMAND ${PYTHON_EXECUTABLE} ${CPPLINT_COMMAND} ${CPPLINT_OUTPUT}
        ${ADD_TEST_CPPLINT_UNPARSED_ARGUMENTS}
        )
      set_tests_properties(${ADD_TEST_CPPLINT_NAME} PROPERTIES TIMEOUT 7.0)
    endfunction()