Fix tutorials: corrected preconditioner syntax in system/fvSolution
[openfoam-extend-OpenFOAM-1.6-ext.git] / CMakeLists.txt
blobf7ea6858d7bdd99e774c6a74666439833e137d4b
1 # /*---------------------------------------------------------------------------*\
2 #   =========                 |
3 #   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #    \\    /   O peration     |
5 #     \\  /    A nd           | Copyright held by original author
6 #      \\/     M anipulation  |
7 # -------------------------------------------------------------------------------
8 # License
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
19 #     for more details.
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
25 # Description
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
30 #        CTestConfig.cmake
32 # Author
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
50     SET(
51           SITENAME $ENV{CDASH_SUBMIT_LOCAL_HOST_ID}
52           CACHE STRING "Name of the local site"
53     )
54 ELSE (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
55     # Grab the hostname FQN; will be used for the sitename
56     execute_process(
57         COMMAND         hostname -f
58         OUTPUT_VARIABLE SITENAME
59     )
60 ENDIF  (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
62 MESSAGE("Initializing the name of this local site to:  ${SITENAME}")
64 SET(
65     SITE ${SITENAME}
66     CACHE STRING "Name of the local site"
69 #Grab the OpenFOAM installation directory.
70 SET(
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.
78 SET(
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 
85 # This is for gcc 
86 IF(CMAKE_COMPILER_IS_GNUCC)
87   EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
88     ARGS -dumpversion
89     OUTPUT_VARIABLE COMPILER_VERSION
90   )
91   SET(BUILDNAME "${BUILDNAME}-gcc${COMPILER_VERSION}")  
92 ENDIF(CMAKE_COMPILER_IS_GNUCC)
94 # We will support more compilers eventually.
95
97 # Timeout for running all this: 4 hours: 4 x 3600 seconds
98 #SET(
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
103 SET(
104     DART_TESTING_TIMEOUT 600
105     CACHE STRING "Maximum time allowed (10 minutes) before CTest will kill the test."
108 SET(
109     CMAKE_VERBOSE_MAKEFILE TRUE
113 # Update section
114 #-----------------------------------------------------------------------------
115 set (UPDATE_TYPE git)
118 # Using GIT as SCM
120 find_package(Git)
121 if(GIT_FOUND)
122   message("Git was found: ${GIT_EXECUTABLE}")
123 endif()
126 # Build section
127 #-----------------------------------------------------------------------------
129 # Compile OpenFOAM, libs and apps
130 add_custom_target (OpenFOAM-$ENV{WM_PROJECT_VERSION} ALL
131   ${OF_ROOT}/Allwmake
134 set_property(
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
146 # Test section
147 #-----------------------------------------------------------------------------
149 #Enable testing and dashboard
150 ENABLE_TESTING()
151 INCLUDE(CTest)
153 SET (CTEST_UPDATE_COMMAND ${GIT_EXECUTABLE})
155 SET(
156     CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 1000
157     CACHE INTERNAL "Max number of errors"
159 SET(
160     CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1000
161     CACHE INTERNAL "Max number of warnings"
164 IF(BUILD_TESTING)
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
179     #
180     INCLUDE($ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/OpenFOAM_Tutorials.cmake)
182     # Add a dummy test (/bin/true, just for debugging)
183     ADD_TEST(
184         OpenFOAM-$ENV{WM_PROJECT_VERSION}_Dummy_Test true
185     )
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}")
190         EXECUTE_PROCESS(
191             COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh ${TEST_CASE_DIR}
192             WORKING_DIRECTORY .
193             )
194     ENDIF(RUN_FROM_ONE_TIMESTEP)
196 ENDIF(BUILD_TESTING)
198 # That's it.