Skip to content

Commit

Permalink
rebuilt cmake buildsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
p01arst0rm committed Aug 14, 2020
1 parent 3c6884a commit 377dc9e
Show file tree
Hide file tree
Showing 414 changed files with 840 additions and 1,965 deletions.
208 changes: 55 additions & 153 deletions CMakeLists.txt
@@ -1,132 +1,70 @@
project(lucene++)
####################################
# init
####################################

cmake_minimum_required(VERSION 2.8.6)
cmake_minimum_required(VERSION 3.5)

project(lucene++)

set(lucene++_VERSION_MAJOR 3)
set(lucene++_VERSION_MINOR 0)
set(lucene++_VERSION_PATCH 7)

set(lucene++_SOVERSION "0")

set(lucene++_VERSION
"${lucene++_VERSION_MAJOR}.${lucene++_VERSION_MINOR}.${lucene++_VERSION_PATCH}"
)

# include specific modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
"${lucene++_VERSION_MAJOR}.${lucene++_VERSION_MINOR}.${lucene++_VERSION_PATCH}")

####################################
# pre-compiled headers support
####################################
include(cotire)

# if setup using the Toolchain-llvm.cmake file, then use llvm...
if(ENABLE_LLVM)
include(Toolchain-llvm)
endif()

####################################
# user specified build options
####################################
# set default build type as release
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

option(LUCENE_BUILD_STATIC
"Build a static library"
OFF
)
option(ENABLE_PACKAGING
"Create build scripts for creating lucene++ packages"
OFF
)
option(LUCENE_USE_STATIC_BOOST_LIBS
"Use static boost libraries"
OFF
)
option(ENABLE_BOOST_INTEGER
"Enable boost integer types"
OFF
)
option(ENABLE_CYCLIC_CHECK
"Enable cyclic checking"
OFF
)
option(ENABLE_TEST
"Enable the tests"
ON
)
option(ENABLE_DEMO
"Enable building demo applications"
ON
)
set(LIB_DESTINATION
"${CMAKE_INSTALL_FULL_LIBDIR}" CACHE STRING "Define lib output directory name")


####################################
# bootstrap
# CMake Modules
####################################

find_package(Threads REQUIRED)
find_package(Boost COMPONENTS
date_time
filesystem
iostreams
regex
system
thread
REQUIRED
)

set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ${LUCENE_USE_STATIC_BOOST_LIBS})

set(lucene_boost_libs
${Boost_LIBRARIES}
${Boost_FILESYSTEM_LIBRARIES}
${Boost_IOSTREAMS_LIBRARIES}
${Boost_REGEX_LIBRARIES}
${Boost_SYSTEM_LIBRARIES}
${Boost_THREAD_LIBRARIES}
)

include(Lucene++Docs)
include(TestCXXAcceptsFlag)
include(GNUInstallDirs)
# include specific modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(options.cmake)

set(LIB_DESTINATION
"${CMAKE_INSTALL_FULL_LIBDIR}" CACHE STRING "Define lib output directory name"
)
# pre-compiled headers support
include(cotire)

if(ENABLE_BOOST_INTEGER)
set(DEFINE_USE_BOOST_INTEGER "define")
else()
set(DEFINE_USE_BOOST_INTEGER "undef")
# if setup using the Toolchain-llvm.cmake file, then use llvm...
if(ENABLE_LLVM)
include(Toolchain-llvm)
endif()

if(ENABLE_CYCLIC_CHECK)
set(DEFINE_USE_CYCLIC_CHECK "define")
else()
set(DEFINE_USE_CYCLIC_CHECK "undef")
endif()
# fetch dependencies
include(dependencies)

# build docs
include(Lucene++Docs)

####################################
# platform specific options
####################################
if(WIN32 OR WIN64)
set(CMAKE_DEBUG_POSTFIX "d")
set(CMAKE_DEBUG_POSTFIX "d")
endif()

if(MSVC)
# Disable automatic boost linking on Windows as libraries are added to the linker explicitly
add_definitions(-DBOOST_ALL_NO_LIB)
# Disable automatic boost linking on Windows as libraries are added to the linker explicitly
add_definitions(-DBOOST_ALL_NO_LIB)

