1 # /*---------------------------------------------------------------------------*\
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright held by original author
7 # -------------------------------------------------------------------------------
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by the
13 # Free Software Foundation; either version 2 of the License, or (at your
14 # option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM; if not, write to the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 # CMakeLists.txt file for implementing a test harness for the compilation
27 # and test of OpenFOAM-1.5-dev using Kitware CTest./CMake/CDash
29 # The results will be submitted to the CDash server identified by the file
33 # Martin Beaudoin, Hydro-Quebec, 2010. All rights reserved
36 # \*---------------------------------------------------------------------------*/
38 cmake_minimum_required (VERSION 2.8)
40 PROJECT(OpenFOAM_1.5-dev)
42 #-----------------------------------------------------------------------------
43 # Initialization of CTest specific variables
45 # Initialize the site name
47 IF (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
48 # We can override the site name with the environment variable
49 # $CDASH_SUBMIT_LOCAL_HOST_ID
51 SITENAME $ENV{CDASH_SUBMIT_LOCAL_HOST_ID}
52 CACHE STRING "Name of the local site"
54 ELSE (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
55 # Grab the hostname FQN; will be used for the sitename
58 OUTPUT_VARIABLE SITENAME
60 ENDIF (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
62 MESSAGE("Initializing the name of this local site to: ${SITENAME}")
66 CACHE STRING "Name of the local site"
69 #Grab the OpenFOAM installation directory.
71 OF_ROOT $ENV{WM_PROJECT_DIR}
72 CACHE INTERNAL "OpenFOAM root directory."
75 # Construct the build name.
76 # No need to add $WM_PROJECT_VERSION to the name of the build,
77 # the test harness name should have taken care of that.
79 BUILDNAME $ENV{WM_OPTIONS}
80 CACHE STRING "Build ID"
83 # Find out the version of the compiler being used.
84 # Add this information to the buildname
86 IF(CMAKE_COMPILER_IS_GNUCC)
87 EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
89 OUTPUT_VARIABLE COMPILER_VERSION
91 SET(BUILDNAME "${BUILDNAME}-gcc${COMPILER_VERSION}")
92 ENDIF(CMAKE_COMPILER_IS_GNUCC)
94 # We will support more compilers eventually.
97 # Timeout for running all this: 4 hours: 4 x 3600 seconds
99 # DART_TESTING_TIMEOUT 14400
100 # CACHE STRING "Maximum time allowed (4 hours) before CTest will kill the test."
102 # Timeout for running all this: 10 minutes : 600 secondes
104 DART_TESTING_TIMEOUT 600
105 CACHE STRING "Maximum time allowed (10 minutes) before CTest will kill the test."
109 CMAKE_VERBOSE_MAKEFILE TRUE
114 #-----------------------------------------------------------------------------
115 set (UPDATE_TYPE git)
122 message("Git was found: ${GIT_EXECUTABLE}")
127 #-----------------------------------------------------------------------------
129 # Compile OpenFOAM, libs and apps
130 add_custom_target (OpenFOAM-$ENV{WM_PROJECT_VERSION} ALL
135 TARGET OpenFOAM-$ENV{WM_PROJECT_VERSION}
136 PROPERTY LABELS OpenFOAM-$ENV{WM_PROJECT_VERSION}
139 # Compile the OpenFOAM unit tests located under applications/test
140 # This part will not be compiled and run by default.
141 # This would be a good candidate for a sub-project
142 add_custom_target (OpenFOAM-$ENV{WM_PROJECT_VERSION}_unitTests
143 wmake all ${OF_ROOT}/applications/test
147 #-----------------------------------------------------------------------------
149 #Enable testing and dashboard
153 SET (CTEST_UPDATE_COMMAND ${GIT_EXECUTABLE})
156 CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 1000
157 CACHE INTERNAL "Max number of errors"
160 CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1000
161 CACHE INTERNAL "Max number of warnings"
166 # Modify this variable if you want the full length test case simulations
167 # Beware, this might take a long time to execute.
168 # Otherwise, the default behaviour is to run each tutorial for 1 "timestep"
169 #SET(RUN_FROM_ONE_TIMESTEP 0)
170 SET(RUN_FROM_ONE_TIMESTEP 1)
172 IF(RUN_FROM_ONE_TIMESTEP)
173 SET(testIdSuffix "_oneTimeStep")
174 ENDIF(RUN_FROM_ONE_TIMESTEP)
176 # OpenFOAM will run against this test suite:
178 # Add the suite of OpenFOAM tutorials
180 INCLUDE($ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/OpenFOAM_Tutorials.cmake)
182 # Add a dummy test (/bin/true, just for debugging)
184 OpenFOAM-$ENV{WM_PROJECT_VERSION}_Dummy_Test true
187 IF(RUN_FROM_ONE_TIMESTEP)
188 # Modify the cases controlDict file in order to run for only one time step
189 MESSAGE("${testRunTimeDirectory}: Modifying the controlDict files for running only one time step in directory: ${TEST_CASE_DIR}")
191 COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR}
194 ENDIF(RUN_FROM_ONE_TIMESTEP)