cmake: sync with branch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34953 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2010-07-17 22:24:08 +00:00
parent da45f74df2
commit f151f3a30f
5 changed files with 125 additions and 86 deletions

View File

@ -31,8 +31,13 @@ message(STATUS "Switch LYX_* variables by -DLYX_*=1 or 0:")
# 2. parameter: description
# 3. parameter: default value, ON or OFF
# 4. parameter: system on which option is used: ALL, GCC, MSVC, ...
message(STATUS)
message(STATUS "Switch LYX_* variables by -DLYX_*=1 or 0:")
message(STATUS)
LYX_OPTION(NLS "Use nls" OFF ALL)
LYX_OPTION(ASPELL "Require aspell" OFF ALL)
LYX_OPTION(AIKSAURUS "Require Aiksaurus" OFF ALL)
LYX_OPTION(ENCHANT "Require Enchant" OFF ALL)
LYX_OPTION(DEBUG "Build debug version" OFF ALL)
LYX_OPTION(RELEASE "Build release version" ON ALL)
LYX_OPTION(PROFILE "Build profile version" OFF GCC)
@ -55,6 +60,19 @@ LYX_OPTION(SHARED_LIBRARIES "Build shared libraries" OFF ALL)
message(STATUS)
if(LYX_INSTALL)
set(LYX_NLS ON CACHE BOOL "Nls option" FORCE)
set(LYX_ASPELL ON CACHE BOOL "Aspell option" FORCE)
set(LYX_AIKSAURUS ON CACHE BOOL "Aiksaurus option" FORCE)
set(LYX_NO_CONSOLE ON CACHE BOOL "No console option" FORCE)
set(LYX_PACKAGE_SUFFIX ON CACHE BOOL "Package suffix option" FORCE)
set(LYX_RELEASE ON CACHE BOOL "Release option" FORCE)
set(LYX_DEBUG OFF CACHE BOOL "Debug option" FORCE)
set(LYX_PROFILE OFF CACHE BOOL "Profile option" FORCE)
set(LYX_MERGE_FILES ON CACHE BOOL "Merge option" FORCE)
endif()
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
@ -77,16 +95,6 @@ else()
endif()
if(LYX_INSTALL)
set(LYX_ASPELL ON CACHE BOOL "Aspell option" FORCE)
set(LYX_NLS ON CACHE BOOL "Nls option" FORCE)
SET(LYX_NO_CONSOLE ON CACHE BOOL "No console option" FORCE)
SET(LYX_PACKAGE_SUFFIX ON CACHE BOOL "Package suffix option" FORCE)
SET(LYX_RELEASE ON CACHE BOOL "Release option" FORCE)
SET(LYX_DEBUG OFF CACHE BOOL "Debug option" FORCE)
SET(LYX_PROFILE OFF CACHE BOOL "Profile option" FORCE)
endif()
# Supress regeneration
set(CMAKE_SUPPRESS_REGENERATION TRUE)
@ -189,17 +197,10 @@ set(LYX_MOC_FILES moc_*.cpp)
include(ProjectSourceGroup)
if(LYX_MERGE_FILES)
add_definitions(-DLYX_MERGED_BUILD)
endif()
set(CMAKE_BUILD_TYPE Release)
if(LYX_PROFILE)
set(CMAKE_BUILD_TYPE Profile CACHE TYPE STRING FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg"
CACHE TYPE STRING FORCE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg" CACHE TYPE STRING FORCE)
endif()
if(LYX_RELEASE)
@ -246,9 +247,18 @@ add_definitions(-DQT_NO_STL -DQT_NO_KEYWORDS)
find_package(ZLIB REQUIRED)
if(LYX_ASPELL)
find_package(ASPELL REQUIRED)
else()
find_package(ASPELL)
include_directories(${ASPELL_INCLUDE_DIR})
endif()
if(LYX_AIKSAURUS)
find_package(AiksaurusLIB REQUIRED)
include_directories(${AIKSAURUSLIB_INCLUDE_DIR})
endif()
if(LYX_ENCHANT)
find_package(Enchant REQUIRED)
include_directories(${ENCHANT_INCLUDE_DIR})
endif()
@ -258,6 +268,7 @@ if(LYX_USE_EXTERNAL_LIBINTL)
endif()
#TODO move to FindHunstall.cmake
if(WIN32)
find_library(HUNSPELL_LIBRARY "libhunspell")
else()
@ -267,7 +278,6 @@ endif()
if (HUNSPELL_LIBRARY)
find_file(HUNSPELL_FOUND "hunspell/hunspell.hxx")
endif()
if (HUNSPELL_FOUND)
add_definitions(-DUSE_HUNSPELL=1)
message(STATUS "Building with USE_HUNSPELL")
@ -275,32 +285,15 @@ else()
message(STATUS "Hunspell not found, building without hunspell support")
endif()
if(WIN32)
find_library(ENCHANT_LIBRARY "libenchant")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h")
else()
find_library(ENCHANT_LIBRARY "enchant" "/usr/local/lib" "/usr/lib" "/usr/local/lib" "/opt/local/lib")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h" PATHS /usr/local/include /usr/local/include/enchant /usr/include /usr/include/enchant /opt/local/include/enchant)
endif()
if (ENCHANT_LIBRARY AND ENCHANT_INCLUDE_DIR)
set(ENCHANT_FOUND TRUE)
add_definitions(-DUSE_ENCHANT=1)
message(STATUS "Building with USE_ENCHANT")
else()
message(STATUS "Enchant not found, building without enchant support")
endif()
if(LYX_NLS)
add_definitions(-DENABLE_NLS=1)
add_definitions(-DENABLE_NLS=1)
endif()
if(ASPELL_FOUND)
add_definitions(-DUSE_ASPELL=1)
endif()
if(WIN32)
if(LYX_NO_CONSOLE)
if(LYX_NO_CONSOLE)
set(WIN32_CONSOLE WIN32)
set(LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARY})
endif()
@ -368,18 +361,17 @@ else()
endif()
if(MSVC)
if(LYX_VLD)
set(LYX_LEAK_DETECTION 1 CACHE TYPE STRING FORCE)
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
set(vld_path ${CMAKE_CURRENT_SOURCE_DIR}/../Win32/vld)
include(${vld_path}/tools/cmake/vld.cmake)
endif()
if(LYX_VLD)
set(LYX_LEAK_DETECTION 1 CACHE TYPE STRING FORCE)
set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
set(LYX_VLD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../Win32/vld)
include(${LYX_VLD_PATH}/tools/cmake/vld.cmake)
endif()
# TODO options
if(LYX_WALL)
# Use the highest warning level
set(CMAKE_CXX_WARNING_LEVEL 4 CACHE TYPE STRING FORCE)
set(WARNING_LEVEL_MESSAGE "(switch to warning level 3 with -DWALL=0)")
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@ -407,7 +399,6 @@ if(MSVC)
else()
set(CMAKE_CXX_WARNING_LEVEL 3 CACHE TYPE STRING FORCE)
set(WARNING_LEVEL_MESSAGE "(switch to warning level 4 with -DWALL=1)")
# add here warnings which should produce an error /weXXXX
set(MSVC_W_ERROR "/we4101 /we4189")
@ -501,7 +492,7 @@ add_subdirectory(src)
if(LYX_INSTALL)
add_subdirectory(man)
FIND_PROGRAM(LYX_PERL_EXECUTABLE python)
FIND_PROGRAM(LYX_PERL_EXECUTABLE perl)
if(NOT ${LYX_PERL_EXECUTABLE} MATCHES "-NOTFOUND")
add_subdirectory(doc)
endif()

