mirror of
https://github.com/KingDuckZ/dindexer.git
synced 2024-11-25 00:53:43 +00:00
Add DINDEXER_NATIVE_RELEASE cmake option.
Allows to pass -march=native to dindxer projects and to libpqtypes. CMake min version raised to 3.3 since externalproject_add didn't support generator expressions prior to that version.
This commit is contained in:
parent
ed30de44cf
commit
a75eee1325
2 changed files with 14 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
|
||||
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
|
||||
set(bare_name "dindexer")
|
||||
project("${bare_name}-if" VERSION 0.1.4 LANGUAGES CXX C)
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
|
||||
|
@ -22,15 +22,21 @@ include(CPack)
|
|||
|
||||
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()
|
||||
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")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -Wall -Wextra -O3 -fomit-frame-pointer -Wno-missing-field-initializers")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -Wall -Wextra -O3 -fomit-frame-pointer -Wno-missing-field-initializers ${march_flag}")
|
||||
set(DINDEXER_PUB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
get_git_head_revision(GIT_REFSPEC PROJECT_VERSION_GIT)
|
||||
|
||||
|
@ -46,7 +52,7 @@ message(STATUS "Config file set to \"${DINDEXER_CONFIG_FILE}\"")
|
|||
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}")
|
||||
import_libpqtypes_project("${PostgreSQL_INCLUDE_DIRS}" "-O3 ${march_flag}")
|
||||
|
||||
add_library(${PROJECT_NAME} INTERFACE)
|
||||
add_library(${bare_name}-inc INTERFACE)
|
||||
|
@ -102,6 +108,8 @@ add_subdirectory(src/delete)
|
|||
add_subdirectory(src/query)
|
||||
add_subdirectory(src/locate)
|
||||
add_subdirectory(src/navigate)
|
||||
|
||||
#Tests
|
||||
add_subdirectory(test/gtest)
|
||||
add_subdirectory(test/unit)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
include(ExternalProject)
|
||||
|
||||
function (import_libpqtypes_project PostgreSQL_INCLUDE_DIRS)
|
||||
function (import_libpqtypes_project PostgreSQL_INCLUDE_DIRS RELEASE_C_FLAGS)
|
||||
#find_path(libpqtypes_base_path NAMES src/libpqtypes.h PATHS ${CMAKE_CURRENT_SOURCE_DIR}/lib NO_DEFAULT_PATH)
|
||||
file(GLOB_RECURSE libpqtypes_base_path "lib/**libpqtypes.h")
|
||||
|
||||
|
@ -13,7 +13,8 @@ function (import_libpqtypes_project PostgreSQL_INCLUDE_DIRS)
|
|||
DOWNLOAD_COMMAND ""
|
||||
SOURCE_DIR ${libpqtypes_base_path}
|
||||
PREFIX ${libpqtypes_prefix}
|
||||
CONFIGURE_COMMAND ${libpqtypes_base_path}/configure --prefix ${libpqtypes_prefix} "CPPFLAGS=${libpqtypes_inc_dirs}" --quiet
|
||||
CONFIGURE_COMMAND ${libpqtypes_base_path}/configure --prefix ${libpqtypes_prefix} "CPPFLAGS=${libpqtypes_inc_dirs}"
|
||||
"CFLAGS=$<$<CONFIG:Release>:${RELEASE_C_FLAGS}>" --quiet
|
||||
BUILD_COMMAND ${MAKE}
|
||||
BUILD_IN_SOURCE 0
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue