File tree 7 files changed +74
-22
lines changed
7 files changed +74
-22
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,16 @@ script:
8
8
- bash ./.travis/run.sh
9
9
10
10
env :
11
- - BUILD_TYPE=Release COMPILER =g++-4.9
12
- - BUILD_TYPE=Release COMPILER =g++-5
13
- - BUILD_TYPE=Release COMPILER =g++-6
14
- - BUILD_TYPE=Release COMPILER =clang++-3.9
15
- - BUILD_TYPE=Release COMPILER =clang++-4.0
16
- - BUILD_TYPE=Debug COMPILER =g++-4.9
17
- - BUILD_TYPE=Debug COMPILER =g++-5
18
- - BUILD_TYPE=Debug COMPILER =g++-6
19
- - BUILD_TYPE=Debug COMPILER =clang++-3.9
20
- - BUILD_TYPE=Debug COMPILER =clang++-4.0
11
+ - BUILD_TYPE=Release C_COMPILER=gcc-4.9 CXX_COMPILER =g++-4.9
12
+ - BUILD_TYPE=Release C_COMPILER=gcc-5 CXX_COMPILER =g++-5
13
+ - BUILD_TYPE=Release C_COMPILER=gcc-6 CXX_COMPILER =g++-6
14
+ - BUILD_TYPE=Release C_COMPILER=clang-3.9 CXX_COMPILER =clang++-3.9
15
+ # - BUILD_TYPE=Release C_COMPILER=clang-4.0 CXX_COMPILER =clang++-4.0
16
+ - BUILD_TYPE=Debug C_COMPILER=gcc-4.9 CXX_COMPILER =g++-4.9
17
+ - BUILD_TYPE=Debug C_COMPILER=gcc-5 CXX_COMPILER =g++-5
18
+ - BUILD_TYPE=Debug C_COMPILER=gcc-6 CXX_COMPILER =g++-6
19
+ - BUILD_TYPE=Debug C_COMPILER=clang-3.9 CXX_COMPILER =clang++-3.9
20
+ # - BUILD_TYPE=Debug C_COMPILER=clang-4.0 CXX_COMPILER =clang++-4.0
21
21
22
22
addons :
23
23
apt :
Original file line number Diff line number Diff line change @@ -5,9 +5,16 @@ project(hello CXX)
5
5
include (${CMAKE_BINARY_DIR} /conanbuildinfo.cmake)
6
6
conan_basic_setup()
7
7
8
+ include_directories (include )
9
+
8
10
set (${PROJECT_NAME} _SRC
9
11
src/main.cpp
10
12
)
11
13
12
- add_executable (${PROJECT_NAME} ${${PROJECT_NAME} _SRC})
14
+ add_library (${PROJECT_NAME} ${${PROJECT_NAME} _SRC})
13
15
target_link_libraries (${PROJECT_NAME} ${CONAN_LIBS} )
16
+
17
+ set_property (TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
18
+
19
+ enable_testing ()
20
+ add_subdirectory (test )
Original file line number Diff line number Diff line change @@ -5,14 +5,14 @@ install:
5
5
- set PATH=%PATH%;%PYTHON%/Scripts/
6
6
- pip.exe install conan
7
7
- mkdir build && cd build
8
- - conan install .. --build=missing -s build_type=%BUILD_TYPE% -s compiler="Visual Studio" -s compiler.version=%TOOLCHAIN_VERSION%
8
+ - conan install .. --build=missing -s build_type=%BUILD_TYPE% -s compiler="Visual Studio" -s compiler.version=%TOOLCHAIN_VERSION% -s compiler.runtime=%RUNTIME%
9
9
10
10
build_script :
11
11
- cmake -G "Visual Studio %TOOLCHAIN_VERSION% Win64" ..
12
- - cmake --build . --config %BUILD_TYPE%
12
+ - cmake --build . --config %BUILD_TYPE%
13
13
14
14
test_script :
15
- - cmd : " %BUILD_TYPE%\\ hello "
15
+ - cmd : ctest -V -C %BUILD_TYPE%
16
16
17
17
environment :
18
18
PYTHON : " C:\\ Python27"
@@ -21,17 +21,19 @@ environment:
21
21
matrix :
22
22
- TOOLCHAIN_VERSION : 14
23
23
BUILD_TYPE : Release
24
+ RUNTIME : MD
24
25
- TOOLCHAIN_VERSION : 12
25
26
BUILD_TYPE : Release
26
- - TOOLCHAIN_VERSION : 11
27
- BUILD_TYPE : Release
27
+ RUNTIME : MD
28
28
- TOOLCHAIN_VERSION : 10
29
29
BUILD_TYPE : Release
30
+ RUNTIME : MD
30
31
- TOOLCHAIN_VERSION : 14
31
32
BUILD_TYPE : Debug
33
+ RUNTIME : MDd
32
34
- TOOLCHAIN_VERSION : 12
33
35
BUILD_TYPE : Debug
34
- - TOOLCHAIN_VERSION : 11
35
- BUILD_TYPE : Debug
36
+ RUNTIME : MDd
36
37
- TOOLCHAIN_VERSION : 10
37
- BUILD_TYPE : Debug
38
+ BUILD_TYPE : Debug
39
+ RUNTIME : MDd
Original file line number Diff line number Diff line change
1
+ #ifndef HELLO_HELLO_H
2
+ #define HELLO_HELLO_H
3
+
4
+ #include < ostream>
5
+
6
+ namespace hello {
7
+ std::ostream& greet (std::ostream&);
8
+ }
9
+ #endif
Original file line number Diff line number Diff line change 1
- #include < iostream >
1
+ #include < hello/hello.h >
2
2
3
- int main ( ) {
4
- std::cout << " Hello, world! " << std::endl ;
3
+ std::ostream& hello::greet (std::ostream& stream ) {
4
+ return stream << " Hello, world" ;
5
5
}
Original file line number Diff line number Diff line change
1
+ cmake_minimum_required (VERSION 2.8.7)
2
+
3
+ project (test_hello CXX)
4
+
5
+ set (${PROJECT_NAME} _SRC
6
+ test_hello.cpp
7
+ )
8
+
9
+ add_executable (${PROJECT_NAME} ${${PROJECT_NAME} _SRC})
10
+
11
+ target_link_libraries (${PROJECT_NAME}
12
+ hello
13
+ ${CONAN_LIBS}
14
+ )
15
+
16
+ set_property (TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
17
+
18
+ add_test (NAME ${PROJECT_NAME}
19
+ COMMAND ${PROJECT_NAME} )
Original file line number Diff line number Diff line change
1
+ #include < sstream>
2
+
3
+ #include < gtest/gtest.h>
4
+
5
+ #include < hello/hello.h>
6
+
7
+ using namespace hello ;
8
+
9
+ TEST (hello, hello) {
10
+ std::stringstream ss;
11
+
12
+ greet (ss);
13
+
14
+ ASSERT_EQ (" Hello, world" , ss.str ());
15
+ }
You can’t perform that action at this time.
0 commit comments