Skip to content

Commit

Permalink
Refs #10456. running clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumsteve committed Dec 18, 2014
2 parents 1a81bdb + a826649 commit a3bacb8
Show file tree
Hide file tree
Showing 2,224 changed files with 82,229 additions and 31,495 deletions.
2 changes: 2 additions & 0 deletions .clang-format
@@ -0,0 +1,2 @@
BasedOnStyle: LLVM

10 changes: 9 additions & 1 deletion Code/Mantid/Build/CMake/CommonSetup.cmake
Expand Up @@ -36,6 +36,10 @@ if ( stdint )
add_definitions ( -DHAVE_STDINT_H )
endif ( stdint )

# Configure a variable to hold the required test timeout value for all tests
set ( TESTING_TIMEOUT 300 CACHE INTEGER
"Timeout in seconds for each test (default 300=5minutes)")

###########################################################################
# Look for dependencies - bail out if any not found
###########################################################################
Expand All @@ -47,14 +51,16 @@ add_definitions ( -DBOOST_ALL_DYN_LINK )
# Need this defined globally for our log time values
add_definitions ( -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG )

find_package ( Poco REQUIRED )
find_package ( Poco 1.4.2 REQUIRED )
include_directories( SYSTEM ${POCO_INCLUDE_DIRS} )

find_package ( Nexus 4.3.0 REQUIRED )
include_directories ( SYSTEM ${NEXUS_INCLUDE_DIR} )

find_package ( MuParser REQUIRED )

find_package ( JsonCPP REQUIRED )

find_package ( Doxygen ) # optional

# Need to change search path to find zlib include on Windows.
Expand Down Expand Up @@ -239,6 +245,8 @@ endif ()
###########################################################################
if ( CMAKE_COMPILER_IS_GNUCXX )
include ( GNUSetup )
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
include ( GNUSetup )
endif ()

###########################################################################
Expand Down
12 changes: 8 additions & 4 deletions Code/Mantid/Build/CMake/DarwinSetup.cmake
Expand Up @@ -79,14 +79,16 @@ endif ()
###########################################################################
# Force 64-bit compiler as that's all we support
###########################################################################
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64" )

set ( CLANG_WARNINGS "-Wall -Wno-deprecated-register")

set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 ${CLANG_WARNINGS}" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++0x" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x" )

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register" )
set ( CMAKE_XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS "-Wno-deprecated-register")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLANG_WARNINGS} -stdlib=libc++" )
set ( CMAKE_XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS "${CLANG_WARNINGS}")
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
endif()

