King_DuckZ
fa08abd00d
Tidyhtml seems to be unable to convert from iso-8859-1 and I suspect there will be many more failures in the future. So instead just make sure all input to it is utf-8 and tell tidy to assume its input is always utf-8.
82 lines
2.3 KiB
CMake
82 lines
2.3 KiB
CMake
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
|
project(duckscraper VERSION 0.2.1 LANGUAGES CXX)
|
|
|
|
option(BUILD_SHARED_TIDY "Wheter you want to build tidy-html5 as a shared library" OFF)
|
|
|
|
include(GetGitRevisionDescription)
|
|
find_package(Boost 1.32.0 COMPONENTS program_options)
|
|
find_package(XQilla 2.3.3 REQUIRED)
|
|
find_package(Iconv REQUIRED)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -g -O0 -fno-omit-frame-pointer")
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -Wextra -g -O3 -fomit-frame-pointer")
|
|
|
|
set(DEFAULT_USER_AGENT "DuckScraper")
|
|
set(PROJECT_VERSION_BETA "1")
|
|
get_git_head_revision(GIT_REFSPEC PROJECT_VERSION_GIT)
|
|
|
|
configure_file(
|
|
"${PROJECT_SOURCE_DIR}/src/${PROJECT_NAME}Config.h.in"
|
|
"${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.h"
|
|
)
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
src/main.cpp
|
|
src/html_pool.cpp
|
|
src/htmlretrieve.cpp
|
|
src/commandline.cpp
|
|
src/scraplang/parse_exports.cpp
|
|
src/scraplang/parse.cpp
|
|
src/scraplang/apply.cpp
|
|
src/scraplang/xpath_runner.cpp
|
|
src/xpath.cpp
|
|
src/read_all.cpp
|
|
src/iconv_wrapper.cpp
|
|
)
|
|
|
|
target_include_directories(${PROJECT_NAME} SYSTEM
|
|
PRIVATE lib/tidy/include
|
|
PRIVATE ${PUGIXML_INCLUDE_DIR}
|
|
PRIVATE lib/curlcpp/include
|
|
PRIVATE ${Boost_INCLUDE_DIRS}
|
|
PRIVATE lib/mstch/include
|
|
)
|
|
target_include_directories(${PROJECT_NAME}
|
|
PRIVATE src/
|
|
PRIVATE "${PROJECT_BINARY_DIR}"
|
|
)
|
|
|
|
if (BUILD_SHARED_TIDY)
|
|
set(TIDY_LIB "tidy-share")
|
|
else(BUILD_SHARED_TIDY)
|
|
set(TIDY_LIB "tidy-static")
|
|
endif(BUILD_SHARED_TIDY)
|
|
|
|
target_link_libraries(${PROJECT_NAME}
|
|
PRIVATE ${TIDY_LIB}
|
|
PRIVATE ${PUGIXML_LIBRARIES}
|
|
PRIVATE curlcpp
|
|
PRIVATE ${Boost_LIBRARIES}
|
|
PRIVATE mstch
|
|
PRIVATE XQilla::XQilla
|
|
)
|
|
|
|
target_compile_definitions(${PROJECT_NAME}
|
|
PRIVATE $<$<CONFIG:DEBUG>:KAK_DEBUG>
|
|
)
|
|
|
|
#unset those variables so cmake files from dependencies won't complain about
|
|
#new/old policy. Those unset statements can be removed once both libraries bump
|
|
#their cmake_minimum_required to 3.0+.
|
|
unset(PROJECT_VERSION_MAJOR)
|
|
unset(PROJECT_VERSION_MINOR)
|
|
unset(PROJECT_VERSION_PATCH)
|
|
unset(PROJECT_VERSION)
|
|
set(BUILD_SHARED_LIB ${BUILD_SHARED_TIDY}) #for tidy
|
|
add_subdirectory(lib/tidy)
|
|
add_subdirectory(lib/curlcpp)
|
|
add_subdirectory(lib/mstch)
|