diff --git a/CMakeLists.txt b/CMakeLists.txt index 962db39..72b2372 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,5 +9,6 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) set(libs ${libs} ${Boost_LIBRARIES}) set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +add_subdirectory("include") add_subdirectory("lib") add_subdirectory("src") diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..987fe23 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,4 @@ + +# Hack to show headers in Qt Creator +file(GLOB headers "*.hpp") +add_library(dummy ${headers} dummy.cpp) diff --git a/include/clusters.hpp b/include/clusters.hpp index c19376c..bb7326e 100644 --- a/include/clusters.hpp +++ b/include/clusters.hpp @@ -1,11 +1,19 @@ #pragma once -#include -#include #include +#include // Using boost flat set was faster than std::set. +template +auto make_empty(Field field, Cluster const & c){ + for(auto&& p : c){ + field.get(p) = 0; + } + field.collapse(); + return field; +} + namespace detail { template auto same_group(Field const & field, typename Field::Position const & p, typename Field::Position const & q){ @@ -48,13 +56,3 @@ auto all_clusters(Field const & field, Rules const & rules){ } return ret; } - -template -auto make_empty(Field field, Cluster const & c){ - using namespace std; - for(auto&& p : c){ - field.get(p) = 0; - } - field.collapse(); - return field; -} diff --git a/include/dummy.cpp b/include/dummy.cpp new file mode 100644 index 0000000..7dcf12c --- /dev/null +++ b/include/dummy.cpp @@ -0,0 +1,2 @@ +// Needed for the hack to show headers in Qt Creator +static int x = x; diff --git a/include/dynamic_grid.hpp b/include/dynamic_grid.hpp index 50e91d1..6452e40 100644 --- a/include/dynamic_grid.hpp +++ b/include/dynamic_grid.hpp @@ -4,11 +4,10 @@ #include #include -#include #include #include +#include #include -#include // Position {0,0} is bottom left. // Position {W-1, H-1} is top right. diff --git a/include/generator.hpp b/include/generator.hpp index b81fa34..cd043c4 100644 --- a/include/generator.hpp +++ b/include/generator.hpp @@ -1,7 +1,6 @@ #pragma once #include "grid.hpp" - #include namespace detail { diff --git a/include/grid.hpp b/include/grid.hpp index 2732b2b..1c5fb1c 100644 --- a/include/grid.hpp +++ b/include/grid.hpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include // Position {0,0} is bottom left. // Position {W-1, H-1} is top right. diff --git a/src/main.cpp b/src/PuzzleWuzzleGenerator.cpp similarity index 95% rename from src/main.cpp rename to src/PuzzleWuzzleGenerator.cpp index bf33297..0e1596d 100644 --- a/src/main.cpp +++ b/src/PuzzleWuzzleGenerator.cpp @@ -1,17 +1,12 @@ - #include "dynamic_grid.hpp" #include "clusters.hpp" #include "solver.hpp" -#include "generator.hpp" #include "rules.hpp" #include #include #include -#include -#include -#include int main(int argc, char** argv){ namespace po = boost::program_options;