X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=CMakeLists.txt;h=f8ca0c10fdd39c5e699ac8bdca8cd490570f44da;hb=d008ca2539158ab5ddcc9b5887d8517c300c42c1;hp=fedcbb1be15544724e2219e3a03c199ed0290cd7;hpb=4c58315d4b867cf5cce0fa05f168e448381f21d8;p=features.git diff --git a/CMakeLists.txt b/CMakeLists.txt index fedcbb1be1..f8ca0c10fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,9 +77,9 @@ if(NOT help AND NOT HELP) # 'project' triggers the searching for a compiler project(${LYX_PROJECT}) if (CMAKE_COMPILER_IS_GNUCXX) - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") message(STATUS "Gnu CXX compiler version = ${CMAKE_CXX_COMPILER_VERSION}") - message(STATUS "is too old, should be >= 4.0") + message(STATUS "is too old, should be >= 4.9") message(FATAL_ERROR "Exiting") endif() endif() @@ -247,7 +247,49 @@ LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC) LYX_OPTION(DMG "Build as Mac bundle, needed for .dmg (experimental) " OFF MAC) LYX_OPTION(COCOA "Use Cocoa on Mac" OFF MAC) -# Try to get some informations from configure.ac +# On Windows, download the dependencies if need be. +if(LYX_DEPENDENCIES_DOWNLOAD) + message(STATUS) + # Do not check for bitness against CMAKE_SIZEOF_VOID_P, as it relates to the bitness of the CMake executable, + # not that of the compiler. + if(MSVC_VERSION GREATER_EQUAL 1920 AND "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" MATCHES "x64") + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2019-deps-64) + set(deps_files lyx-windows-deps-msvc2019_64.zip) + set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2019-64) + elseif(MSVC_VERSION GREATER_EQUAL 1920) + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2019-deps) + set(deps_files lyx-windows-deps-msvc2019_32.zip) + set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2019) + elseif(MSVC_VERSION GREATER_EQUAL 1900 AND NOT "${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" MATCHES "x64") + set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2015-deps) + set(deps_files lyx-windows-deps-msvc2015.zip) + set(deps_server http://ftp.lyx.org/pub/lyx/devel/win_deps) + set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2015) + else() + message(FATAL_ERROR "error: no dependency package known for the selected MSVC version.") + 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") + if(NOT already_downloaded) + message(STATUS "Downloading ${it} ...") + file(DOWNLOAD ${deps_server}/${it} ${LYX_DEPENDENCIES_DIR}/download/${it} SHOW_PROGRESS STATUS status LOG log) + list(GET status 0 status_code) + list(GET status 1 status_string) + if(NOT status_code EQUAL 0) + file(REMOVE ${LYX_DEPENDENCIES_DIR}/${it}) + message(FATAL_ERROR "error: downloading '${it}' failed. status_code: ${status_code}, status_string: ${status_string}. \nLog: ${log} ") + endif() + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${LYX_DEPENDENCIES_DIR}/download/${it} + WORKING_DIRECTORY ${LYX_DEPENDENCIES_DIR}) + endif() + endforeach() +endif() + +# Try to get some information from configure.ac include(LyXPaths) @@ -309,40 +351,6 @@ else() set(LYX_MERGE_REBUILD OFF) endif() -if(LYX_DEPENDENCIES_DOWNLOAD) - message(STATUS) - if(MSVC14) - set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2015-deps) - set(deps_files lyx-windows-deps-msvc2015.zip) - set(deps_server http://ftp.lyx.de/LyX-Windows-Deps) - set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2015) - elseif(MSVC10) - set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps) - set(deps_files lyx-windows-deps-msvc2010.zip) - set(deps_server http://ftp.lyx.de/LyX-Windows-Deps) - set(GNUWIN32_DIR ${LYX_DEPENDENCIES_DIR}/lyx-windows-deps-msvc2010) - else() - message(FATAL_ERROR "error: no dependency package known for the selected MSVC version.") - 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") - if(NOT already_downloaded) - message(STATUS "Downloading ${it} ...") - file(DOWNLOAD ${deps_server}/${it} ${LYX_DEPENDENCIES_DIR}/download/${it} SHOW_PROGRESS STATUS status LOG log) - list(GET status 0 status_code) - list(GET status 1 status_string) - if(NOT status_code EQUAL 0) - file(REMOVE ${LYX_DEPENDENCIES_DIR}/${it}) - message(FATAL_ERROR "error: downloading '${it}' failed. status_code: ${status_code}, status_string: ${status_string}. \nLog: ${log} ") - endif() - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${LYX_DEPENDENCIES_DIR}/download/${it} - WORKING_DIRECTORY ${LYX_DEPENDENCIES_DIR}) - endif() - endforeach() -endif() - message(STATUS) set(EXECUTABLE_OUTPUT_PATH ${TOP_BINARY_DIR}/bin) @@ -380,13 +388,7 @@ unset(LYX_GCC11_MODE) if(UNIX OR MINGW) if (CMAKE_CXX_COMPILER_ID MATCHES "^([cC]lang|AppleClang)$") # ignore the GCC_VERSION for clang - # and use the resulting CXX11_STD_REGEX found in FindCXX11Compiler.cmake message(STATUS "Using clang") - if(CXX11_STD_REGEX) - set(LYX_USE_STD_REGEX 1) - else() - set(LYX_USE_STD_REGEX 0) - endif() else() execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpfullversion OUTPUT_VARIABLE GCC_VERSION ERROR_VARIABLE _error RESULT_VARIABLE _err OUTPUT_STRIP_TRAILING_WHITESPACE) #message(STATUS "dumpfullversion: error = ${_error}, result = ${_err}") @@ -396,14 +398,8 @@ if(UNIX OR MINGW) #message(STATUS "dumpversion: error = ${_error}, result = ${_err}") endif() message(STATUS "Using GCC version ${GCC_VERSION}") - if(GCC_VERSION VERSION_LESS 4.6) - message(FATAL_ERROR "gcc >= 4.6 is required.") - elseif(GCC_VERSION VERSION_LESS 4.9) - # in gcc is unusable in versions less than 4.9.0 - # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631 - set(LYX_USE_STD_REGEX 0) - else() - set(LYX_USE_STD_REGEX 1) + if(GCC_VERSION VERSION_LESS 4.9) + message(FATAL_ERROR "gcc >= 4.9 is required.") endif() endif() set(LYX_GCC11_MODE "${CXX11_FLAG}") @@ -411,9 +407,6 @@ else() if(MSVC_VERSION LESS 1900) # Drop support for msvc versions prior to 1900 (Visual Studio 2015) message(FATAL_ERROR "Visual Studio >= 2015 is required.") - set(LYX_USE_STD_REGEX 0) - else() - set(LYX_USE_STD_REGEX 1) endif() endif() @@ -948,40 +941,14 @@ if(NOT LYX_EXTERNAL_DTL) add_subdirectory(3rdparty/dtl) endif() -if(LYX_USE_STD_REGEX) - # Set only include path. - # Use internal boost, which is known to exist - # we don't need any libraries - set(Lyx_Boost_Libraries) - add_definitions(-DBOOST_USER_CONFIG=) - include_directories(${TOP_SRC_DIR}/3rdparty/boost) -else() - # Using boost-regex - if(LYX_EXTERNAL_BOOST) - message(STATUS "Searching for external boost") - find_package(Boost COMPONENTS regex) - if(Boost_FOUND) - message(STATUS "Boost found") - message(STATUS "Boost-libs = ${Boost_LIBRARIES}") - set(Lyx_Boost_Libraries ${Boost_LIBRARIES}) - if (LYX_STDLIB_DEBUG OR LYX_DEBUG_GLIBC OR LYX_DEBUG_GLIBC_PEDANTIC) - # Comment from Jean-Marc Lasgouttes: - # In general, system boost libraries are incompatible with - # the use of stdlib-debug in libstdc++. See ticket #9736 for - # details. - message(FATAL_ERROR "Compiling LyX with stdlib-debug and system boost libraries may lead to crashes. Consider using '-DLYX_STDLIB_DEBUG=OFF -DLYX_DEBUG_GLIBC=OFF -DLYX_DEBUG_GLIBC_PEDANTIC=OFF' or using '-DLYX_EXTERNAL_BOOST=OFF'") - endif() - else() - message(FATAL_ERROR "Boost not found" ${Boost_ERROR_REASON}) - endif() - else() - # Using included boost - set(Lyx_Boost_Libraries boost_regex) - add_definitions(-DBOOST_USER_CONFIG=) - include_directories(${TOP_SRC_DIR}/3rdparty/boost) - add_subdirectory(3rdparty/boost "${TOP_BINARY_DIR}/3rdparty/boost") - endif() -endif() +# Set only include path. +# Use internal boost, which is known to exist +# we don't need any libraries +set(Lyx_Boost_Libraries) +add_definitions(-DBOOST_USER_CONFIG=) +include_directories(${TOP_SRC_DIR}/3rdparty/boost) + +include_directories(${TOP_SRC_DIR}/3rdparty/nod) if(WIN32) if(LYX_CONSOLE) @@ -1110,6 +1077,13 @@ if(MSVC) set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:wchar_t-") endif() + if (MSVC_VERSION GREATER_EQUAL 1914) + # Ensure the __cplusplus macro is set to a sensible value. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zc:__cplusplus") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zc:__cplusplus") + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /Zc:__cplusplus") + endif() + message(STATUS "----- Warning level : ${CMAKE_CXX_WARNING_LEVEL} ${WARNING_LEVEL_MESSAGE}") message(STATUS "----- Warnings as errors : ${MSVC_W_ERROR}") message(STATUS "----- Warnings disabled : ${MSVC_W_DISABLE}") @@ -1182,10 +1156,6 @@ if(QTVERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*") MATH(EXPR QT4_VERSION "(${CMAKE_MATCH_1}<<16)|(${CMAKE_MATCH_2}<<8)|${CMAKE_MATCH_3}") endif() -if (NOT HAVE_REGEX) - set(LYX_USE_STD_REGEX 0) -endif() - set (cmd ${CMAKE_CTEST_COMMAND}) if (MSVC) @@ -1279,4 +1249,10 @@ endif() # can be run last add_subdirectory(development/cmake/post_install) +string(TIMESTAMP current_date "%Y-%m-%d %H:%M") +execute_process(COMMAND ${LYX_GITVERSION} describe --tags + WORKING_DIRECTORY "${TOP_SRC_DIR}" + OUTPUT_VARIABLE current_version + OUTPUT_STRIP_TRAILING_WHITESPACE) +file(APPEND "${TOP_BINARY_DIR}/Testing/IgnoredCount" "${current_date} ${current_version} Ignored tests = ${LYX_ignored_count}\n") message(STATUS)