1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-25 00:53:43 +00:00
dindexer/CMakeLists.txt

129 lines
4.6 KiB
Text
Raw Normal View History

cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
set(bare_name "dindexer")
2016-01-07 15:33:46 +00:00
project("${bare_name}-if" VERSION 0.1.4 LANGUAGES CXX C)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
2015-12-12 20:27:31 +00:00
2016-02-12 20:10:40 +00:00
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A file indexing program to help you keep track of your backed up files")
set(CPACK_PACKAGE_VENDOR "King_DuckZ")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_GENERATOR "DEB;RPM;TGZ")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "King_DuckZ")
set(CPACK_PACKAGE_NAME "${bare_name}")
set(CPACK_STRIP_FILES ON)
2015-12-12 20:27:31 +00:00
include(GetGitRevisionDescription)
include(Buildlibpqtypes)
include(gccversion)
2016-02-12 20:10:40 +00:00
include(CPack)
2015-12-12 20:27:31 +00:00
2015-11-13 19:25:32 +00:00
option(DINDEXER_DEBUG_CFG_FILE "Enable to set the config file path to the build path" OFF)
option(DINDEXER_WITH_MEDIA_AUTODETECT "Enable code that tries to autodetect the media type and sets --type automatically" ON)
option(DINDEXER_NATIVE_RELEASE "Pass the -march=native flag to the compiler for release builds" OFF)
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION_MAJOR EQUAL "5")
option(DINDEXER_CXX11_ABI "Controls if _GLIBCXX_USE_CXX11_ABI gets set to 0 or not" ON)
endif()
if(DINDEXER_NATIVE_RELEASE)
set(march_flag "-march=native")
else()
set(march_flag "")
endif()
2016-02-11 08:07:36 +00:00
set(DINDEXER_ACTIONS_PATH "${CMAKE_CURRENT_BINARY_DIR}/src" CACHE STRING "Actions search path")
string(REGEX MATCH "[^/].*" ACTIONS_PATH_INSTALL "${DINDEXER_ACTIONS_PATH}")
set(DB_OWNER_NAME "$ENV{USER}" CACHE STRING "Name that will be used as the DB owner name")
set(PROJECT_VERSION_BETA "1")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -Wall -Wextra -fomit-frame-pointer -Wno-missing-field-initializers ${march_flag}")
set(DINDEXER_PUB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
2016-04-18 22:34:02 +00:00
set(PBL_WITH_TESTS OFF)
2015-12-12 20:27:31 +00:00
get_git_head_revision(GIT_REFSPEC PROJECT_VERSION_GIT)
2015-11-05 14:32:31 +00:00
if ("${DINDEXER_CONFIG_FILE}" STREQUAL "")
2015-11-13 19:25:32 +00:00
if (DINDEXER_DEBUG_CFG_FILE)
set(DINDEXER_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/${bare_name}.yml CACHE STRING "Path to the config file" FORCE)
2015-11-13 19:25:32 +00:00
else()
set(DINDEXER_CONFIG_FILE "$HOME/.config/${bare_name}.yml" CACHE STRING "Path to the config file" FORCE)
2015-11-13 19:25:32 +00:00
endif()
endif()
message(STATUS "Config file set to \"${DINDEXER_CONFIG_FILE}\"")
2015-11-13 19:25:32 +00:00
find_package(Boost 1.53.0 REQUIRED COMPONENTS program_options)
find_package(PostgreSQL 8.3 REQUIRED)
find_package(YamlCpp 0.5.1 REQUIRED)
import_libpqtypes_project("${PostgreSQL_INCLUDE_DIRS}" "-O3 ${march_flag}")
2015-12-04 12:58:13 +00:00
add_library(${PROJECT_NAME} INTERFACE)
add_library(${bare_name}-inc INTERFACE)
2015-12-04 12:58:13 +00:00
2016-02-11 08:07:36 +00:00
message(STATUS "Actions search path set to: \"${DINDEXER_ACTIONS_PATH}\"")
configure_file(
"${PROJECT_SOURCE_DIR}/src/${bare_name}Config.h.in"
"${PROJECT_BINARY_DIR}/${bare_name}Config.h"
)
configure_file(
"${PROJECT_SOURCE_DIR}/dindexer.sql.in"
"${PROJECT_BINARY_DIR}/dindexer.sql"
)
configure_file(
"${PROJECT_SOURCE_DIR}/dindexer_cmd_complete.sh.in"
"${PROJECT_BINARY_DIR}/dindexer_cmd_complete.sh"
@ONLY
)
target_include_directories(${PROJECT_NAME} SYSTEM
INTERFACE ${Boost_INCLUDE_DIRS}
2015-12-04 12:58:13 +00:00
INTERFACE ${PostgreSQL_INCLUDE_DIRS}
2015-11-11 02:01:37 +00:00
)
target_include_directories(${bare_name}-inc
2015-12-04 12:58:13 +00:00
INTERFACE ${PROJECT_BINARY_DIR}
INTERFACE ${CMAKE_SOURCE_DIR}/include
2015-11-11 02:01:37 +00:00
)
if (NOT DINDEXER_CXX11_ABI AND CMAKE_CXX_COMPILER_VERSION_MAJOR EQUAL "5")
message(STATUS "CXX11 ABI disabled (_GLIBCXX_USE_CXX11_ABI=0)")
add_definitions(
#workaround for a bug in gcc 5.3 that is causing exceptions to slip
#through try/catch blocks.
#WARNING: this will likely cause linking erros with boost and
#yaml-cpp unless they are also built with this option or with an
#older version of gcc.
-D_GLIBCXX_USE_CXX11_ABI=0
)
endif()
2016-02-10 19:14:46 +00:00
#Libraries
2015-12-04 12:58:13 +00:00
add_subdirectory(src/pq)
add_subdirectory(src/common)
add_subdirectory(src/machinery)
2016-04-18 20:52:35 +00:00
add_subdirectory(lib/pbl)
#Actions
add_subdirectory(src/main)
add_subdirectory(src/scan)
2015-12-12 16:53:09 +00:00
add_subdirectory(src/delete)
2015-12-13 16:46:42 +00:00
add_subdirectory(src/query)
2015-12-14 13:00:10 +00:00
add_subdirectory(src/locate)
2016-01-22 15:55:19 +00:00
add_subdirectory(src/navigate)
#Tests
add_subdirectory(test/gtest)
add_subdirectory(test/unit)
2015-12-04 12:58:13 +00:00
2015-11-11 02:01:37 +00:00
target_link_libraries(${PROJECT_NAME}
2015-12-04 12:58:13 +00:00
INTERFACE ${PostgreSQL_LIBRARIES}
INTERFACE ${Boost_LIBRARIES}
INTERFACE ${bare_name}-pq
INTERFACE ${bare_name}-inc
)
target_compile_definitions(${PROJECT_NAME}
2015-12-04 12:58:13 +00:00
INTERFACE WITH_PROGRESS_FEEDBACK
2015-12-29 19:12:15 +00:00
INTERFACE BOOST_SPIRIT_USE_PHOENIX_V3=1
)