X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=CMakeLists.txt;h=39880f24ef63f35da39e8fcf29e4d7167fdd5a89;hb=86d2a203b060481a663356427e56a1c229f3fd6c;hp=5840ad08a03b388ba29b3b08fe1e056cc10b5ebf;hpb=a15aafa2a1e7fa2cedce13e15d0622bc31a3fe46;p=lyx.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 5840ad08a0..39880f24ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,9 @@ set(LYX_PROJECT LyX) enable_testing() -get_filename_component(lyx_dir_readme ${CMAKE_SOURCE_DIR}/README ABSOLUTE) +get_filename_component(lyx_dir_readme ${CMAKE_SOURCE_DIR}/README REALPATH) # Resolve symlinks get_filename_component(TOP_SRC_DIR ${lyx_dir_readme} PATH) +message(STATUS "TOP_SRC_DIR = ${TOP_SRC_DIR}") set(LYX_CMAKE_DIR "development/cmake") set(TOP_CMAKE_PATH "${TOP_SRC_DIR}/${LYX_CMAKE_DIR}") @@ -138,6 +139,7 @@ LYX_OPTION(ENABLE_URLTESTS "Enable for URL tests" OFF ALL) LYX_OPTION(ENABLE_EXPORT_TESTS "Enable for export tests" OFF ALL) LYX_OPTION(ASAN "Use address sanitizer" OFF ALL) LYX_COMBO(USE_QT "Use Qt version as frontend" QT4 QT5) +LYX_OPTION(3RDPARTY_BUILD "Build 3rdparty libs" OFF ALL) # GCC specific LYX_OPTION(PROFILE "Build profile version" OFF GCC) @@ -208,10 +210,18 @@ endif() if(LYX_DEPENDENCIES_DOWNLOAD) message(STATUS) - set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps) - message(STATUS "Using downloaded dependencies in ${LYX_DEPENDENCIES_DIR}") - set(deps_files lyx20-deps-msvc2010-x86.zip) - set(deps_server http://downloads.sourceforge.net/project/lyx/Win_installers/Dependencies) + if(MSVC12) + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2013-deps) + set(deps_files lyx-windows-deps-msvc2013.zip) + set(deps_server http://ftp.lyx.de/LyX-Windows-Deps) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2013) + else() + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps) + set(deps_files lyx20-deps-msvc2010-x86.zip) + set(deps_server http://downloads.sourceforge.net/project/lyx/Win_installers/Dependencies) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/deps20) + endif() + message(STATUS "Using downloaded dependencies in ${LYX_DEPENDENCIES_DIR}") foreach(it ${deps_files}) set(already_downloaded already_downloaded-NOTFOUND CACHE PATH "downloaded" FORCE) find_file(already_downloaded ${it} "${LYX_DEPENDENCIES_DIR}/download") @@ -228,11 +238,6 @@ if(LYX_DEPENDENCIES_DOWNLOAD) WORKING_DIRECTORY ${LYX_DEPENDENCIES_DIR}) endif() endforeach() - set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/deps20) - if(MSVC12) - # handle error in msvc12 when linking against msvc10 libs - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vd2") - endif() endif() @@ -572,6 +577,9 @@ if(LYX_USE_QT MATCHES "QT5") qt5_wrap_ui(${ARGN}) endmacro() message(STATUS "Found Qt-Version ${QTVERSION}") + if(WIN32) + set(LYX_QTMAIN_LIBRARY ${Qt5Core_QTMAIN_LIBRARIES}) + endif() endif() elseif(LYX_USE_QT MATCHES "QT4") if(LYX_XMINGW) @@ -587,6 +595,9 @@ elseif(LYX_USE_QT MATCHES "QT4") macro (qt_wrap_uifiles) qt4_wrap_ui(${ARGN}) endmacro() + if(WIN32) + set(LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARIES}) + endif() else() message(FATAL_ERROR "Unhandled value for LYX_USE_QT (${LYX_USE_QT})") endif() @@ -601,9 +612,20 @@ include_directories(${TOP_BINARY_DIR} ${TOP_SRC_DIR}/src) set(Spelling_FOUND OFF) set(Include_used_spellchecker) # String will be inserted into config.h +if(LYX_3RDPARTY_BUILD) + add_subdirectory(3rdparty/hunspell) + add_definitions(-DHUNSPELL_STATIC) + set(HUNSPELL_FOUND ON) + message(STATUS " * Hunspell:") + message(STATUS " - include: ${HUNSPELL_INCLUDE_DIR}") + message(STATUS " - library: ${HUNSPELL_LIBRARY}") +endif() + foreach(_spell "ASPELL" "Enchant" "Hunspell") string(TOUPPER ${_spell} _upspell) - find_package(${_spell}) + if (NOT ${_upspell}_FOUND) + find_package(${_spell}) + endif() if (${_upspell}_FOUND) include_directories(${${_upspell}_INCLUDE_DIR}) set(Spelling_FOUND ON) @@ -618,22 +640,24 @@ foreach(_spell "ASPELL" "Enchant" "Hunspell") endif() endforeach() -find_package(PythonInterp 2.7 QUIET) -if(PYTHONINTERP_FOUND) - if(PYTHON_VERSION_STRING VERSION_GREATER 2.8) - unset(PYTHONINTERP_FOUND) - endif() -endif() +if(NOT LYX_PYTHON_EXECUTABLE) + find_package(PythonInterp 2.7 QUIET) + if(PYTHONINTERP_FOUND) + if(PYTHON_VERSION_STRING VERSION_GREATER 2.8) + unset(PYTHONINTERP_FOUND) + endif() + endif() -if (NOT PYTHONINTERP_FOUND) - unset(PYTHON_EXECUTABLE CACHE) - unset(PYTHON_VERSION_MAJOR) - unset(PYTHON_VERSION_MINOR) - unset(PYTHON_VERSION_STRING) - find_package(PythonInterp 3.3 REQUIRED) -endif() + if(NOT PYTHONINTERP_FOUND AND NOT GNUWIN32_DIR) + unset(PYTHON_EXECUTABLE CACHE) + unset(PYTHON_VERSION_MAJOR) + unset(PYTHON_VERSION_MINOR) + unset(PYTHON_VERSION_STRING) + find_package(PythonInterp 3.3 REQUIRED) + endif() -set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX") + set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX") +endif() if(LYX_NLS) find_package(LyXGettext) @@ -650,9 +674,16 @@ if(LYX_NLS) endif() endif() - -find_package(ICONV REQUIRED) -find_package(ZLIB REQUIRED) +if(UNIX) + find_package(ICONV REQUIRED) + find_package(ZLIB REQUIRED) +else() + if(LYX_3RDPARTY_BUILD) + add_subdirectory(3rdparty/libiconv) + set(HAVE_ICONV_CONST 1) + add_subdirectory(3rdparty/zlib) + endif() +endif() if(LYX_EXTERNAL_BOOST) message(STATUS "Searching for boost") @@ -683,17 +714,18 @@ else() endif() add_definitions(-DBOOST_USER_CONFIG="") add_definitions(-DBOOST_SIGNALS_NO_DEPRECATION_WARNING=1) - include_directories(${TOP_SRC_DIR}/boost) - add_subdirectory(boost "${TOP_BINARY_DIR}/boost") + include_directories(${TOP_SRC_DIR}/3rdparty/boost) + add_subdirectory(3rdparty/boost "${TOP_BINARY_DIR}/3rdparty/boost") endif() if(WIN32) - if(NOT LYX_CONSOLE) + if(LYX_CONSOLE) + set(LYX_QTMAIN_LIBRARY) + else() set(WIN32_CONSOLE WIN32) - set(LYX_QTMAIN_LIBRARY ${QT_QTMAIN_LIBRARY}) endif() if(MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DNOMINMAX) @@ -918,10 +950,10 @@ if(LYX_NLS) message(STATUS "Building Native Language Support (LYX_NLS is set), used libraries:") message(STATUS) message(STATUS " * iconv") - message(STATUS " - header : ${ICONV_HEADER}") + message(STATUS " - include: ${ICONV_INCLUDE_DIR}") message(STATUS " - library: ${ICONV_LIBRARY}") message(STATUS " * zlib") - message(STATUS " - header : ${ZLIB_HEADER}") + message(STATUS " - include: ${ZLIB_INCLUDE_DIR}") message(STATUS " - library: ${ZLIB_LIBRARY}") message(STATUS) endif()