ADTF  3.18.5
compile_test.h
Go to the documentation of this file.
1 
8 #ifndef _A_UTILS_TESTBENCH_COMPILE_TEST_HEADER_INCLUDED_
9 #define _A_UTILS_TESTBENCH_COMPILE_TEST_HEADER_INCLUDED_
10 
11 #ifdef WIN32
12  static const tInt PLATFORM_IDENTIFIER = 0; //identifies Windows
13 #else
14  static const tInt PLATFORM_IDENTIFIER = 1; //identifies Linux
15 #endif // WIN32
16 
17 #ifdef CMAKE_DEFAULT_COMMAND_SET
18  //already set
19 #else
20  #define CMAKE_DEFAULT_COMMAND_SET "cmake"
21 #endif //CMAKE_DEFAULT_COMMAND_SET
22 
96 {
97 private:
99  template<tInt Platform> struct platform_specific
100  {
101  static const tChar* const default_generator();
102  };
103 
105  template<tInt Generator> struct to_generator { static const tChar* const current(); };
106 
107 public: //types
108 
111  {
118  };//enum eCCTCMakeGenerators
119 
120 public:
127  A_UTILS_NS::cFilename&& i_strCmakeCommand = CMAKE_DEFAULT_COMMAND_SET);
128 
131 
139  template<tInt Generator = CCT_GENERATOR_DEFAULT>
140  tBool SetUp(A_UTILS_NS::cString&& i_strTargetName)
141  {
142  return SetUp(std::move(i_strTargetName),
144  }
145 
152 
158 
159 private: //helper functions
166  tBool SetUp(A_UTILS_NS::cString&& i_strTargetName,
167  A_UTILS_NS::cString&& i_strGenerator);
168 
174 
180 
186 
187 private:
191 };//class cCompileTimeTest
192 
193 template<> struct cCompileTimeTest::platform_specific<0>//Windows specific
194 {
195  static const tChar* const default_generator() { return "Visual Studio 15 2017 Win64"; }
196 };
197 
198 template<> struct cCompileTimeTest::platform_specific<1> //Linux specific
199 {
200  static const tChar* const default_generator() { return "Unix Makefiles"; }
201 };
202 
204 {
205  static const tChar* const current()
206  {
208  }
209 };
210 
212 {
213 #ifdef CMAKE_DEFAULT_GENERATOR_SET
214  static const tChar* const current() { return CMAKE_DEFAULT_GENERATOR_SET; }
215 #else
216  static const tChar* const current()
217  {
220  }
221 #endif //CMAKE_DEFAULT_GENERATOR_SET
222 };
223 
225 {
226  static const tChar* const current() { return platform_specific<1>::default_generator(); }
227 };
228 
230 {
231  static const tChar* const default_generator() { return "Visual Studio 14 2015 Win64"; }
232 };
233 
235 {
236  static const tChar* const current() { return platform_specific<0>::default_generator(); }
237 };
238 
239 
240 #endif // _A_UTILS_TESTBENCH_COMPILE_TEST_HEADER_INCLUDED_
char tChar
The tChar defines the type for platform character set (platform and compiler dependent type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
bool tBool
The tBool defines the type for the Values tTrue and tFalse (platform and compiler dependent).
File name class.
Definition: filename.h:59
Implements basic functionality to test whether compile process fails (or succeeds)
Definition: compile_test.h:96
tBool BuildTarget(A_UTILS_NS::cString &&i_strTargetName)
Build a target from the cmake project.
cCompileTimeTest(A_UTILS_NS::cFilename &&i_strProjectPath, A_UTILS_NS::cFilename &&i_strCmakeCommand=CMAKE_DEFAULT_COMMAND_SET)
Constructor.
const A_UTILS_NS::cFilename m_strProjectPath
path to project containing targets to build
Definition: compile_test.h:188
tBool TearDown()
Deletes the entire build directory (automatically called on destruction).
A_UTILS_NS::cString GetAdtfDir() const
Get directory to ADTF installation which is under test in the current test bench.
tBool SetUp(A_UTILS_NS::cString &&i_strTargetName)
Generate build files and initially build a target.
Definition: compile_test.h:140
eCCTCMakeGenerators
All currently supported CMake generators. Usable in tBool cCompileTimeTest::SetUp()
Definition: compile_test.h:111
@ CCT_GENERATOR_UNIX_MAKEFILES
"Unix Makefiles" (Linux only)
Definition: compile_test.h:115
@ CCT_GENERATOR_VS15_WIN64
"Visual Studio 15 2017 Win64" (Win64 only)
Definition: compile_test.h:117
@ CCT_GENERATOR_PLATFORM_DEFAULT
Default generator (Linux: "Unix Makefiles", Win64: "Visual Studio 12 2013 Win64")
Definition: compile_test.h:114
@ CCT_GENERATOR_VS14_WIN64
"Visual Studio 14 2015 Win64" (Win64 only)
Definition: compile_test.h:116
@ CCT_GENERATOR_DEFAULT
The same generator this project was generated with.
Definition: compile_test.h:112
const A_UTILS_NS::cString & GetOutput() const
Get the console output of the last executed command.
A_UTILS_NS::cString GetBuildDir() const
Get the current build directory.
A_UTILS_NS::cString m_strConsoleOut
Contains output of the last executed command.
Definition: compile_test.h:190
~cCompileTimeTest()
Destructor.
tBool SetUp(A_UTILS_NS::cString &&i_strTargetName, A_UTILS_NS::cString &&i_strGenerator)
Generate build files and initially build a target.
const A_UTILS_NS::cFilename m_strCmakeCommand
path to cmake executable to use
Definition: compile_test.h:189
platform specific settings
Definition: compile_test.h:100
"stringify" the cmake generator
Definition: compile_test.h:105