From 1df91058bae270a9446942cdf5a56bec22e9f37c Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Thu, 26 Jul 2012 17:53:32 +0200 Subject: [PATCH 1/4] Patch Config.h from CMake options --- CMakeLists.txt | 21 ++++++++++++++++----- include/{Config.h => Config.h.cmake} | 4 ++-- 2 files changed, 18 insertions(+), 7 deletions(-) rename include/{Config.h => Config.h.cmake} (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35328f2c..5fc7ff66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,14 +76,18 @@ OPTION(ENABLE_CYCLIC_CHECK SET(LIB_DESTINATION "lib" CACHE STRING "Define lib output directory name") IF ( ENABLE_NEDMALLOC ) - ADD_DEFINITIONS(-DLPP_USE_NEDMALLOC) + SET(DEFINE_USE_NEDMALLOC "define") +ELSE ( ENABLE_NEDMALLOC ) + SET(DEFINE_USE_NEDMALLOC "undef") ENDIF ( ENABLE_NEDMALLOC ) + IF ( ENABLE_CYCLIC_CHECK ) - ADD_DEFINITIONS(-DLPP_USE_CYCLIC_CHECK) + SET(DEFINE_USE_CYCLIC_CHECK "define") +ELSE ( ENABLE_CYCLIC_CHECK ) + SET(DEFINE_USE_CYCLIC_CHECK "undef") ENDIF ( ENABLE_CYCLIC_CHECK ) #################################### - #################################### # PLATFORM specific options #################################### @@ -149,6 +153,15 @@ INCLUDE(PCHSupport) #todo: make this optional and make it possible to add more headers - like boost threads +################################# +# 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) + #################################### # The subdirs #################################### @@ -158,7 +171,6 @@ ADD_SUBDIRECTORY (src/contrib) ADD_SUBDIRECTORY (src/demo EXCLUDE_FROM_ALL) ADD_SUBDIRECTORY (src/test) - ################################# # install pkg-config file ################################# @@ -174,7 +186,6 @@ IF(NOT WIN32) DESTINATION ${LIB_DESTINATION}/pkgconfig ) ENDIF(NOT WIN32) - #################################### # Custom targets #################################### diff --git a/include/Config.h b/include/Config.h.cmake similarity index 96% rename from include/Config.h rename to include/Config.h.cmake index 89725fcd..5f2cb765 100644 --- a/include/Config.h +++ b/include/Config.h.cmake @@ -75,13 +75,13 @@ #endif // Define to enable cyclic checking in debug builds -// #define LPP_USE_CYCLIC_CHECK +#@DEFINE_USE_CYCLIC_CHECK@ LPP_USE_CYCLIC_CHECK // Define to use custom allocator (useful in Windows builds and when using nedmalloc) #define LPP_USE_ALLOCATOR // Define to use nedmalloc memory allocator -// #define LPP_USE_NEDMALLOC +#@DEFINE_USE_NEDMALLOC@ LPP_USE_NEDMALLOC #ifdef LPP_USE_NEDMALLOC #define EXTSPEC LPPAPI From 4f4400b7667c0e63c8712e6238dd1c4ecbb3f116 Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Thu, 26 Jul 2012 17:54:56 +0200 Subject: [PATCH 2/4] Add CMake option for LPP_USE_ALLOCATOR --- CMakeLists.txt | 6 ++++++ include/Config.h.cmake | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fc7ff66..ec89210e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,12 @@ ELSE ( ENABLE_NEDMALLOC ) SET(DEFINE_USE_NEDMALLOC "undef") ENDIF ( ENABLE_NEDMALLOC ) +IF ( ENABLE_STANDARD_ALLOCATOR ) + SET(DEFINE_USE_ALLOCATOR "undef") +ELSE ( ENABLE_STANDARD_ALLOCATOR ) + SET(DEFINE_USE_ALLOCATOR "define") +ENDIF ( ENABLE_STANDARD_ALLOCATOR ) + IF ( ENABLE_CYCLIC_CHECK ) SET(DEFINE_USE_CYCLIC_CHECK "define") ELSE ( ENABLE_CYCLIC_CHECK ) diff --git a/include/Config.h.cmake b/include/Config.h.cmake index 5f2cb765..08006207 100644 --- a/include/Config.h.cmake +++ b/include/Config.h.cmake @@ -78,7 +78,7 @@ #@DEFINE_USE_CYCLIC_CHECK@ LPP_USE_CYCLIC_CHECK // Define to use custom allocator (useful in Windows builds and when using nedmalloc) -#define LPP_USE_ALLOCATOR +#@DEFINE_USE_ALLOCATOR@ LPP_USE_ALLOCATOR // Define to use nedmalloc memory allocator #@DEFINE_USE_NEDMALLOC@ LPP_USE_NEDMALLOC From 4907246249c9c75c996a2df862eef418a70a49c3 Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Thu, 26 Jul 2012 17:55:24 +0200 Subject: [PATCH 3/4] Properly use LIB_DESTINATION in pkg-config files --- liblucene++-contrib.pc.cmake | 4 ++-- liblucene++.pc.cmake | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/liblucene++-contrib.pc.cmake b/liblucene++-contrib.pc.cmake index 8e02e3e5..f0aa77c4 100644 --- a/liblucene++-contrib.pc.cmake +++ b/liblucene++-contrib.pc.cmake @@ -1,13 +1,13 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix}/bin -libdir=${prefix}/@LIB_DESTINATION@ +libdir=@LIB_DESTINATION@ includedir=${prefix}/include/lucene++ lib=lucene++-contrib Name: liblucene++-contrib Description: Contributions for Lucene++ - a C++ search engine, ported from the popular Apache Lucene Version: @LUCENE++_VERSION@ -Libs: -L${prefix}/@LIB_DESTINATION@/ -l${lib} +Libs: -L@LIB_DESTINATION@/ -l${lib} Cflags: -I${includedir} Requires: liblucene++=@LUCENE++_VERSION@ ~ diff --git a/liblucene++.pc.cmake b/liblucene++.pc.cmake index 3fc09176..2e53c02d 100644 --- a/liblucene++.pc.cmake +++ b/liblucene++.pc.cmake @@ -1,13 +1,13 @@ prefix=@CMAKE_INSTALL_PREFIX@ exec_prefix=${prefix}/bin -libdir=${prefix}/@LIB_DESTINATION@ +libdir=@LIB_DESTINATION@ includedir=${prefix}/include/lucene++ lib=lucene++ Name: liblucene++ Description: Lucene++ - a C++ search engine, ported from the popular Apache Lucene Version: @LUCENE++_VERSION@ -Libs: -L${prefix}/@LIB_DESTINATION@/ -l${lib} +Libs: -L@LIB_DESTINATION@ -l${lib} Cflags: -I${includedir} ~ From 05e98a07cff2a746bc612e5df66552644e86f632 Mon Sep 17 00:00:00 2001 From: Mathias Hasselmann Date: Tue, 31 Jul 2012 11:47:34 +0200 Subject: [PATCH 4/4] Also install generated Config.h --- src/core/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index c839f563..a77c12fb 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -13,7 +13,8 @@ file(GLOB_RECURSE lucene_sources ${lucene++-lib_SOURCE_DIR}/util/*.cpp) file(GLOB_RECURSE INTERN_HEADERS ${lucene++-libs_SOURCE_DIR}/include/*.h) -file(GLOB_RECURSE HEADERS ${lucene++-base_SOURCE_DIR}/include/*.h) +file(GLOB_RECURSE HEADERS ${lucene++-base_SOURCE_DIR}/include/*.h + ${lucene++-base_BINARY_DIR}/include/*.h) #C sources... file(GLOB_RECURSE lucene_c_sources