forked from driverdevteam/tdd-course-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Cmake adding #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
RuslanValiakhmetov
wants to merge
4
commits into
master
Choose a base branch
from
cmake_adding
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Cmake adding #6
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,3 +30,8 @@ | |
| *.exe | ||
| *.out | ||
| *.app | ||
|
|
||
| # CMake results | ||
| /bin | ||
| /build64_debug | ||
| /build64_release | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "tdd_intro/3rd_party/googletest"] | ||
| path = tdd_intro/3rd_party/googletest | ||
| url = https://github.com/google/googletest.git |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| MACRO(GETSUBDIRLIST result curdir) | ||
| file(GLOB children RELATIVE ${curdir} ${curdir}/*) | ||
| set(dirlist "") | ||
| foreach(child ${children}) | ||
| if(IS_DIRECTORY ${curdir}/${child} | ||
| AND NOT "CMakeFiles" STREQUAL ${child}) | ||
| list(APPEND dirlist ${child}) | ||
| endif() | ||
| endforeach() | ||
| set(${result} ${dirlist}) | ||
| ENDMACRO(GETSUBDIRLIST) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| cmake -Htdd_intro -Bbuild64_debug -G"Visual Studio 14 2015 Win64" || goto :eof | ||
| cmake --build build64_debug --target install --config Debug || echo build64_debug failed && goto :eof | ||
|
|
||
| :: to run tests | ||
| pushd build64_debug | ||
| ctest -VV -C Debug || echo Unit-tests failed && popd && goto :eof | ||
| popd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| cmake -Htdd_intro -Bbuild64_release -G"Visual Studio 14 2015 Win64" || goto :eof | ||
| cmake --build build64_release --target install --config Release || echo build64_release failed && goto :eof | ||
|
|
||
| :: to run tests | ||
| pushd build64_release | ||
| ctest -C Release || echo Unit-tests failed && popd && goto :eof | ||
| popd |
Submodule googletest
added at
f5edb4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| cmake_minimum_required(VERSION 3.0) | ||
| project(tdd-course-3) | ||
|
|
||
| # to run tests after build | ||
| enable_testing() | ||
|
|
||
| # to enable GETSUBDIRLIST macro | ||
| set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/..") | ||
| include(GetSubdirList) | ||
|
|
||
| # turn on using solution folders for IDE | ||
| set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
|
|
||
| # Compiler flags | ||
| # /MT, /MTd - for static linkage | ||
| # /W4 - warning level 4 | ||
| # /MP - to compile by several threads | ||
| set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT") | ||
| set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") | ||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /MP") | ||
|
|
||
| # add gtest and gmock as subprojects | ||
| add_subdirectory(3rd_party/googletest EXCLUDE_FROM_ALL) | ||
|
|
||
| # organize targets in an IDE | ||
| set_target_properties(gtest gtest_main gmock_main PROPERTIES FOLDER 3rd-party/GTest) | ||
|
|
||
| include_directories(3rd_party/googletest/googletest/include) | ||
| include_directories(3rd_party/googletest/googlemock/include) | ||
|
|
||
| add_subdirectory(homework) | ||
| add_subdirectory(demo) | ||
| add_subdirectory(cleanroom) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| cmake_minimum_required(VERSION 3.0) | ||
|
|
||
| # add subproject | ||
| add_subdirectory(chatclient) | ||
| set_target_properties(chatclient chatclient_test PROPERTIES FOLDER cleanroom) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| cmake_minimum_required(VERSION 3.0) | ||
| project(chatclient) | ||
|
|
||
| add_library( | ||
| chatclient | ||
| igui.h | ||
| isocketwrapper.h | ||
| socketwrapper.h | ||
| socketwrapper.cpp | ||
| ) | ||
| target_link_libraries(chatclient Ws2_32.lib Mswsock.lib AdvApi32.lib) | ||
|
|
||
| add_executable( | ||
| chatclient_test | ||
| mocks.h | ||
| socketwrappertest.cpp | ||
| test.cpp | ||
| ) | ||
| target_link_libraries(chatclient_test chatclient gtest_main gmock_main) | ||
|
|
||
| add_test( | ||
| NAME chatclient_test | ||
| COMMAND chatclient_test | ||
| ) | ||
|
|
||
| install(TARGETS | ||
| chatclient | ||
| chatclient_test | ||
| DESTINATION ${CMAKE_SOURCE_DIR}/../bin | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| cmake_minimum_required(VERSION 3.0) | ||
|
|
||
| GETSUBDIRLIST(PROJECTS ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
|
||
| foreach(PROJ ${PROJECTS}) | ||
| project(${PROJ}) | ||
|
|
||
| if(${PROJ} STREQUAL "01_bob") | ||
| # Steps.cpp contains compile errors | ||
| FILE(GLOB SOURCES_FILES ${PROJ}/test.cpp) | ||
| else() | ||
| FILE(GLOB SOURCES_FILES ${PROJ}/*.h ${PROJ}/*.cpp) | ||
| endif() | ||
|
|
||
| add_executable(${PROJ} ${SOURCES_FILES}) | ||
| target_link_libraries(${PROJ} gtest_main gmock_main) | ||
|
|
||
| add_test(NAME ${PROJ} COMMAND ${PROJ}) | ||
| endforeach() | ||
|
|
||
| set_target_properties(${PROJECTS} PROPERTIES FOLDER demo) | ||
|
|
||
| install(TARGETS ${PROJECTS} DESTINATION ${CMAKE_SOURCE_DIR}/../bin) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| cmake_minimum_required(VERSION 3.0) | ||
|
|
||
| GETSUBDIRLIST(PROJECTS ${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
|
||
| foreach(PROJ ${PROJECTS}) | ||
| project(${PROJ}) | ||
|
|
||
| FILE(GLOB SOURCES_FILES ${PROJ}/*.h ${PROJ}/*.cpp) | ||
| add_executable(${PROJ} ${SOURCES_FILES}) | ||
| target_link_libraries(${PROJ} gtest_main gmock_main) | ||
|
|
||
| add_test(NAME ${PROJ} COMMAND ${PROJ}) | ||
| endforeach() | ||
|
|
||
| set_target_properties(${PROJECTS} PROPERTIES FOLDER homework) | ||
|
|
||
| install(TARGETS ${PROJECTS} DESTINATION ${CMAKE_SOURCE_DIR}/../bin) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этот и нижний файл так же не лишены дублирования.
Но что бы от него(дублирования) избавиться нужно пофиксить compile errors в файле demo/01_bob/Steps.cpp