diff --git a/.cspell/words.txt b/.cspell/words.txt index f93a3b0..fc328e9 100644 --- a/.cspell/words.txt +++ b/.cspell/words.txt @@ -1,6 +1,9 @@ bdiff cmake_current_source_dir +dhave_unistd_h +dhave_unistd_h fpatch +have_unistd_h intdiff intdifftest kubo diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b08f20..42739e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,11 +6,18 @@ project( VERSION 1.21 ) +include(CheckIncludeFile) + set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +check_include_file(unistd.h HAVE_UNISTD_H) +if(HAVE_UNISTD_H) + add_definitions(-DHAVE_UNISTD_H) +endif() + include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include) option(DTL_ENABLE_TESTING "Enable DTL unit tests" OFF) diff --git a/examples/common.hpp b/examples/common.hpp index 6d699b0..734ba76 100644 --- a/examples/common.hpp +++ b/examples/common.hpp @@ -1,6 +1,19 @@ #ifndef DTL_EXAMPLE_COMMON_H #define DTL_EXAMPLE_COMMON_H +#include +#include +#include +#include + +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif // HAVE_UNISTD_H + #include "dtl/dtl.hpp" bool isFileExist(std::string &fs); diff --git a/include/dtl/Lcs.hpp b/include/dtl/Lcs.hpp index 1b85ca4..4b4a4c5 100644 --- a/include/dtl/Lcs.hpp +++ b/include/dtl/Lcs.hpp @@ -38,7 +38,6 @@ #ifndef DTL_LCS_H #define DTL_LCS_H -#include "dtl/variables.hpp" #include "dtl/Sequence.hpp" namespace dtl { diff --git a/include/dtl/Sequence.hpp b/include/dtl/Sequence.hpp index 1a34ce9..ad25b69 100644 --- a/include/dtl/Sequence.hpp +++ b/include/dtl/Sequence.hpp @@ -38,8 +38,9 @@ #ifndef DTL_SEQUENCE_H #define DTL_SEQUENCE_H -namespace dtl { +#include +namespace dtl { /** * sequence class template */ diff --git a/include/dtl/Ses.hpp b/include/dtl/Ses.hpp index ce68095..ca44762 100644 --- a/include/dtl/Ses.hpp +++ b/include/dtl/Ses.hpp @@ -38,6 +38,9 @@ #ifndef DTL_SES_H #define DTL_SES_H +#include +#include + #include "dtl/variables.hpp" #include "dtl/Sequence.hpp" @@ -48,7 +51,7 @@ namespace dtl { */ template class Ses : public Sequence { private: - typedef pair sesElem; + typedef std::pair sesElem; typedef std::vector sesElemVec; public: diff --git a/include/dtl/dtl.hpp b/include/dtl/dtl.hpp index 6d2bff1..1f0a691 100644 --- a/include/dtl/dtl.hpp +++ b/include/dtl/dtl.hpp @@ -36,24 +36,6 @@ #ifndef DTL_H #define DTL_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif // HAVE_UNISTD_H - #include "dtl/Diff.hpp" #include "dtl/Diff3.hpp" #include "dtl/Lcs.hpp" diff --git a/include/dtl/functors.hpp b/include/dtl/functors.hpp index d25a343..5cd1709 100644 --- a/include/dtl/functors.hpp +++ b/include/dtl/functors.hpp @@ -38,6 +38,8 @@ #ifndef DTL_FUNCTORS_H #define DTL_FUNCTORS_H +#include + #include "dtl/variables.hpp" namespace dtl { diff --git a/include/dtl/variables.hpp b/include/dtl/variables.hpp index 2f69803..e93f843 100644 --- a/include/dtl/variables.hpp +++ b/include/dtl/variables.hpp @@ -38,6 +38,12 @@ #ifndef DTL_VARIABLES_H #define DTL_VARIABLES_H +#include +#include +#include +#include +#include + namespace dtl { using std::cout; diff --git a/test/dtl_test_common.hpp b/test/dtl_test_common.hpp index d0a75d4..023a7cd 100644 --- a/test/dtl_test_common.hpp +++ b/test/dtl_test_common.hpp @@ -1,6 +1,9 @@ #ifndef DTL_TEST_COMMON #define DTL_TEST_COMMON +#include +#include + #include #include "dtl/dtl.hpp"