-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
169 lines (151 loc) · 5.24 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
cmake_minimum_required(VERSION 3.14)
project(blogator VERSION 1.3.2)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(PROJECT_AUTHOR "An7ar35")
set(PROJECT_HOMEPAGE_URL "https://an7ar35.bitbucket.io")
set(CMAKE_CXX_FLAGS "-Wall -Wextra -pthread")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build")
set(CMAKE_EXTERNAL_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external")
set(CMAKE_RESOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/resource")
set(CMAKE_LIBRARY_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib")
set(TEMP_DIR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tmp")
include(ExternalProject)
##########################
# Blogator Source Files #
##########################
set(SOURCE_FILES
src/cli/ArgParser.cpp
src/cli/ArgParser.h
src/cli/MsgInterface.cpp
src/cli/MsgInterface.h
src/cli/MsgDisplay.cpp
src/cli/MsgDisplay.h
src/dto/Article.h
src/dto/DateStamp.h
src/dto/Template.h
src/dto/Template.cpp
src/dto/Templates.h
src/dto/Templates.cpp
src/dto/Options.h
src/dto/Options.cpp
src/dto/Index.h
src/dto/HTML.cpp
src/dto/HTML.h
src/dto/IndexDateTree.h
src/dto/IndexTagTree.h
src/dto/Page.h
src/dto/Line.h
src/dto/SeekRange.h
src/dto/InsertPosition.h
src/exception/file_access_failure.h
src/exception/file_parsing_failure.h
src/exception/failed_expectation.h
src/fs/fs.cpp
src/fs/fs.h
src/fs/ConfigReader.cpp
src/fs/ConfigReader.h
src/html/html.cpp
src/html/html.h
src/html/writer/writer.cpp
src/html/writer/writer.h
src/html/reader/reader.cpp
src/html/reader/reader.h
src/indexer/indexer.cpp
src/indexer/indexer.h
src/indexer/FeatAggregator.cpp
src/indexer/FeatAggregator.h
src/output/output.cpp
src/output/output.h
src/output/abstract/Breadcrumb.cpp
src/output/abstract/Breadcrumb.h
src/output/abstract/Page.cpp
src/output/abstract/Page.h
src/output/abstract/IndexList.cpp
src/output/abstract/IndexList.h
src/output/abstract/Lister.cpp
src/output/abstract/Lister.h
src/output/generic/EntryWriter.cpp
src/output/generic/EntryWriter.h
src/output/generic/CategoryLister.cpp
src/output/generic/CategoryLister.h
src/output/generic/ChronoIndexLister.cpp
src/output/generic/ChronoIndexLister.h
src/output/page/Posts.cpp
src/output/page/Posts.h
src/output/page/Indices.cpp
src/output/page/Indices.h
src/output/page/Landing.cpp
src/output/page/Landing.h
src/output/page/ByYearList.cpp
src/output/page/ByYearList.h
src/output/page/ByTagList.cpp
src/output/page/ByTagList.h
src/output/page/ByAuthorList.cpp
src/output/page/ByAuthorList.h
src/output/feed/RSS.cpp
src/output/feed/RSS.h
src/output/json/JSON.cpp
src/output/json/JSON.h
src/html/editor/code/code.cpp
src/html/editor/code/code.h
src/html/editor/editor.cpp
src/html/editor/editor.h
src/dto/TableOfContents.h
src/dto/TableOfContents.cpp
src/output/helper/OrderedPostInsertion.cpp
src/output/helper/OrderedPostInsertion.h)
configure_file(src/cmake/cmake_vars.h ${CMAKE_BINARY_DIR}/generated-src/project_version.h )
include_directories( ${CMAKE_BINARY_DIR}/generated-src/ )
#####################
# Google Unit-Tests #
#####################
find_package(GTest QUIET)
if( NOT GTEST_FOUND )
message(">> GoogleTest package not found. Getting it from git repo...")
set(GTEST_DOWNLOAD_PATH "${CMAKE_EXTERNAL_OUTPUT_DIRECTORY}/googletest")
ExternalProject_Add(googletest
PREFIX ${GTEST_DOWNLOAD_PATH}
GIT_REPOSITORY https://github.com/google/googletest.git
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GTEST_DOWNLOAD_PATH})
include_directories(${GTEST_DOWNLOAD_PATH}/include)
link_directories(${GTEST_DOWNLOAD_PATH}/lib64)
else()
message(">> GoogleTest package found. Using local version.")
include_directories(${GTEST_INCLUDE_DIRS})
endif()
set(TEST_FILES
tests/main.cpp
tests/html/reader/reader.cpp
tests/dto/DateStamp.cpp
tests/dto/Templates.cpp
tests/fs/fs.cpp
tests/html/editor/editor.cpp
tests/dto/HTML.cpp
tests/dto/TableOfContents.cpp
tests/output/json/json.cpp)
enable_testing()
add_executable(
blogator_tests
${SOURCE_FILES}
${TEST_FILES}
)
if( NOT GTEST_FOUND )
add_dependencies(blogator_tests googletest)
target_link_libraries(blogator_tests gtest)
else()
target_link_libraries(blogator_tests gtest)
endif()
add_test(blogator_tests ${TEST_FILES})
############
# BLOGATOR #
############
include_directories(external)
add_executable(blogator src/main.cpp ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} stdc++fs)