2021-01-25 00:24:31 +01:00
|
|
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
|
|
|
|
|
|
|
# add project files
|
|
|
|
set(HEADER_FILES
|
|
|
|
data/package.h
|
|
|
|
data/database.h
|
|
|
|
data/config.h
|
|
|
|
data/lockable.h
|
|
|
|
data/siglevel.h
|
2021-12-05 23:40:51 +01:00
|
|
|
data/storagefwd.h
|
2021-01-25 00:24:31 +01:00
|
|
|
parser/aur.h
|
|
|
|
parser/package.h
|
|
|
|
parser/database.h
|
|
|
|
parser/config.h
|
|
|
|
parser/utils.h
|
2021-12-05 23:40:51 +01:00
|
|
|
parser/binary.h)
|
2021-01-25 00:24:31 +01:00
|
|
|
set(SRC_FILES
|
|
|
|
data/package.cpp
|
|
|
|
data/database.cpp
|
|
|
|
data/config.cpp
|
|
|
|
data/lockable.cpp
|
2022-02-05 22:09:52 +01:00
|
|
|
data/storagegeneric.h
|
2021-12-05 23:40:51 +01:00
|
|
|
data/storageprivate.h
|
|
|
|
data/storage.cpp
|
2021-01-25 00:24:31 +01:00
|
|
|
algo/search.cpp
|
|
|
|
algo/buildorder.cpp
|
|
|
|
algo/licenses.cpp
|
|
|
|
parser/aur.cpp
|
|
|
|
parser/package.cpp
|
|
|
|
parser/database.cpp
|
|
|
|
parser/config.cpp
|
|
|
|
parser/utils.cpp
|
|
|
|
parser/binary.cpp
|
2022-01-30 01:28:03 +01:00
|
|
|
parser/siglevel.cpp)
|
2021-01-25 00:24:31 +01:00
|
|
|
set(TEST_HEADER_FILES tests/parser_helper.h)
|
|
|
|
set(TEST_SRC_FILES tests/cppunit.cpp tests/parser.cpp tests/parser_binary.cpp tests/parser_helper.cpp tests/data.cpp
|
|
|
|
tests/utils.cpp)
|
|
|
|
|
|
|
|
# meta data
|
|
|
|
set(META_PROJECT_NAME libpkg)
|
|
|
|
set(META_PROJECT_TYPE library)
|
|
|
|
set(META_PROJECT_VARNAME LIBPKG)
|
2021-07-03 19:59:57 +02:00
|
|
|
set(META_APP_NAME "Unofficial Arch Linux package library")
|
2021-01-25 00:24:31 +01:00
|
|
|
set(META_APP_DESCRIPTION "C++ library to parse Arch Linux packages and databases")
|
|
|
|
set(META_VERSION_MAJOR 0)
|
|
|
|
set(META_VERSION_MINOR 0)
|
|
|
|
set(META_VERSION_PATCH 1)
|
|
|
|
|
|
|
|
# find c++utilities
|
|
|
|
set(CONFIGURATION_PACKAGE_SUFFIX
|
|
|
|
""
|
|
|
|
CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities")
|
2022-03-04 21:48:28 +01:00
|
|
|
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.14.0 REQUIRED)
|
2021-01-25 00:24:31 +01:00
|
|
|
use_cpp_utilities(VISIBILITY PUBLIC)
|
|
|
|
|
|
|
|
# use std::filesystem
|
|
|
|
include(3rdParty)
|
|
|
|
use_standard_filesystem(VISIBILITY PUBLIC)
|
|
|
|
|
|
|
|
# find reflective-rapidjson
|
|
|
|
find_package(reflective_rapidjson${CONFIGURATION_PACKAGE_SUFFIX} REQUIRED)
|
|
|
|
use_reflective_rapidjson(VISIBILITY PUBLIC)
|
|
|
|
|
2022-01-30 01:28:03 +01:00
|
|
|
# find lmdb-safe
|
|
|
|
find_package(lmdb-safe${CONFIGURATION_PACKAGE_SUFFIX} REQUIRED)
|
|
|
|
use_lmdb_safe()
|
2022-01-30 01:43:44 +01:00
|
|
|
if (INCLUDE_LMDB_SAFE_PROJECT)
|
|
|
|
if (NOT LMDB_SAFE_BUILD_SHARED_LIBS)
|
|
|
|
target_compile_options("${LMDB_SAFE_LIB}" PRIVATE -fPIC)
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2021-04-20 18:41:45 +02:00
|
|
|
|
2021-01-25 00:24:31 +01:00
|
|
|
# find 3rd party libraries zlib
|
|
|
|
use_zlib()
|
|
|
|
# libarchive
|
|
|
|
find_package(LibArchive)
|
|
|
|
if (NOT LibArchive_FOUND)
|
|
|
|
message(FATAL_ERROR "Unable to find libarchive.")
|
|
|
|
endif ()
|
|
|
|
add_library(libarchive UNKNOWN IMPORTED)
|
|
|
|
set_property(TARGET libarchive PROPERTY IMPORTED_LOCATION "${LibArchive_LIBRARIES}")
|
|
|
|
set_property(TARGET libarchive PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${LibArchive_INCLUDE_DIRS}")
|
|
|
|
use_target(TARGET_NAME libarchive)
|
|
|
|
|
2022-01-30 01:28:03 +01:00
|
|
|
# find boost libraries (required by lmdb-safe's integration with reflective-rapidjson)
|
2021-12-05 23:40:51 +01:00
|
|
|
option(BOOST_STATIC_LINKAGE "${STATIC_LINKAGE}" "link statically against Boost (instead of dynamically)")
|
|
|
|
set(Boost_USE_MULTITHREADED ON)
|
|
|
|
if (BOOST_STATIC_LINKAGE)
|
|
|
|
set(Boost_USE_STATIC_LIBS ON)
|
|
|
|
endif ()
|
|
|
|
set(BOOST_ARGS "REQUIRED;COMPONENTS;iostreams")
|
|
|
|
use_package(TARGET_NAME Boost::iostreams PACKAGE_NAME Boost PACKAGE_ARGS "${BOOST_ARGS}")
|
|
|
|
|
2021-01-25 00:24:31 +01:00
|
|
|
# apply basic configuration
|
|
|
|
include(BasicConfig)
|
|
|
|
|
|
|
|
# trigger code generator for tests because the tests already contain structs to be (de)serialized
|
|
|
|
include(ReflectionGenerator)
|
|
|
|
add_reflection_generator_invocation(
|
|
|
|
INPUT_FILES
|
|
|
|
data/database.h
|
|
|
|
data/package.h
|
|
|
|
data/config.h
|
|
|
|
data/siglevel.h
|
|
|
|
parser/aur.h
|
|
|
|
CLANG_OPTIONS_FROM_TARGETS
|
|
|
|
"${META_TARGET_NAME}"
|
|
|
|
CLANG_OPTIONS_FROM_DEPENDENCIES
|
|
|
|
"${PUBLIC_LIBRARIES};${PRIVATE_LIBRARIES}"
|
|
|
|
GENERATORS
|
|
|
|
json
|
|
|
|
binary
|
|
|
|
OUTPUT_LISTS
|
|
|
|
SRC_FILES
|
|
|
|
JSON_VISIBILITY
|
|
|
|
${META_PROJECT_VARNAME}_EXPORT
|
|
|
|
BINARY_VISBILITY
|
|
|
|
${META_PROJECT_VARNAME}_EXPORT)
|
|
|
|
|
|
|
|
# include modules to apply configuration
|
|
|
|
include(WindowsResources)
|
|
|
|
include(LibraryTarget)
|
|
|
|
include(TestTarget)
|
|
|
|
include(Doxygen)
|
|
|
|
include(ConfigHeader)
|