Merge /u/wyldckat/foam-extend32/ branch master into master
[foam-extend-3.2.git] / testHarness / OSIG / Turbomachinery / CMakeFiles / CMakeLists.txt
blobe3087a4d5a2872c08c2df4cc665af7f11313cf84
1 # /*-------------------------------------------------------------------------*\
2 #   =========                 |
3 #   \\      /  F ield         | foam-extend: Open Source CFD
4 #    \\    /   O peration     |
5 #     \\  /    A nd           | For copyright notice see file Copyright
6 #      \\/     M anipulation  |
7 # -----------------------------------------------------------------------------
8 # License
9 #     This file is part of foam-extend.
11 #     foam-extend 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 3 of the License, or (at your
14 #     option) any later version.
16 #     foam-extend is distributed in the hope that it will be useful, but
17 #     WITHOUT ANY WARRANTY; without even the implied warranty of
18 #     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 #     General Public License for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with foam-extend.  If not, see <http://www.gnu.org/licenses/>.
24 # Description
25 #        CMakeLists.txt file for implementing a test harness for the
26 #        Turbomachinery OSIG test cases
28 #        The results will be submitted to the CDash server identified by
29 #        CTestConfig.cmake
31 # Author
32 #        Martin Beaudoin, Hydro-Quebec, 2010. All rights reserved
35 # \*-------------------------------------------------------------------------*/
37 cmake_minimum_required (VERSION 2.8)
39 PROJECT(Turbomachinery-1.5-dev)
41 #-----------------------------------------------------------------------------
42 # Initialization of CTest specific variables
44 # Initialize the site name
46 IF (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
47     # We can override the site name with the environment variable
48     # $CDASH_SUBMIT_LOCAL_HOST_ID
49     SET(
50           SITENAME $ENV{CDASH_SUBMIT_LOCAL_HOST_ID}
51           CACHE STRING "Name of the local site"
52     )
53 ELSE (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
54     # Grab the hostname FQN; will be used for the sitename
55     execute_process(
56         COMMAND         hostname -f
57         OUTPUT_VARIABLE SITENAME
58     )
59 ENDIF  (NOT $ENV{CDASH_SUBMIT_LOCAL_HOST_ID} STREQUAL "")
61 MESSAGE("Initializing the name of this local site to:  ${SITENAME}")
63 SET(
64     SITE ${SITENAME}
65     CACHE STRING "Name of the local site"
68 #Grab the Turbomachinery OSIG base directory
69 SET(
70     TURBOMACHINERY_OSIG_ROOT $ENV{BREEDER_OSIG_TURBOMACHINERY_DIR}
71     CACHE INTERNAL  "Turbomachinery OSIG root directory."
74 # Construct the build name.
75 # No need to add $WM_PROJECT_VERSION to the name of the build,
76 # the test harness name should have taken care of that.
77 SET(
78     BUILDNAME $ENV{WM_OPTIONS}
79     CACHE STRING "Build ID"
82 # Find out the version of the compiler being used.
83 # Add this information to the buildname
84 # This is for gcc
85 IF(CMAKE_COMPILER_IS_GNUCC)
86   EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
87     ARGS -dumpversion
88     OUTPUT_VARIABLE COMPILER_VERSION
89   )
90   SET(BUILDNAME "${BUILDNAME}-gcc${COMPILER_VERSION}")
91 ENDIF(CMAKE_COMPILER_IS_GNUCC)
93 # We will support more compilers eventually.
96 # Timeout for running all this: 4 hours: 4 x 3600 seconds
97 SET(
98     DART_TESTING_TIMEOUT 14400
99     CACHE STRING "Maximum time allowed (4 hours) before CTest will kill the test."
102 SET(
103     CMAKE_VERBOSE_MAKEFILE TRUE
107 # Update section
108 #-----------------------------------------------------------------------------
109 set (UPDATE_TYPE svn)
112 # Build section
113 #--------------------------------------------------------------------------------
115 # Compile the libs
116 add_custom_target (Turbo_Libs-src-$ENV{WM_PROJECT_VERSION} ALL
117   ./Allwmake
118   WORKING_DIRECTORY ${TURBOMACHINERY_OSIG_ROOT}/src
120 set_property(
121   TARGET          Turbo_Libs-src-$ENV{WM_PROJECT_VERSION}
122   PROPERTY LABELS Turbo_Libs-src-$ENV{WM_PROJECT_VERSION}
125 # rotorStatorInterfaces is not compiled by default
126 # MB 22/06/2010
127 add_custom_target (Turbo_Libs-rotorStatorInterfaces-$ENV{WM_PROJECT_VERSION}
128   wmake libso
129   WORKING_DIRECTORY ${TURBOMACHINERY_OSIG_ROOT}/rotorStatorInterfaces
131 set_property(
132   TARGET          Turbo_Libs-rotorStatorInterfaces-$ENV{WM_PROJECT_VERSION}
133   PROPERTY LABELS Turbo_Libs-rotorStatorInterfaces-$ENV{WM_PROJECT_VERSION}
136 # We need the Breeder's simpleFunctionObjects library
137 add_custom_target (Breeder_Libs-simpleFunctionObjects-$ENV{WM_PROJECT_VERSION} ALL
138   wmake libso
139   WORKING_DIRECTORY $ENV{BREEDER_15_DIR}/libraries/simpleFunctionObjects
141 set_property(
142   TARGET          Breeder_Libs-simpleFunctionObjects-$ENV{WM_PROJECT_VERSION}
143   PROPERTY LABELS Breeder_Libs-simpleFunctionObjects-$ENV{WM_PROJECT_VERSION}
147 # Compile the apps
148 add_custom_target (Turbo_Apps-Utilities-$ENV{WM_PROJECT_VERSION} ALL
149   wmake all
150   WORKING_DIRECTORY ${TURBOMACHINERY_OSIG_ROOT}/applications/utilities
152 set_property(
153   TARGET          Turbo_Apps-Utilities-$ENV{WM_PROJECT_VERSION}
154   PROPERTY LABELS Turbo_Apps-Utilities-$ENV{WM_PROJECT_VERSION}
157 add_custom_target (Turbo_Apps-Solvers-$ENV{WM_PROJECT_VERSION} ALL
158   wmake all
159   WORKING_DIRECTORY ${TURBOMACHINERY_OSIG_ROOT}/applications/solvers
161 set_property(
162   TARGET          Turbo_Apps-Solvers-$ENV{WM_PROJECT_VERSION}
163   PROPERTY LABELS Turbo_Apps-Solvers-$ENV{WM_PROJECT_VERSION}
166 add_custom_target (Turbo_Apps-SingleChannelPump-initalizeRotation-$ENV{WM_PROJECT_VERSION} ALL
167   wmake
168   WORKING_DIRECTORY ${TURBOMACHINERY_OSIG_ROOT}/singleChannelPump/initializeRotation
170 set_property(
171   TARGET          Turbo_Apps-SingleChannelPump-initalizeRotation-$ENV{WM_PROJECT_VERSION}
172   PROPERTY LABELS Turbo_Apps-SingleChannelPump-initalizeRotation-$ENV{WM_PROJECT_VERSION}
175 # Adding target-level dependencies so the building is made in proper order
176 add_dependencies(
177   Turbo_Apps-Utilities-$ENV{WM_PROJECT_VERSION} Turbo_Libs-src-$ENV{WM_PROJECT_VERSION}
180 # Test section
181 #-----------------------------------------------------------------------------
183 #Enable testing and dashboard
184 ENABLE_TESTING()
185 INCLUDE(CTest)
187 SET (CTEST_UPDATE_COMMAND "svn")
189 SET(
190     CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 1000
191     CACHE INTERNAL "Max number of errors"
193 SET(
194     CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1000
195     CACHE INTERNAL "Max number of warnings"
198 IF(BUILD_TESTING)
200     # Modify this variable if you want the full length test case simulations
201     # Beware, this might take a long time to execute.
202     # Otherwise, the default behaviour is to run each test case for 1 "timestep"
203     #SET(RUN_FROM_ONE_TIMESTEP 0)
204     SET(RUN_FROM_ONE_TIMESTEP 1)
206     IF(RUN_FROM_ONE_TIMESTEP)
207         SET(testIdSuffix "_oneTimeStep")
208     ENDIF(RUN_FROM_ONE_TIMESTEP)
210     # Definition of the test suite:
212     # Run the suite of Turbomachinery test cases
213     #
214     INCLUDE($ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/TurbomachineryTestsuites_ercoftacConicalDiffuser.cmake)
215     INCLUDE($ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/TurbomachineryTestsuites_ercoftacCentrifugalPump.cmake)
216     INCLUDE($ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/TurbomachineryTestsuites_singleChannelPump.cmake)
217     INCLUDE($ENV{FOAM_TEST_HARNESS_DIR}/CMakeFiles/TurbomachineryTestsuites_tutorials.cmake)
219     # Add a dummy test (/bin/true, just for debugging)
220     ADD_TEST(
221          Turbo_Dummy_Test-$ENV{WM_PROJECT_VERSION} true
222     )
224     IF(RUN_FROM_ONE_TIMESTEP)
225         # Modify the cases controlDict file in order to run for only one time step
226         MESSAGE("${testRunTimeDirectory}: Modifying the controlDict files for running only one time step in directory: TurbomachineryTestSuites${testIdSuffix}")
227         EXECUTE_PROCESS(
228             COMMAND $ENV{FOAM_TEST_HARNESS_DIR}/scripts/prepareCasesForOneTimeStep.sh TurbomachineryTestSuites${testIdSuffix}
229             WORKING_DIRECTORY .
230             )
231     ENDIF(RUN_FROM_ONE_TIMESTEP)
233 ENDIF(BUILD_TESTING)
235 # That's it.