Expand Down Expand Up @@ -159,6 +161,8 @@ file ( GLOB THIRDPARTY_PYTHON_PACKAGES ${CMAKE_LIBRARY_PATH}/Python/* )
foreach ( PYPACKAGE ${THIRDPARTY_PYTHON_PACKAGES} )
if ( IS_DIRECTORY ${PYPACKAGE} )
install ( DIRECTORY ${PYPACKAGE} DESTINATION ${BIN_DIR} )
else()
install ( FILES ${PYPACKAGE} DESTINATION ${BIN_DIR} )
endif()
file ( COPY ${PYPACKAGE} DESTINATION ${PROJECT_BINARY_DIR}/bin )
endforeach( PYPACKAGE )
Expand Down
4 changes: 4 additions & 0 deletions Code/Mantid/Build/CMake/FindCxxTest.cmake
Expand Up @@ -160,6 +160,8 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname)
add_test ( NAME ${_cxxtest_separate_name}
COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_BINARY_DIR}/bin/Testing"
$<TARGET_FILE:${_cxxtest_testname}> ${_suitename} )
set_tests_properties ( ${_cxxtest_separate_name} PROPERTIES
TIMEOUT ${TESTING_TIMEOUT} )

if (CXXTEST_ADD_PERFORMANCE)
# ------ Performance test version -------
Expand All @@ -175,6 +177,8 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname)
add_test ( NAME ${_cxxtest_separate_name}
COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_BINARY_DIR}/bin/Testing"
$<TARGET_FILE:${_cxxtest_testname}> ${_performance_suite_name} )
set_tests_properties ( ${_cxxtest_separate_name} PROPERTIES
TIMEOUT ${TESTING_TIMEOUT} )
endif ()
endif ()
endforeach ( part ${ARGN} )
Expand Down
33 changes: 33 additions & 0 deletions Code/Mantid/Build/CMake/FindJsonCPP.cmake
@@ -0,0 +1,33 @@
# - Find jsoncpp include dirs and libraries
# Use this module by invoking find_package with the form:
# find_package(JsonCPP [required] [quiet] )
#
# The module sets the following variables
# JSONCPP_FOUND - True if headers and libraries were found
# JSONCPP_INCLUDE_DIR - jsoncpp include directories
# JSONCPP_LIBRARY - library files for linking (optimised version)
# JSONCPP_LIBRARY_DEBUG - library files for linking (debug version)
# JSONCPP_LIBRARIES - All required libraries, including the configuration type

# Headers
find_path ( JSONCPP_INCLUDE_DIR jsoncpp/json/json.h )

# Libraries
find_library ( JSONCPP_LIBRARY NAMES jsoncpp ) # optimized
find_library ( JSONCPP_LIBRARY_DEBUG NAMES jsoncpp_d ) # debug

if ( JSONCPP_LIBRARY AND JSONCPP_LIBRARY_DEBUG )
set ( JSONCPP_LIBRARIES optimized ${JSONCPP_LIBRARY} debug ${JSONCPP_LIBRARY_DEBUG} )
else()
set ( JSONCPP_LIBRARIES ${JSONCPP_LIBRARY} )
endif()

# Handle the QUIETLY and REQUIRED arguments and set JSONCPP_FOUND to TRUE if
# all listed variables are TRUE
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args( JsonCPP DEFAULT_MSG JSONCPP_INCLUDE_DIR JSONCPP_LIBRARIES )

# Advanced variables
mark_as_advanced ( JSONCPP_INCLUDE_DIR JSONCPP_LIBRARIES )


36 changes: 34 additions & 2 deletions Code/Mantid/Build/CMake/FindPoco.cmake
Expand Up @@ -47,10 +47,42 @@ set ( POCO_LIBRARIES ${POCO_LIB_FOUNDATION}

endif()

# Set a version string by examining either the Poco/Version.h header or
# the Poco/Foundation.h header if Version.h does not exist
if( POCO_INCLUDE_DIR )
if ( EXISTS ${POCO_INCLUDE_DIR}/Poco/Version.h )
set ( VERSION_FILE ${POCO_INCLUDE_DIR}/Poco/Version.h )
else ()
set ( VERSION_FILE ${POCO_INCLUDE_DIR}/Poco/Foundation.h )
endif ()
# regex quantifiers like {8} don't seem to work so we'll stick with + even though
# it's not strictly true
set ( VERS_REGEX "^#define[ \t]+POCO_VERSION[ \t]+0x([0-9]+)$" )
file ( STRINGS ${VERSION_FILE} POCO_VERSION REGEX ${VERS_REGEX} )
# pull out just the part after the 0x
string( REGEX REPLACE ${VERS_REGEX} "\\1" POCO_VERSION ${POCO_VERSION} )
# Pretty format
string( SUBSTRING ${POCO_VERSION} 0 2 POCO_VERSION_MAJOR )
string( REGEX REPLACE "^0" "" POCO_VERSION_MAJOR ${POCO_VERSION_MAJOR} )
string( SUBSTRING ${POCO_VERSION} 2 2 POCO_VERSION_MINOR )
string( REGEX REPLACE "^0" "" POCO_VERSION_MINOR ${POCO_VERSION_MINOR} )
string( SUBSTRING ${POCO_VERSION} 4 2 POCO_VERSION_PATCH )
string( REGEX REPLACE "^0" "" POCO_VERSION_PATCH ${POCO_VERSION_PATCH} )

set ( POCO_VERSION "${POCO_VERSION_MAJOR}.${POCO_VERSION_MINOR}.${POCO_VERSION_PATCH}" )
endif()


# handle the QUIETLY and REQUIRED arguments and set POCO_FOUND to TRUE if
# all listed variables are TRUE
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Poco DEFAULT_MSG POCO_LIBRARIES POCO_INCLUDE_DIR )
if (POCO_VERSION)
find_package_handle_standard_args( Poco REQUIRED_VARS POCO_LIBRARIES POCO_INCLUDE_DIR
VERSION_VAR POCO_VERSION )
else ()
message (status "Failed to determine Poco version: Ignoring requirement")
find_package_handle_standard_args( Poco DEFAULT_MSG POCO_LIBRARIES POCO_INCLUDE_DIR )
endif ()

mark_as_advanced ( POCO_INCLUDE_DIR
POCO_LIB_FOUNDATION POCO_LIB_FOUNDATION_DEBUG
Expand All @@ -59,4 +91,4 @@ mark_as_advanced ( POCO_INCLUDE_DIR
POCO_LIB_NET POCO_LIB_NET_DEBUG
POCO_LIB_CRYPTO POCO_LIB_CRYPTO_DEBUG
POCO_LIB_NETSSL POCO_LIB_NETSSL_DEBUG
)
)
25 changes: 12 additions & 13 deletions Code/Mantid/Build/CMake/FindPyUnitTest.cmake
Expand Up @@ -29,27 +29,26 @@ macro ( PYUNITTEST_ADD_TEST _test_src_dir _testname_prefix )
add_test ( NAME ${_pyunit_separate_name}_Debug CONFIGURATIONS Debug
COMMAND ${PYTHON_EXECUTABLE_DEBUG} -B ${_test_src_dir}/${_filename} )
# Set the PYTHONPATH so that the built modules can be found
set_property ( TEST ${_pyunit_separate_name}_Debug
PROPERTY ENVIRONMENT "PYTHONPATH=${_module_dir_debug}" )
set_property ( TEST ${_pyunit_separate_name}_Debug
PROPERTY WORKING_DIRECTORY ${_working_dir_debug} )

set_tests_properties ( ${_pyunit_separate_name}_Debug PROPERTIES
ENVIRONMENT "PYTHONPATH=${_module_dir}"
WORKING_DIRECTORY ${_working_dir}
TIMEOUT ${TESTING_TIMEOUT} )
# Release
add_test ( NAME ${_pyunit_separate_name} CONFIGURATIONS Release
COMMAND ${PYTHON_EXECUTABLE} -B ${_test_src_dir}/${_filename} )
# Set the PYTHONPATH so that the built modules can be found
set_property ( TEST ${_pyunit_separate_name}
PROPERTY ENVIRONMENT "PYTHONPATH=${_module_dir}" )
set_property ( TEST ${_pyunit_separate_name}
PROPERTY WORKING_DIRECTORY ${_working_dir} )
set_tests_properties ( ${_pyunit_separate_name} PROPERTIES
ENVIRONMENT "PYTHONPATH=${_module_dir}"
WORKING_DIRECTORY ${_working_dir}
TIMEOUT ${TESTING_TIMEOUT} )
else()
add_test ( NAME ${_pyunit_separate_name}
COMMAND ${PYTHON_EXECUTABLE} -B ${_test_src_dir}/${_filename} )
# Set the PYTHONPATH so that the built modules can be found
set_property ( TEST ${_pyunit_separate_name}
PROPERTY ENVIRONMENT "PYTHONPATH=${_module_dir}" )
set_property ( TEST ${_pyunit_separate_name}
PROPERTY WORKING_DIRECTORY ${_working_dir} )
set_tests_properties ( ${_pyunit_separate_name} PROPERTIES
ENVIRONMENT "PYTHONPATH=${_module_dir}"
WORKING_DIRECTORY ${_working_dir}
TIMEOUT ${TESTING_TIMEOUT} )
endif()
endforeach ( part ${ARGN} )
endmacro ( PYUNITTEST_ADD_TEST )
Expand Down
8 changes: 4 additions & 4 deletions Code/Mantid/Build/CMake/FindTcmalloc.cmake
Expand Up @@ -6,14 +6,14 @@
# TCMALLOC_LIBRARIES libraries to link against
# TCMALLOC_FOUND If false, do not try to use TCMALLOC

find_path ( TCMALLOC_INCLUDE_DIR tcmalloc.h
PATHS /usr/include/google
find_path ( TCMALLOC_INCLUDE_DIR tcmalloc.h
PATHS /usr/include/gperftools
)

find_library ( TCMALLOC_LIB NAMES tcmalloc tcmalloc_minimal )
find_library ( TCMALLOC_LIB NAMES tcmalloc_minimal tcmalloc )
set ( TCMALLOC_LIBRARIES ${TCMALLOC_LIB} )

# handle the QUIETLY and REQUIRED arguments and set TCMALLOC_FOUND to TRUE if
# handle the QUIETLY and REQUIRED arguments and set TCMALLOC_FOUND to TRUE if
# all listed variables are TRUE
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Tcmalloc DEFAULT_MSG TCMALLOC_LIBRARIES TCMALLOC_INCLUDE_DIR )
Expand Down
18 changes: 13 additions & 5 deletions Code/Mantid/Build/CMake/GNUSetup.cmake
Expand Up @@ -7,8 +7,12 @@
# for that project.

# Set our own compiler version flag from the cmake one and export it globally
set( GCC_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION} CACHE INTERNAL "")
message( STATUS "gcc version: ${GCC_COMPILER_VERSION}" )
if ( CMAKE_COMPILER_IS_GNUCXX )
set( GCC_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION} CACHE INTERNAL "")
message( STATUS "gcc version: ${GCC_COMPILER_VERSION}" )
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
message( STATUS "clang version ${CMAKE_CXX_COMPILER_VERSION}" )
endif()

# Global warning flags.
set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -fno-common" )
Expand All @@ -20,9 +24,13 @@ set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qua
set( GNUFLAGS "${GNUFLAGS} -Wno-deprecated -Wno-write-strings")

# Check if we have a new enough version for this flag
IF (GCC_COMPILER_VERSION VERSION_GREATER "4.3")
set(GNUFLAGS "${GNUFLAGS} -Wno-unused-result")
ENDIF (GCC_COMPILER_VERSION VERSION_GREATER "4.3")
if ( CMAKE_COMPILER_IS_GNUCXX )
if (GCC_COMPILER_VERSION VERSION_GREATER "4.3")
set(GNUFLAGS "${GNUFLAGS} -Wno-unused-result")
endif ()
elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
set(GNUFLAGS "${GNUFLAGS} -Wno-sign-conversion")
endif()

# Add some options for debug build to help the Zoom profiler
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer" )
Expand Down

0 comments on commit a3bacb8

Please sign in to comment.