Skip to content

Commit c22e7a6

Browse files
committed
Merge branch 'release/2.1.3'
2 parents 3e4680c + 2a5556f commit c22e7a6

File tree

39 files changed

+301
-133
lines changed

39 files changed

+301
-133
lines changed

appveyor.yml renamed to .appveyor.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ environment:
1111
configuration: "Debug"
1212
build_system: cmake
1313
conan_args: "-s arch=x86_64 -s build_type=Debug -s compiler=\"Visual Studio\" -s compiler.version=15 --build"
14+
boost_root: C:/Libraries/boost_1_69_0
15+
boost_lib: C:/Libraries/boost_1_69_0/lib64-msvc-14.0
1416

1517
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
1618
compiler: msvc-15-seh
@@ -19,6 +21,8 @@ environment:
1921
configuration: "Debug"
2022
build_system: cmake
2123
conan_args: "-s arch=x86 -s build_type=Debug -s compiler=\"Visual Studio\" -s compiler.version=15 --build"
24+
boost_root: C:/Libraries/boost_1_69_0
25+
boost_lib: C:/Libraries/boost_1_69_0/lib32-msvc-14.0
2226

2327
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
2428
compiler: msvc-16-seh
@@ -28,6 +32,8 @@ environment:
2832
arch: "-A x64"
2933
build_system: cmake
3034
conan_args: "-s arch=x86_64 -s build_type=Debug -s compiler=\"Visual Studio\" -s compiler.version=16 --build"
35+
boost_root: C:/Libraries/boost_1_71_0
36+
boost_lib: C:/Libraries/boost_1_71_0/lib64-msvc-14.0
3137

3238
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
3339
compiler: msvc-16-seh
@@ -37,6 +43,8 @@ environment:
3743
arch: "-A Win32"
3844
build_system: cmake
3945
conan_args: "-s arch=x86 -s build_type=Debug -s compiler=\"Visual Studio\" -s compiler.version=16 --build"
46+
boost_root: C:/Libraries/boost_1_71_0
47+
boost_lib: C:/Libraries/boost_1_71_0/lib32-msvc-14.0
4048

4149
install:
4250
- cmd: |
@@ -50,10 +58,10 @@ build_script:
5058
- cmd: |
5159
mkdir build
5260
cd build
53-
echo conan install ../conanfile.txt %conan_args%
54-
conan install ../conanfile.txt %conan_args%
55-
echo cmake -G "%generator%" %arch% -DUSE_CONAN_LIBS=true -DCMAKE_VERBOSE_MAKEFILE=true ..
56-
cmake -G "%generator%" %arch% -DUSE_CONAN_LIBS=true -DCMAKE_VERBOSE_MAKEFILE=true ..
61+
echo conan install ../.conan/conanfile_noboost.txt %conan_args%
62+
conan install ../.conan/conanfile_noboost.txt %conan_args%
63+
echo cmake -G "%generator%" %arch% -DUSE_CONAN_JSONCPP=ON -DUSE_CONAN_GTEST=ON -DBOOST_ROOT="%boost_root%" -DBOOST_LIBRARYDIR="%boost_lib%" -DBoost_USE_STATIC_LIBS=ON ..
64+
cmake -G "%generator%" %arch% -DUSE_CONAN_JSONCPP=ON -DUSE_CONAN_GTEST=ON -DBOOST_ROOT="%boost_root%" -DBOOST_LIBRARYDIR="%boost_lib%" -DBoost_USE_STATIC_LIBS=ON ..
5765
echo msbuild /m hackerrank.sln /p:Configuration=%configuration% /p:Platform=%platform%
5866
msbuild /m hackerrank.sln /p:Configuration=%configuration% /p:Platform=%platform%
5967

.conan/conanfile_noboost.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[requires]
2+
gtest/1.10.0
3+
jsoncpp/1.9.4
4+
5+
[generators]
6+
cmake
7+
8+
[options]
9+
gtest:shared=True
10+
11+
[imports]
12+
bin, *.dll -> ./bin
13+
lib, *.dylib* -> ./bin

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ matrix:
1313
- CMAKE_EXE_LINKER_FLAGS="--coverage"
1414
addons:
1515
apt:
16+
update: true
1617
sources:
1718
- sourceline: 'ppa:ubuntu-toolchain-r/test'
1819
- sourceline: 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main'
@@ -22,6 +23,7 @@ matrix:
2223
- clang-11
2324
- cmake
2425
- lcov
26+
- libboost1.71-all-dev
2527
- os: linux
2628
compiler: gcc
2729
env:
@@ -32,12 +34,14 @@ matrix:
3234
- CMAKE_EXE_LINKER_FLAGS="-coverage -lgcov"
3335
addons:
3436
apt:
37+
update: true
3538
sources:
3639
- sourceline: 'ppa:ubuntu-toolchain-r/test'
3740
packages:
3841
- g++-10
3942
- cmake
4043
- lcov
44+
- libboost1.71-all-dev
4145

