aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthecharlesblake2017-10-04 11:53:16 +0100
committerthecharlesblake2017-10-13 18:46:14 +0100
commit43591b71e8d69e2184cf1eafb8de05988b8dab53 (patch)
tree37f411591e2ac6b48f3d6a7bb25035a6ff6f7750
parentAdd build instructions file (diff)
downloadmetasol-43591b71e8d69e2184cf1eafb8de05988b8dab53.tar.gz
metasol-43591b71e8d69e2184cf1eafb8de05988b8dab53.zip

Add conan.io to project & add Boost to Hello World

-rw-r--r--CMakeLists.txt14
-rw-r--r--build-instructions.md8
-rw-r--r--conanfile.txt5
-rw-r--r--src/main/main.cpp13
4 files changed, 38 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b29582d..d70caad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,17 @@ 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 <string>
#include <iostream>
+#include <boost/foreach.hpp>
+
+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