Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions CMake/packages/FindClangFormat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,30 @@
# THE POSSIBILITY OF SUCH DAMAGE.

string(REPLACE ":" ";" _PATH $ENV{PATH})
set(CLANG_FORMAT_FOUND OFF)
foreach(p ${_PATH})
file(GLOB cand ${p}/clang-format*)
if(cand)
set(CLANG_FORMAT_EXECUTABLE ${cand})
set(CLANG_FORMAT_FOUND ON)
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} -version OUTPUT_VARIABLE clang_out )
string(REGEX MATCH .*\(version[^\n]*\)\n version ${clang_out})
set(CLANG_FORMAT_VERSION ${CMAKE_MATCH_1})
break()
else()
set(CLANG_FORMAT_FOUND OFF)
file(GLOB cand ${p}/clang-format ${p}/clang-format-[0-9].[0-9])
foreach(candidate ${cand})
set(CLANG_FORMAT_EXECUTABLE ${candidate})
execute_process(COMMAND ${CLANG_FORMAT_EXECUTABLE} -version OUTPUT_VARIABLE clang_out )
string(REGEX MATCH "version \([0-9]\\.[0-9]\)" VERSION_OUTPUT ${clang_out})
set(CLANG_FORMAT_VERSION ${CMAKE_MATCH_1})
if ((${CLANG_FORMAT_VERSION} VERSION_GREATER ${CLANG_FORMAT_MIN_VERSION}) OR (${CLANG_FORMAT_VERSION} VERSION_EQUAL ${CLANG_FORMAT_MIN_VERSION}))
set (FIT_MIN_REQUIRED true)
else ()
set (FIT_MIN_REQUIRED false)
endif()
if ((${CLANG_FORMAT_VERSION} VERSION_LESS ${CLANG_FORMAT_MAX_VERSION}) OR (${CLANG_FORMAT_VERSION} VERSION_EQUAL ${CLANG_FORMAT_MAX_VERSION}))
set (FIT_MAX_REQUIRED true)
else ()
set (FIT_MAX_REQUIRED false)
endif()
if ( ${FIT_MIN_REQUIRED} AND ${FIT_MAX_REQUIRED})
set(CLANG_FORMAT_FOUND ON)
break()
endif()
endforeach()
if (${CLANG_FORMAT_FOUND})
break()
endif()
endforeach()
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ add_definitions(-DCORENEURON_BUILD)
option (ENABLE_SELECTIVE_GPU_PROFILING "Enable GPU profiling only for Solver" ON)
option (ENABLE_OPENACC "Enable use of OpenACC" OFF)

set(CLANG_FORMAT_MIN_VERSION "4.0")
set(CLANG_FORMAT_MAX_VERSION "4.9")
find_package(ClangFormat)

if(CLANG_FORMAT_FOUND)
message("clang-format : ${CLANG_FORMAT_EXECUTABLE} : ${CLANG_FORMAT_VERSION}")
else()
message("clang-format executable not found")
message("clang-format executable with appropriate version (min: ${CLANG_FORMAT_MIN_VERSION}, max: ${CLANG_FORMAT_MAX_VERSION}) not found")
endif()

if(CLANG_FORMAT_FOUND)
Expand Down Expand Up @@ -255,6 +257,8 @@ endif(CORENEURON_MAIN)
# Tests
if(Boost_FOUND)
add_subdirectory(tests)
else()
message(STATUS "Boost not found, disabling tests")
endif(Boost_FOUND)


Expand Down
28 changes: 14 additions & 14 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ endif()


if(UNIT_TESTS)

add_subdirectory(unit/endian)
add_subdirectory(unit/sdprintf)
add_subdirectory(unit/mechbuild)
add_subdirectory(unit/omp)
add_subdirectory(unit/cmdline_interface)
add_subdirectory(unit/interleave_info)
add_subdirectory(unit/alignment)
add_subdirectory(unit/queueing)

add_subdirectory(unit/endian)
add_subdirectory(unit/sdprintf)
add_subdirectory(unit/mechbuild)
add_subdirectory(unit/omp)
add_subdirectory(unit/cmdline_interface)
add_subdirectory(unit/interleave_info)
add_subdirectory(unit/alignment)
add_subdirectory(unit/queueing)
else()
message(STATUS "Unit tests disabled")
endif()

if(FUNCTIONAL_TESTS)

add_subdirectory(integration)
add_subdirectory(regression)

add_subdirectory(integration)
add_subdirectory(regression)
else()
message(STATUS "Functional tests disabled")
endif()