4246
install:
4347
- "[ $CXX = g++ ] && export CXX=g++-10 || true"
@@ -50,8 +54,8 @@ script:
5054
- |
5155
mkdir build
5256
cd build
53-
conan install ../conanfile.txt ${CONAN_ARGS}
54-
cmake -DUSE_CONAN_LIBS=true -DCMAKE_VERBOSE_MAKEFILE=true -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" ..
57+
conan install ../.conan/conanfile_noboost.txt ${CONAN_ARGS}
58+
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" -DUSE_CONAN_JSONCPP=ON -DUSE_CONAN_GTEST=ON ..
5559
make -j
5660
make test ARGS="-j -V"
5761

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
3+
}

CMakeLists.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,24 @@ project(hackerrank)
55

66
set(CMAKE_BUILD_TYPE Debug)
77

8-
set(USE_CONAN_LIBS FALSE CACHE BOOL "Download Conan libraries")
8+
set(USE_CONAN_BOOST FALSE CACHE BOOL "Download Boost from Conan Repo")
9+
set(USE_CONAN_JSONCPP FALSE CACHE BOOL "Download JsonCpp from Conan Repo")
10+
set(USE_CONAN_GTEST FALSE CACHE BOOL "Download GTest from Conan Repo")
11+
912
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
1013

11-
include(${CMAKE_SOURCE_DIR}/scripts/cmake/compiler_check.cmake)
12-
include(${CMAKE_SOURCE_DIR}/scripts/cmake/list_folders.cmake)
13-
include(${CMAKE_SOURCE_DIR}/scripts/cmake/project_add_all_folders.cmake)
14-
include(${CMAKE_SOURCE_DIR}/scripts/cmake/conan_custom_setup.cmake)
15-
include(${CMAKE_SOURCE_DIR}/scripts/cmake/hackerrank_challenge.cmake)
14+
include(${CMAKE_SOURCE_DIR}/cmake/compiler_check.cmake)
15+
include(${CMAKE_SOURCE_DIR}/cmake/list_folders.cmake)
16+
include(${CMAKE_SOURCE_DIR}/cmake/project_add_all_folders.cmake)
17+
include(${CMAKE_SOURCE_DIR}/cmake/conan_custom_setup.cmake)
18+
include(${CMAKE_SOURCE_DIR}/cmake/hackerrank_challenge.cmake)
19+
include(${CMAKE_SOURCE_DIR}/cmake/build_dependencies.cmake)
1620

1721
compiler_check()
1822

19-
if (USE_CONAN_LIBS)
20-
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
21-
conan_custom_setup()
22-
else()
23-
find_package(PkgConfig REQUIRED)
24-
pkg_check_modules(JsonCpp REQUIRED jsoncpp>=1.9.4)
25-
find_package(Boost 1.68.0)
26-
endif (USE_CONAN_LIBS)
23+
enable_testing()
24+
25+
check_build_dependencies()
2726

2827
include(CTest)
2928

cmake/build_dependencies.cmake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
macro(check_build_dependencies)
2+
set(USE_CONAN_LIBS false)
3+
4+
if(USE_CONAN_BOOST)
5+
set(USE_CONAN_LIBS true)
6+
else()
7+
find_package(Boost 1.68.0 REQUIRED)
8+
endif()
9+
10+
if(USE_CONAN_JSONCPP)
11+
set(USE_CONAN_LIBS true)
12+
else()
13+
find_package(PkgConfig REQUIRED)
14+
pkg_check_modules(JsonCpp REQUIRED jsoncpp>=1.9.4)
15+
endif()
16+
17+
if(USE_CONAN_GTEST)
18+
set(USE_CONAN_LIBS true)
19+
else()
20+
find_package(GTest 1.7 REQUIRED)
21+
endif()
22+
23+
if (USE_CONAN_LIBS)
24+
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
25+
conan_custom_setup()
26+
endif()
27+
endmacro()
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@ macro(hackerrank_challenge_test)
4040
if (USE_CONAN_LIBS)
4141
target_link_libraries(${ProjectTest} ${ProjectId} ${TestBaseProject} ${CONAN_LIBS})
4242
else()
43-
# GTest
44-
find_package(GTest REQUIRED)
4543
include_directories(${GTEST_INCLUDE_DIRS})
46-
4744
target_link_libraries(${ProjectTest} ${ProjectId} ${TestBaseProject} ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread)
4845
endif (USE_CONAN_LIBS)
4946

0 commit comments

Comments
 (0)