View File

@ -18,9 +18,6 @@
#include "pcheaders.h"
#endif
#cmakedefine WORDS_BIGENDIAN 1
#cmakedefine PACKAGE "${PACKAGE}"
#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"
@ -41,17 +38,38 @@
#cmakedefine USE_MACOSX_PACKAGING 1
#cmakedefine PATH_MAX ${PATH_MAX}
#cmakedefine WORDS_BIGENDIAN 1
#cmakedefine LYX_MERGE_FILES 1
#cmakedefine LYX_USE_TR1 1
#cmakedefine LYX_USE_TR1_REGEX 1
#cmakedefine ASPELL_FOUND 1
#ifdef ASPELL_FOUND
#define USE_ASPELL 1
#endif
#cmakedefine AIKSAURUSLIB_FOUND 1
#ifdef AIKSAURUSLIB_FOUND
#define HAVE_LIBAIKSAURUS 1
#define AIKSAURUS_H_LOCATION "${AIKSAURUSLIB_H}"
#endif
#cmakedefine ENCHANT_FOUND 1
#ifdef ENCHANT_FOUND
#define USE_ENCHANT 1
#endif
// cleanup global namespace
#endif // config.h guard
// Unguarded cleanup of global namespace:
#ifdef ColorMode
#undef ColorMode
#endif
@ -92,5 +110,3 @@
#undef KeyPress
#endif

View File