# enable exceptions, see http://msdn.microsoft.com/en-us/library/1deeycx5.aspx
add_definitions(-EHsc)
# enable exceptions, see http://msdn.microsoft.com/en-us/library/1deeycx5.aspx
add_definitions(-EHsc)

# Disable including too many Windows headers
add_definitions(-DWIN32_LEAN_AND_MEAN)
# Disable including too many Windows headers
add_definitions(-DWIN32_LEAN_AND_MEAN)

# Disable the min/max macros that conflict with std::min/std::max
add_definitions(-DNOMINMAX)
# Disable the min/max macros that conflict with std::min/std::max
add_definitions(-DNOMINMAX)
endif()

if(NOT WIN32 AND NOT CMAKE_SYSTEM MATCHES "SunOS-5*.")
Expand All @@ -149,55 +87,6 @@ if(APPLE)
endif()
endif()

#################################
# generate Config.h
#################################
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/include/Config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/include/Config.h" @ONLY
)

include_directories(
"${CMAKE_CURRENT_BINARY_DIR}/include"
)


add_subdirectory(src/core)
add_subdirectory(src/contrib)

if(ENABLE_DEMO)
add_subdirectory(src/demo)
endif()

if(ENABLE_TEST)
enable_testing()
add_subdirectory(src/test)
endif()

#################################
# install pkg-config file
#################################
if(NOT WIN32)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/liblucene++.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++.pc" @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/liblucene++-contrib.pc.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++-contrib.pc" @ONLY)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++.pc"
"${CMAKE_CURRENT_BINARY_DIR}/liblucene++-contrib.pc"
DESTINATION "${LIB_DESTINATION}/pkgconfig")
endif()

#################################
# install Config.h
#################################
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/include/Config.h"
DESTINATION include/lucene++)

####################################
# custom targets
Expand All @@ -218,11 +107,24 @@ if(ENABLE_PACKAGING)
include(CreateLucene++Packages)
endif()

message("** Build Summary **")
message(" Version: ${lucene++_VERSION}")
message(" Prefix: ${CMAKE_INSTALL_PREFIX}")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message(" Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(" System: ${CMAKE_SYSTEM_NAME}")
message(" Boost Include: ${Boost_INCLUDE_DIRS}")
message(" Boost Library: ${Boost_LIBRARY_DIRS}")

####################################
# bootstrap
####################################

include(TestCXXAcceptsFlag)
include(GNUInstallDirs)

add_subdirectory(include)
add_subdirectory(src)

message("\n\n** Build Summary **")
message(" Version: ${lucene++_VERSION}")
message(" Prefix: ${CMAKE_INSTALL_PREFIX}")
message(" Build Type: ${CMAKE_BUILD_TYPE}")
message(" Architecture: ${CMAKE_SYSTEM_PROCESSOR}")
message(" System: ${CMAKE_SYSTEM_NAME}")
message(" Boost Include: ${Boost_INCLUDE_DIRS}")
message(" Boost Libraries: ${Boost_LIBRARY_DIRS}")
message(" Zlib Include: ${ZLIB_INCLUDE_DIRS}")
message(" Zlib Library: ${ZLIB_LIBRARY_RELEASE}")
1 change: 0 additions & 1 deletion cmake/Lucene++Docs.cmake
Expand Up @@ -2,7 +2,6 @@
# This file provides support for building the Lucene++ Documentation.
# To build the documention, you will have to enable it
# and then do the equivalent of "make doc".
OPTION(ENABLE_DOCS "Build the Lucene++ documentation." OFF)

MACRO(SET_YESNO)
FOREACH(param ${ARGV})
Expand Down
28 changes: 28 additions & 0 deletions cmake/dependencies.cmake
@@ -0,0 +1,28 @@
####################################
# get dependencies
####################################

find_package(Boost COMPONENTS
date_time
filesystem
iostreams
regex
system
thread
REQUIRED
)

set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ${LUCENE_USE_STATIC_BOOST_LIBS})

set(lucene_boost_libs
${Boost_LIBRARIES}
${Boost_FILESYSTEM_LIBRARIES}
${Boost_IOSTREAMS_LIBRARIES}
${Boost_REGEX_LIBRARIES}
${Boost_SYSTEM_LIBRARIES}
${Boost_THREAD_LIBRARIES}
)

find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED)

0 comments on commit 377dc9e

Please sign in to comment.