From a42f28b1f2c63f4b8ba19c660d63461f665c946b Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 3 Oct 2017 21:24:14 +0100 Subject: Create gitignore and add Clion --- .gitignore | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d574d28 --- /dev/null +++ b/.gitignore @@ -0,0 +1,53 @@ +######### +# CLion # +######### + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties \ No newline at end of file -- cgit v1.2.1 From cacda71be04d2aab6e88cc1fc47d6a61385214c8 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 3 Oct 2017 21:26:09 +0100 Subject: Add CLion basic project, including CMake build --- .idea/GeneralSolitaireSolver.iml | 2 ++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ CMakeLists.txt | 7 +++++++ main.cpp | 6 ++++++ 6 files changed, 33 insertions(+) create mode 100644 .idea/GeneralSolitaireSolver.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 CMakeLists.txt create mode 100644 main.cpp diff --git a/.idea/GeneralSolitaireSolver.iml b/.idea/GeneralSolitaireSolver.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/GeneralSolitaireSolver.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..79b3c94 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..882d001 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1199237 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(GeneralSolitaireSolver) + +set(CMAKE_CXX_STANDARD 17) + +set(SOURCE_FILES main.cpp) +add_executable(GeneralSolitaireSolver ${SOURCE_FILES}) \ No newline at end of file diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..f253cbe --- /dev/null +++ b/main.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Hello, World!" << std::endl; + return 0; +} \ No newline at end of file -- cgit v1.2.1 From c5064699ca59935cda93be77555ad77650bd00e1 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 3 Oct 2017 23:40:54 +0100 Subject: Create proper CMake build (install & resources) --- .idea/.name | 1 + CMakeLists.txt | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++----- main.cpp | 6 ------ src/main/main.cpp | 6 ++++++ 4 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 .idea/.name delete mode 100644 main.cpp create mode 100644 src/main/main.cpp diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..a8eb715 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +solitaire_pip \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1199237..b29582d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,55 @@ -cmake_minimum_required(VERSION 3.8) -project(GeneralSolitaireSolver) +# File based on solitaire_pip at https://stackoverflow.com/questions/21163188/most-simple-but-complete-cmake-example -set(CMAKE_CXX_STANDARD 17) +cmake_minimum_required(VERSION 3.0) +project(solitaire_pip) -set(SOURCE_FILES main.cpp) -add_executable(GeneralSolitaireSolver ${SOURCE_FILES}) \ No newline at end of file +set(CMAKE_CXX_STANDARD 14) + +############################################################################### +## file globbing ############################################################## +############################################################################### + +# these instructions search the directory tree when cmake is +# invoked and put all files that match the pattern in the variables +# `sources` and `data` +file(GLOB_RECURSE sources src/main/*.cpp src/main/*.h) +file(GLOB_RECURSE sources_test src/test/*.cpp) +file(GLOB_RECURSE data resources/*) + +############################################################################### +## target definitions ######################################################### +############################################################################### + +# add the data to the target, so it becomes visible in some IDE +add_executable(solitaire_pip ${sources} ${data}) + +# just for example add some compiler flags +target_compile_options(solitaire_pip PUBLIC -std=c++1y -Wall -Wfloat-conversion) + +# this lets me include files relative to the root src dir with a <> pair +target_include_directories(solitaire_pip PUBLIC src/main) + +# this copies all resource files in the build directory +# we need this, because we want to work with paths relative to the executable +file(COPY ${data} DESTINATION resources) + +############################################################################### +## packaging ################################################################## +############################################################################### + +# all install commands get the same destination. this allows us to use paths +# relative to the executable. +install(TARGETS solitaire_pip DESTINATION solitaire_pip) +# this is basically a repeat of the file copy instruction that copies the +# resources in the build directory, but here we tell cmake that we want it +# in the package +install(DIRECTORY resources DESTINATION solitaire_pip) + +set(CPACK_OUTPUT_FILE_PREFIX installer) +set(CPACK_PACKAGE_VERSION "1.0.0") + +# we don't want to split our program up into several things +set(CPACK_MONOLITHIC_INSTALL 1) + +# This must be last +include(CPack) \ No newline at end of file diff --git a/main.cpp b/main.cpp deleted file mode 100644 index f253cbe..0000000 --- a/main.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() { - std::cout << "Hello, World!" << std::endl; - return 0; -} \ No newline at end of file diff --git a/src/main/main.cpp b/src/main/main.cpp new file mode 100644 index 0000000..f253cbe --- /dev/null +++ b/src/main/main.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Hello, World!" << std::endl; + return 0; +} \ No newline at end of file -- cgit v1.2.1 From f2dba3b2d3caeb89f28a1c84594a8a440731352e Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 4 Oct 2017 11:10:42 +0100 Subject: Add build instructions file --- build-instructions.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 build-instructions.md diff --git a/build-instructions.md b/build-instructions.md new file mode 100644 index 0000000..69a6ac0 --- /dev/null +++ b/build-instructions.md @@ -0,0 +1,17 @@ +# How to build / run the project + +The project uses the CMake build system generator. there are several stages for +building the project, running the program, and creating an installer. + +## Generate Build System + +`cmake -Bcmake-build-debug -H.` + +## Build project + +`cmake --build cmake-build-debug` + +## Create project installer + +`cpack --config cmake-build-debug/CPackConfig.cmake` + -- cgit v1.2.1 From 43591b71e8d69e2184cf1eafb8de05988b8dab53 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 4 Oct 2017 11:53:16 +0100 Subject: Add conan.io to project & add Boost to Hello World --- CMakeLists.txt | 14 ++++++++++++++ build-instructions.md | 8 ++++++++ conanfile.txt | 5 +++++ src/main/main.cpp | 13 +++++++++++-- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 conanfile.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index b29582d..d70caad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,17 @@ file(GLOB_RECURSE sources src/main/*.cpp src/main/*.h) file(GLOB_RECURSE sources_test src/test/*.cpp) file(GLOB_RECURSE data resources/*) +############################################################################### +## conan.io setup ############################################################# +############################################################################### + +if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + conan_basic_setup() +else() + message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first") +endif() + ############################################################################### ## target definitions ######################################################### ############################################################################### @@ -29,6 +40,9 @@ target_compile_options(solitaire_pip PUBLIC -std=c++1y -Wall -Wfloat-conversion) # this lets me include files relative to the root src dir with a <> pair target_include_directories(solitaire_pip PUBLIC src/main) +# link conan libraries +target_link_libraries(solitaire_pip ${CONAN_LIBS}) + # this copies all resource files in the build directory # we need this, because we want to work with paths relative to the executable file(COPY ${data} DESTINATION resources) diff --git a/build-instructions.md b/build-instructions.md index 69a6ac0..02459b4 100644 --- a/build-instructions.md +++ b/build-instructions.md @@ -3,6 +3,10 @@ The project uses the CMake build system generator. there are several stages for building the project, running the program, and creating an installer. +## Installing dependencies + +`cd cmake-build-debug; conan install ..; cd ..` + ## Generate Build System `cmake -Bcmake-build-debug -H.` @@ -11,6 +15,10 @@ building the project, running the program, and creating an installer. `cmake --build cmake-build-debug` +## Run executable + +`./cmake-build-debug/bin/solitaire_pip` + ## Create project installer `cpack --config cmake-build-debug/CPackConfig.cmake` diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..2bcb821 --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,5 @@ +[requires] +Boost/1.60.0@lasote/stable + +[generators] +cmake diff --git a/src/main/main.cpp b/src/main/main.cpp index f253cbe..0c9e38a 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -1,6 +1,15 @@ +#include #include +#include + +int main() +{ + std::string hello( "Hello, world!\n" ); + + BOOST_FOREACH( char ch, hello ) + { + std::cout << ch; + } -int main() { - std::cout << "Hello, World!" << std::endl; return 0; } \ No newline at end of file -- cgit v1.2.1 From f3527383760c2eb497a895a86fd5f3679ee0066c Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 4 Oct 2017 15:32:39 +0100 Subject: Add release as well as debug build --- .gitignore | 3 ++- build-instructions.md | 24 ++++++++++++++---------- clean-build.sh | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) create mode 100755 clean-build.sh diff --git a/.gitignore b/.gitignore index d574d28..dfd52ee 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ # CMake cmake-build-debug/ +cmake-build-release/ # Mongo Explorer plugin: .idea/**/mongoSettings.xml @@ -50,4 +51,4 @@ atlassian-ide-plugin.xml com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties -fabric.properties \ No newline at end of file +fabric.properties diff --git a/build-instructions.md b/build-instructions.md index 02459b4..8ecb321 100644 --- a/build-instructions.md +++ b/build-instructions.md @@ -3,23 +3,27 @@ The project uses the CMake build system generator. there are several stages for building the project, running the program, and creating an installer. -## Installing dependencies +### Installing dependencies -`cd cmake-build-debug; conan install ..; cd ..` +`cd cmake-build-[debug|release]; conan install ..; cd ..` -## Generate Build System +### Generate Build System -`cmake -Bcmake-build-debug -H.` +`cmake -Bcmake-build-[debug|release] -H.` -## Build project +### Build project -`cmake --build cmake-build-debug` +`cmake --build cmake-build-[debug|release]` -## Run executable +### Run executable -`./cmake-build-debug/bin/solitaire_pip` +`./cmake-build-[debug|release]/bin/solitaire_pip` -## Create project installer +### Create project installer -`cpack --config cmake-build-debug/CPackConfig.cmake` +`cpack --config cmake-build-[debug|release]/CPackConfig.cmake` +## A Note on CLion + +If CLion complains that a dependency is missing, you may need to run the conan +install command, and then in Clion run 'File->Reload CMake Project diff --git a/clean-build.sh b/clean-build.sh new file mode 100755 index 0000000..b9847a3 --- /dev/null +++ b/clean-build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +echo "Cleaning..." +rm -r cmake-build-release/*; rm -r cmake-build-debug/* + +echo "Installing..." +cd cmake-build-debug; conan install ..; cd .. +cd cmake-build-release; conan install ..; cd .. + +echo "Generating build..." +cmake -Bcmake-build-debug -H. +cmake -Bcmake-build-release -H. + +echo "Building..." +cmake --build cmake-build-debug +cmake --build cmake-build-release -- cgit v1.2.1 From 33f3a5e1a340a96d2481d2ef62d12bb26fa8d1bb Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 5 Oct 2017 00:04:52 +0100 Subject: Add GTest library to build and basic unit tests --- CMakeLists.txt | 24 ++++++++++++++++++++---- build-instructions.md | 3 ++- clean-build.sh | 6 ++++-- conanfile.txt | 4 ++++ src/test/all_tests.cpp | 10 ++++++++++ src/test/main_test.cpp | 19 +++++++++++++++++++ 6 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 src/test/all_tests.cpp create mode 100644 src/test/main_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d70caad..0ff92bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,9 +12,8 @@ set(CMAKE_CXX_STANDARD 14) # these instructions search the directory tree when cmake is # invoked and put all files that match the pattern in the variables # `sources` and `data` -file(GLOB_RECURSE sources src/main/*.cpp src/main/*.h) -file(GLOB_RECURSE sources_test src/test/*.cpp) -file(GLOB_RECURSE data resources/*) +set(sources src/main/main.cpp) +set(sources_test src/test/all_tests.cpp src/test/main_test.cpp) ############################################################################### ## conan.io setup ############################################################# @@ -32,7 +31,7 @@ endif() ############################################################################### # add the data to the target, so it becomes visible in some IDE -add_executable(solitaire_pip ${sources} ${data}) +add_executable(solitaire_pip ${sources}) # just for example add some compiler flags target_compile_options(solitaire_pip PUBLIC -std=c++1y -Wall -Wfloat-conversion) @@ -47,6 +46,23 @@ target_link_libraries(solitaire_pip ${CONAN_LIBS}) # we need this, because we want to work with paths relative to the executable file(COPY ${data} DESTINATION resources) +############################################################################### +## testing #################################################################### +############################################################################### + +add_executable(unit_tests ${sources_test}) + +# this allows us to use our executable as a link library +# therefore we can inherit all compiler options and library dependencies +set_target_properties(solitaire_pip PROPERTIES ENABLE_EXPORTS on) + +target_link_libraries(unit_tests ${CONAN_LIBS} solitaire_pip) + +ENABLE_TESTING() +ADD_TEST(NAME unit_tests + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin + COMMAND unit_tests) + ############################################################################### ## packaging ################################################################## ############################################################################### diff --git a/build-instructions.md b/build-instructions.md index 8ecb321..1240c7b 100644 --- a/build-instructions.md +++ b/build-instructions.md @@ -5,7 +5,8 @@ building the project, running the program, and creating an installer. ### Installing dependencies -`cd cmake-build-[debug|release]; conan install ..; cd ..` +`cd cmake-build-[debug|release]; conan install .. --build missing -s \ +compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd ..` ### Generate Build System diff --git a/clean-build.sh b/clean-build.sh index b9847a3..d566226 100755 --- a/clean-build.sh +++ b/clean-build.sh @@ -4,8 +4,10 @@ echo "Cleaning..." rm -r cmake-build-release/*; rm -r cmake-build-debug/* echo "Installing..." -cd cmake-build-debug; conan install ..; cd .. -cd cmake-build-release; conan install ..; cd .. +cd cmake-build-debug; conan install .. --build missing -s compiler=gcc \ + -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd .. +cd cmake-build-release; conan install .. --build missing -s compiler=gcc \ + -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd .. echo "Generating build..." cmake -Bcmake-build-debug -H. diff --git a/conanfile.txt b/conanfile.txt index 2bcb821..f181ce5 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,5 +1,9 @@ [requires] Boost/1.60.0@lasote/stable +gtest/1.8.0@lasote/stable + +[options] +gtest:shared=False [generators] cmake diff --git a/src/test/all_tests.cpp b/src/test/all_tests.cpp new file mode 100644 index 0000000..7dce333 --- /dev/null +++ b/src/test/all_tests.cpp @@ -0,0 +1,10 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/test/main_test.cpp b/src/test/main_test.cpp new file mode 100644 index 0000000..3f2081f --- /dev/null +++ b/src/test/main_test.cpp @@ -0,0 +1,19 @@ +// +// Created by thecharlesblake on 10/4/17. +// + +#include + +const int actualValTrue = 4; +const int actualValFalse = 8; +const int expectVal = 4; + +namespace { + TEST(StrCompare, CStrEqual) { + EXPECT_EQ(expectVal, actualValTrue); + } + + TEST(StrCompare, CStrNotEqual) { + EXPECT_NE(expectVal, actualValFalse); + } +} -- cgit v1.2.1 From bc6914fb1088cededf32d558db85d1e3b14d4bea Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 10 Oct 2017 14:07:39 +0100 Subject: Add compile options and integrate into build --- CMakeLists.txt | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ff92bb..b33bf3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,12 +6,9 @@ project(solitaire_pip) set(CMAKE_CXX_STANDARD 14) ############################################################################### -## file globbing ############################################################## +## source files ############################################################### ############################################################################### -# these instructions search the directory tree when cmake is -# invoked and put all files that match the pattern in the variables -# `sources` and `data` set(sources src/main/main.cpp) set(sources_test src/test/all_tests.cpp src/test/main_test.cpp) @@ -21,21 +18,37 @@ set(sources_test src/test/all_tests.cpp src/test/main_test.cpp) if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + # Disable warnings/errors for conan libraries + set(CONAN_SYSTEM_INCLUDES On) conan_basic_setup() else() message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first") endif() +############################################################################### +## compile options ############################################################ +############################################################################### + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pedantic -Wall -Wextra \ +-Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wformat=2 -Winit-self \ +-Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept \ +-Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow \ +-Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -g") +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -s -DNDEBUG -Wl,-O1") + ############################################################################### ## target definitions ######################################################### ############################################################################### +# Default to building the 'Debug' configuration +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "The build configuration" FORCE) +endif() + # add the data to the target, so it becomes visible in some IDE add_executable(solitaire_pip ${sources}) -# just for example add some compiler flags -target_compile_options(solitaire_pip PUBLIC -std=c++1y -Wall -Wfloat-conversion) - # this lets me include files relative to the root src dir with a <> pair target_include_directories(solitaire_pip PUBLIC src/main) -- cgit v1.2.1 From dca474290c5a6b722ecd86c5b5f51f91c37ea547 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 10 Oct 2017 14:08:21 +0100 Subject: Edit cmd-line build instructions to gen IDE files --- build-instructions.md | 2 +- clean-build.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build-instructions.md b/build-instructions.md index 1240c7b..85a7043 100644 --- a/build-instructions.md +++ b/build-instructions.md @@ -10,7 +10,7 @@ compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd ..` ### Generate Build System -`cmake -Bcmake-build-[debug|release] -H.` +`cmake [-G "CodeBlocks - Unix Makefiles"] -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] -Bcmake-build-[debug|release] -H.` ### Build project diff --git a/clean-build.sh b/clean-build.sh index d566226..d037403 100755 --- a/clean-build.sh +++ b/clean-build.sh @@ -10,8 +10,8 @@ cd cmake-build-release; conan install .. --build missing -s compiler=gcc \ -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd .. echo "Generating build..." -cmake -Bcmake-build-debug -H. -cmake -Bcmake-build-release -H. +cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG --target solitaire_pip -Bcmake-build-debug -H. +cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE --target solitaire_pip -Bcmake-build-release -H. echo "Building..." cmake --build cmake-build-debug -- cgit v1.2.1 From adf21a916da27743dc6a6468532af5d40f4e68c6 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 10 Oct 2017 14:29:46 +0100 Subject: Change project name to Solvitaire --- .idea/GeneralSolitaireSolver.iml | 2 -- .idea/Solvitaire.iml | 2 ++ .idea/modules.xml | 4 ++-- README.md | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 .idea/GeneralSolitaireSolver.iml create mode 100644 .idea/Solvitaire.iml diff --git a/.idea/GeneralSolitaireSolver.iml b/.idea/GeneralSolitaireSolver.iml deleted file mode 100644 index f08604b..0000000 --- a/.idea/GeneralSolitaireSolver.iml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/.idea/Solvitaire.iml b/.idea/Solvitaire.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/.idea/Solvitaire.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 882d001..98d02a1 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + - \ No newline at end of file + diff --git a/README.md b/README.md index db744db..2e9f657 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# General Solitaire Solver +# Solvitaire A solver for a variety of single-player, perfect information solitaire card games. -- cgit v1.2.1 From a70e9a857ece06da65d7ce7c6d271dcd39968d55 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 11 Oct 2017 11:00:50 +0100 Subject: Add basic logging to project --- src/main/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/main.cpp b/src/main/main.cpp index 0c9e38a..54bc493 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -1,9 +1,19 @@ #include #include #include +#include + +namespace logging = boost::log; int main() { + +#ifndef NDEBUG + BOOST_LOG_TRIVIAL(debug) << "Log debug"; +#endif + BOOST_LOG_TRIVIAL(info) << "Log info"; + BOOST_LOG_TRIVIAL(warning) << "Log warning"; + std::string hello( "Hello, world!\n" ); BOOST_FOREACH( char ch, hello ) -- cgit v1.2.1 From 6132bc9f3a8b7ce9dc1a17dd027166170697943b Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 11 Oct 2017 11:30:29 +0100 Subject: Add logging macros --- src/main/main.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main/main.cpp b/src/main/main.cpp index 54bc493..3b4b00b 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -3,16 +3,21 @@ #include #include -namespace logging = boost::log; +#if defined NDEBUG + #define LOG_DEBUG(msg) +#else + #define LOG_DEBUG(msg) BOOST_LOG_TRIVIAL(debug) << msg +#endif +#define LOG_INFO(msg) BOOST_LOG_TRIVIAL(info) << msg +#define LOG_WARNING(msg) BOOST_LOG_TRIVIAL(warning) << msg +#define LOG_ERROR(msg) BOOST_LOG_ERROR(error) << msg int main() { -#ifndef NDEBUG - BOOST_LOG_TRIVIAL(debug) << "Log debug"; -#endif - BOOST_LOG_TRIVIAL(info) << "Log info"; - BOOST_LOG_TRIVIAL(warning) << "Log warning"; + LOG_DEBUG("Log debug"); + LOG_INFO("Log info"); + LOG_WARNING("Log warning"); std::string hello( "Hello, world!\n" ); -- cgit v1.2.1 From c04bec7b528aa3fe953f6a9b838c771d02c4f3b8 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 12 Oct 2017 11:19:23 +0100 Subject: Basic Black Hole solver --- CMakeLists.txt | 2 +- src/main/Card.cpp | 25 +++++++++++++ src/main/Card.h | 19 ++++++++++ src/main/main.cpp | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 144 insertions(+), 9 deletions(-) create mode 100644 src/main/Card.cpp create mode 100644 src/main/Card.h diff --git a/CMakeLists.txt b/CMakeLists.txt index b33bf3d..196acdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set(CMAKE_CXX_STANDARD 14) ## source files ############################################################### ############################################################################### -set(sources src/main/main.cpp) +set(sources src/main/main.cpp src/main/Card.h src/main/Card.cpp) set(sources_test src/test/all_tests.cpp src/test/main_test.cpp) ############################################################################### diff --git a/src/main/Card.cpp b/src/main/Card.cpp new file mode 100644 index 0000000..ead2fd5 --- /dev/null +++ b/src/main/Card.cpp @@ -0,0 +1,25 @@ +// +// Created by thecharlesblake on 10/11/17. +// + +#include "Card.h" +#include + +Card::Card(const int r, const std::string s): rank(r), suit(s) {} + +std::ostream & operator<<(std::ostream & Str, Card const & c) { + std::string r; + if (c.rank == 1) { + r = "A"; + } else if (c.rank <= 10) { + r = std::to_string(c.rank); + } else if (c.rank == 11) { + r = "J"; + } else if (c.rank == 12) { + r = "Q"; + } else if (c.rank == 13) { + r = "K"; + } + + return Str << r << c.suit; +} \ No newline at end of file diff --git a/src/main/Card.h b/src/main/Card.h new file mode 100644 index 0000000..651df71 --- /dev/null +++ b/src/main/Card.h @@ -0,0 +1,19 @@ +// +// Created by thecharlesblake on 10/11/17. +// + +#ifndef SOLITAIRE_PIP_CARD_H +#define SOLITAIRE_PIP_CARD_H + +#include + +struct Card { + Card(const int, const std::string); + const int rank; + const std::string suit; +}; + +std::ostream & operator<<(std::ostream &, Card const &); + + +#endif //SOLITAIRE_PIP_CARD_H diff --git a/src/main/main.cpp b/src/main/main.cpp index 3b4b00b..1b75252 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -1,6 +1,10 @@ #include #include -#include +#include +#include +#include +#include +#include "Card.h" #include #if defined NDEBUG @@ -12,19 +16,106 @@ #define LOG_WARNING(msg) BOOST_LOG_TRIVIAL(warning) << msg #define LOG_ERROR(msg) BOOST_LOG_ERROR(error) << msg +using namespace std; + +bool search(vector* >, Card* hole); + int main() { + const int topRank = 4; + + vector* > tableaux; - LOG_DEBUG("Log debug"); - LOG_INFO("Log info"); - LOG_WARNING("Log warning"); + vector shuffleCards; + for (int r = 1; r <= topRank; r++) { + for (int s = 0; s < 4; s++) { + string suit; + if (s == 0) { + suit = "D"; + } else if (s == 1) { + suit = "S"; + } else if (s == 2) { + suit = "H"; + } else { + suit = "C"; + } + + Card* c = new Card(r, suit); + shuffleCards.push_back(c); + } + } - std::string hello( "Hello, world!\n" ); + auto rng = std::default_random_engine(2); // 3 has solution + std::shuffle(std::begin(shuffleCards), std::end(shuffleCards), rng); - BOOST_FOREACH( char ch, hello ) - { - std::cout << ch; + for (int i = 0; i < topRank * 2; i++) { + vector* tab = new vector(); + for (int j = 0; j < 2; j++) { + int idx = i + (topRank * 2 * j); + if (shuffleCards[idx]->suit == "S" && shuffleCards[idx]->rank == 1) { + continue; + } else { + tab->push_back(shuffleCards[idx]); + } + } + tableaux.push_back(tab); } + Card c(2, string("H")); + LOG_DEBUG(c); + + cout << (search(tableaux, new Card(1, "S")) ? "Solution Found" : "No Solution"); + return 0; +} + +bool search(vector* > tableaux, Card* hole) { + // If the tableaux are all empty, return true + + // Seaches through each tableau. If the top card is one away from + // the hole card, puts it in the hole and recurses. + // If that fails then put the card back and repeat for the next foundation + // If it succeeds, return true + + // If we get to the end of the function, return false + +#ifndef NDEBUG + string stateRep; + for (unsigned int i = 0; i < 2; i++) { + for (auto tableau : tableaux) { + if (tableau->size() > i) { + cout << *(*tableau)[i]; + } + cout << "\t"; + } + cout << "\n"; + } + cout << "Hole: " << *hole << "\n"; +#endif + + bool allTableauxEmpty = true; + for (unsigned int i = 0; i < tableaux.size(); i++) { + auto tableau = tableaux[i]; + + if (tableau->empty()) { + continue; + } else { + allTableauxEmpty = false; + } + + Card* topCard = tableau->back(); + if (topCard->rank == hole->rank + 1 || topCard->rank == hole->rank - 1) { + tableau->pop_back(); + + bool success = search(tableaux, topCard); + + if (success) { + return true; + } else { + tableau->push_back(topCard); + } + } + } + + return allTableauxEmpty; } \ No newline at end of file -- cgit v1.2.1 From a7072ff9f145267bdfa592608224fe98b8ca3d54 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 12 Oct 2017 11:44:52 +0100 Subject: Add project tools document --- docs/project-tools.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docs/project-tools.md diff --git a/docs/project-tools.md b/docs/project-tools.md new file mode 100644 index 0000000..4bbfed8 --- /dev/null +++ b/docs/project-tools.md @@ -0,0 +1,27 @@ +# Project Tools + +**Language:** C++ + +**IDE:** CLion + +**Build Tool:** CMake + +**Dependency Management:** Conan.io + +**Unit Testing:** GTest + +**Logging:** Boost logging library + +**Documentation:** Doxygen + +**Profiling:** Gperftools + +**Debugging:** GDB + +**Continuous Integration:** TravisCI + +**Version Control:** Git + +**Agile Tracking:** Trello / Kanban + +**Documentation:** Doxygen -- cgit v1.2.1 From b288d43d7eb229ac68fbbe10bba1e58d359ee4e7 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 12 Oct 2017 22:51:32 +0100 Subject: Add basic travis file --- .idea/.name | 2 +- .travis.yml | 31 +++++++++++++++++++++ CMakeLists.txt | 75 ++++++++++++++++++++++++++++++++++++-------------- CMakeLists.txt.in | 15 ++++++++++ build-instructions.md | 4 +-- clean-build.sh | 13 +++------ conanfile.txt | 9 ------ src/test/all_tests.cpp | 10 ------- 8 files changed, 107 insertions(+), 52 deletions(-) create mode 100644 .travis.yml create mode 100644 CMakeLists.txt.in delete mode 100644 conanfile.txt delete mode 100644 src/test/all_tests.cpp diff --git a/.idea/.name b/.idea/.name index a8eb715..9d853fa 100644 --- a/.idea/.name +++ b/.idea/.name @@ -1 +1 @@ -solitaire_pip \ No newline at end of file +solvitaire \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0a05d99 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +language: c++ + +install: +# Upgrade GCC +- sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y +- sudo apt-get update -qq +- sudo apt-get install -qq g++-6 +- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 + +# Boost +- echo "Installing Boost Libraries" +- sudo wget -O boost_1_63_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz/download > /dev/null 2>&1 +- sudo tar xzvf boost_1_63_0.tar.gz > /dev/null 2>&1 +- cd boost_1_63_0/ +- sudo ./bootstrap.sh --with-libraries=log > /dev/null 2>&1 +- sudo ./b2 link=shared threading=multi toolset=gcc optimization=space > /dev/null 2>&1 +- sudo ./b2 install > /dev/null 2>&1 +- cd .. + +script: +# Generate build +- cmake -G "CodeBlocks - Unix Makefiles" -D CMAKE_CXX_COMPILER=g++-6 -DCMAKE_BUILD_TYPE=DEBUG --target solvitaire -Bcmake-build-debug -H. +- cmake -G "CodeBlocks - Unix Makefiles" -D CMAKE_CXX_COMPILER=g++-6 -DCMAKE_BUILD_TYPE=RELEASE --target solvitaire -Bcmake-build-release -H. + +# Build +- cmake --build cmake-build-debug +- cmake --build cmake-build-release + +# Run unit tests +- ./cmake-build-debug/bin/unit_tests +- ./cmake-build-release/bin/unit_tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 196acdd..ee413e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,39 +1,73 @@ -# File based on solitaire_pip at https://stackoverflow.com/questions/21163188/most-simple-but-complete-cmake-example +# File based on https://stackoverflow.com/questions/21163188/most-simple-but-complete-cmake-example cmake_minimum_required(VERSION 3.0) -project(solitaire_pip) +project(solvitaire) set(CMAKE_CXX_STANDARD 14) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ############################################################################### ## source files ############################################################### ############################################################################### set(sources src/main/main.cpp src/main/Card.h src/main/Card.cpp) -set(sources_test src/test/all_tests.cpp src/test/main_test.cpp) +set(sources_test src/test/main_test.cpp) ############################################################################### -## conan.io setup ############################################################# +## Boost setup ################################################################ ############################################################################### -if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - # Disable warnings/errors for conan libraries - set(CONAN_SYSTEM_INCLUDES On) - conan_basic_setup() +set(Boost_USE_STATIC_LIBS OFF) +set(Boost_USE_MULTITHREADED ON) +set(Boost_USE_STATIC_RUNTIME OFF) +find_package(Boost 1.63.0 REQUIRED COMPONENTS log) + +if(Boost_FOUND) + include_directories(${Boost_INCLUDE_DIRS}) else() - message(WARNING "The file conanbuildinfo.cmake doesn't exist, you have to run conan install first") + message(WARNING "Must install Boost libraries") +endif() + +############################################################################### +## GTest setup ################################################################ +############################################################################### + +# Download and unpack googletest at configure time +configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) +execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) +if(result) + message(FATAL_ERROR "CMake step for googletest failed: ${result}") +endif() +execute_process(COMMAND ${CMAKE_COMMAND} --build . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download ) +if(result) + message(FATAL_ERROR "Build step for googletest failed: ${result}") +endif() + +# Add googletest directly to our build. This defines +# the gtest and gtest_main targets. +add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src + ${CMAKE_BINARY_DIR}/googletest-build) + +# The gtest/gtest_main targets carry header search path +# dependencies automatically when using CMake 2.8.11 or +# later. Otherwise we have to add them here ourselves. +if (CMAKE_VERSION VERSION_LESS 2.8.11) + include_directories("${gtest_SOURCE_DIR}/include") endif() ############################################################################### ## compile options ############################################################ ############################################################################### -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -pedantic -Wall -Wextra \ --Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wformat=2 -Winit-self \ +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -DBOOST_LOG_DYN_LINK -pthread -pedantic -Wall -Wextra \ +-Wcast-align -Wcast-qual -Wformat=2 -Winit-self \ -Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wnoexcept \ -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow \ --Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Werror") +-Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Werror") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -g") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -s -DNDEBUG -Wl,-O1") @@ -47,13 +81,12 @@ if(NOT CMAKE_BUILD_TYPE) endif() # add the data to the target, so it becomes visible in some IDE -add_executable(solitaire_pip ${sources}) +add_executable(solvitaire ${sources}) # this lets me include files relative to the root src dir with a <> pair -target_include_directories(solitaire_pip PUBLIC src/main) +target_include_directories(solvitaire PUBLIC src/main) -# link conan libraries -target_link_libraries(solitaire_pip ${CONAN_LIBS}) +target_link_libraries(solvitaire LINK_PUBLIC ${Boost_LIBRARIES}) # this copies all resource files in the build directory # we need this, because we want to work with paths relative to the executable @@ -67,9 +100,9 @@ add_executable(unit_tests ${sources_test}) # this allows us to use our executable as a link library # therefore we can inherit all compiler options and library dependencies -set_target_properties(solitaire_pip PROPERTIES ENABLE_EXPORTS on) +set_target_properties(solvitaire PROPERTIES ENABLE_EXPORTS on) -target_link_libraries(unit_tests ${CONAN_LIBS} solitaire_pip) +target_link_libraries(unit_tests gtest_main) ENABLE_TESTING() ADD_TEST(NAME unit_tests @@ -82,11 +115,11 @@ ADD_TEST(NAME unit_tests # all install commands get the same destination. this allows us to use paths # relative to the executable. -install(TARGETS solitaire_pip DESTINATION solitaire_pip) +install(TARGETS solvitaire DESTINATION solvitaire) # this is basically a repeat of the file copy instruction that copies the # resources in the build directory, but here we tell cmake that we want it # in the package -install(DIRECTORY resources DESTINATION solitaire_pip) +install(DIRECTORY resources DESTINATION solvitaire) set(CPACK_OUTPUT_FILE_PREFIX installer) set(CPACK_PACKAGE_VERSION "1.0.0") diff --git a/CMakeLists.txt.in b/CMakeLists.txt.in new file mode 100644 index 0000000..4c67ef5 --- /dev/null +++ b/CMakeLists.txt.in @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8.2) + +project(googletest-download NONE) + +include(ExternalProject) +ExternalProject_Add(googletest + GIT_REPOSITORY https://github.com/google/googletest.git + GIT_TAG master + SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src" + BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/build-instructions.md b/build-instructions.md index 85a7043..f0fe12d 100644 --- a/build-instructions.md +++ b/build-instructions.md @@ -10,7 +10,7 @@ compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd ..` ### Generate Build System -`cmake [-G "CodeBlocks - Unix Makefiles"] -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] -Bcmake-build-[debug|release] -H.` +`cmake [-G "CodeBlocks - Unix Makefiles"] -D CMAKE_CXX_COMPILER=g++-6 -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] -Bcmake-build-[debug|release] -H.` ### Build project @@ -18,7 +18,7 @@ compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd ..` ### Run executable -`./cmake-build-[debug|release]/bin/solitaire_pip` +`./cmake-build-[debug|release]/bin/solvitaire` ### Create project installer diff --git a/clean-build.sh b/clean-build.sh index d037403..5b2fd26 100755 --- a/clean-build.sh +++ b/clean-build.sh @@ -1,17 +1,12 @@ #!/bin/sh echo "Cleaning..." -rm -r cmake-build-release/*; rm -r cmake-build-debug/* - -echo "Installing..." -cd cmake-build-debug; conan install .. --build missing -s compiler=gcc \ - -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd .. -cd cmake-build-release; conan install .. --build missing -s compiler=gcc \ - -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd .. +rm -rf cmake-build-debug; mkdir cmake-build-debug; +rm -rf cmake-build-release; mkdir cmake-build-release; echo "Generating build..." -cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG --target solitaire_pip -Bcmake-build-debug -H. -cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=RELEASE --target solitaire_pip -Bcmake-build-release -H. +cmake -G "CodeBlocks - Unix Makefiles" -D CMAKE_CXX_COMPILER=g++-6 -DCMAKE_BUILD_TYPE=DEBUG --target solvitaire -Bcmake-build-debug -H. +cmake -G "CodeBlocks - Unix Makefiles" -D CMAKE_CXX_COMPILER=g++-6 -DCMAKE_BUILD_TYPE=RELEASE --target solvitaire -Bcmake-build-release -H. echo "Building..." cmake --build cmake-build-debug diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index f181ce5..0000000 --- a/conanfile.txt +++ /dev/null @@ -1,9 +0,0 @@ -[requires] -Boost/1.60.0@lasote/stable -gtest/1.8.0@lasote/stable - -[options] -gtest:shared=False - -[generators] -cmake diff --git a/src/test/all_tests.cpp b/src/test/all_tests.cpp deleted file mode 100644 index 7dce333..0000000 --- a/src/test/all_tests.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by thecharlesblake on 10/4/17. -// - -#include - -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -- cgit v1.2.1 From db2586061611dcdb49b4c71b120cf53960fad6f8 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Fri, 13 Oct 2017 18:45:48 +0100 Subject: Update build instructions with new install --- build-instructions.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/build-instructions.md b/build-instructions.md index f0fe12d..1a8980d 100644 --- a/build-instructions.md +++ b/build-instructions.md @@ -5,8 +5,32 @@ building the project, running the program, and creating an installer. ### Installing dependencies -`cd cmake-build-[debug|release]; conan install .. --build missing -s \ -compiler=gcc -s compiler.version=6.3 -s compiler.libcxx=libstdc++11; cd ..` +#### Upgrade GCC (if you don't have version 6) +`sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y` + +`sudo apt-get update -qq` + +`sudo apt-get install -qq g++-6` + +`sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6` + +#### Boost + +Note: this doesn't have to (and probably shouldn't) be run from within the project, unlike the other commands listed here. + +`sudo wget -O boost_1_63_0.tar.gz http://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz/download` + +`sudo tar xzvf boost_1_63_0.tar.gz` + +`cd boost_1_63_0/` + +`sudo ./bootstrap.sh --with-libraries=log` + +`sudo ./b2 link=shared threading=multi toolset=gcc optimization=space` + +`sudo ./b2 install` + +`cd ..` ### Generate Build System -- cgit v1.2.1