@ -14,9 +14,9 @@ find_path(AIKSAURUSLIB_INCLUDE_DIR NAMES Aiksaurus.h
PATH_SUFFIXES "" "Aiksaurus")
if(AIKSAURUSLIB_INCLUDE_DIR)
if(AIKSAURUSLIB_INCLUDE_DIR MATCHES "Aiksaurus")
set(AIKSAURUS_H Aiksaurus/Aiksaurus.h)
set(AIKSAURUSLIB_H Aiksaurus/Aiksaurus.h)
else()
set(AIKSAURUS_H Aiksaurus.h)
set(AIKSAURUSLIB_H Aiksaurus.h)
endif()
endif()
@ -31,4 +31,6 @@ find_library(AIKSAURUSLIB_LIBRARY NAMES ${POTENTIAL_AIKSAURUS_LIBS}
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AIKSAURUSLIB DEFAULT_MSG AIKSAURUSLIB_LIBRARY AIKSAURUSLIB_INCLUDE_DIR)
mark_as_advanced(AIKSAURUSLIB_LIBRARY AIKSAURUSLIB_INCLUDE_DIR)
set(AIKSAURUSLIB_H ${AIKSAURUSLIB_H} CACHE STRING "Aiksaurus header" FORCE)
mark_as_advanced(AIKSAURUSLIB_LIBRARY AIKSAURUSLIB_INCLUDE_DIR AIKSAURUSLIB_H)

View File

@ -0,0 +1,36 @@
if(WIN32)
find_library(ENCHANT_LIBRARY "libenchant")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h")
else()
find_library(ENCHANT_LIBRARY "enchant"
"/usr/local/lib"
"/usr/lib"
"/usr/local/lib"
"/opt/local/lib")
find_path(ENCHANT_INCLUDE_DIR "enchant++.h" PATHS
/usr/local/include
/usr/local/include/enchant
/usr/include
/usr/include/enchant
/opt/local/include/enchant)
endif()
if (ENCHANT_LIBRARY AND ENCHANT_INCLUDE_DIR)
set(ENCHANT_FOUND TRUE)
add_definitions(-DUSE_ENCHANT=1)
message(STATUS "Building with USE_ENCHANT")
else()
message(STATUS "Enchant not found, building without enchant support")
endif()
# handle the QUIETLY and REQUIRED arguments and
# set ENCHANT_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)
if(Enchant_FIND_REQUIRED AND NOT ENCHANT_FOUND)
message(FATAL_ERROR "Could not find Enchant library")
endif()
mark_as_advanced(ENCHANT_LIBRARY ENCHANT_INCLUDE_DIR)

View File

@ -25,49 +25,43 @@ list(REMOVE_ITEM lyx_sources ${moc_files} .)
file(GLOB lyx_headers ${TOP_SRC_DIR}/src/${LYX_HPP_FILES})
list(REMOVE_ITEM lyx_sources
${TOP_SRC_DIR}/src/EnchantChecker.cpp
${TOP_SRC_DIR}/src/AspellChecker.cpp
${TOP_SRC_DIR}/src/HunspellChecker.cpp
${TOP_SRC_DIR}/src/Variables.cpp
${TOP_SRC_DIR}/src/Section.cpp
${TOP_SRC_DIR}/src/lyxcore.cpp
${TOP_SRC_DIR}/src/lyxinsets.cpp
${TOP_SRC_DIR}/src/lyxmathed.cpp)
if(NOT APPLE)
list(REMOVE_ITEM lyx_sources
${TOP_SRC_DIR}/src/AppleSpellChecker.cpp)
list(REMOVE_ITEM lyx_headers
${TOP_SRC_DIR}/src/AppleSpellChecker.h)
endif()
list(REMOVE_ITEM lyx_headers
${TOP_SRC_DIR}/src/EnchantChecker.h
${TOP_SRC_DIR}/src/AspellChecker.h
${TOP_SRC_DIR}/src/HunspellChecker.h
${TOP_SRC_DIR}/src/Variables.h
${TOP_SRC_DIR}/src/Section.h)
if (HUNSPELL_FOUND)
list(APPEND lyx_sources ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
list(APPEND lyx_headers ${TOP_SRC_DIR}/src/HunspellChecker.h)
set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
if(NOT APPLE)
list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/AppleSpellChecker.cpp)
list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/AppleSpellChecker.h)
endif()
if (ASPELL_FOUND)
include_directories(${ASPELL_INCLUDE_DIR})
list(APPEND lyx_sources ${TOP_SRC_DIR}/src/AspellChecker.cpp)
list(APPEND lyx_headers ${TOP_SRC_DIR}/src/AspellChecker.h)
if(NOT ASPELL_FOUND)
list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/ASpellChecker.cpp)
list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/ASpellchecker.h)
else()
set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/AspellChecker.cpp)
endif()
if (ENCHANT_FOUND)
include_directories("${ENCHANT_INCLUDE_DIR}")
list(APPEND lyx_sources ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
list(APPEND lyx_headers ${TOP_SRC_DIR}/src/EnchantChecker.h)
set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
if(NOT ENCHANT_FOUND)
list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/EnchantChecker.h)
else()
set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/EnchantChecker.cpp)
endif()
if(NOT HUNSPELL_FOUND)
list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/HunspellChecker.h)
else()
set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/HunspellChecker.cpp)
endif()
lyx_automoc(${TOP_SRC_DIR}/src/Compare.cpp)
if (WIN32)
lyx_automoc(${TOP_SRC_DIR}/src/Server.cpp)