mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
build with mingw on Windows and Linux
This commit is contained in:
parent
de091e6ceb
commit
080fca85a8
@ -47,6 +47,19 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
|
||||
# Supress regeneration
|
||||
set(CMAKE_SUPPRESS_REGENERATION FALSE)
|
||||
|
||||
if(LYX_XMINGW)
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(TOOLNAME ${LYX_XMINGW})
|
||||
set(TOOLCHAIN "${TOOLNAME}-")
|
||||
set(CMAKE_C_COMPILER "${TOOLCHAIN}gcc" CACHE PATH "Mingw C compiler" FORCE)
|
||||
set(CMAKE_CXX_COMPILER "${TOOLCHAIN}g++" CACHE PATH "Mingw C++ compiler" FORCE)
|
||||
set(CMAKE_RC_COMPILER "${TOOLCHAIN}windres" CACHE PATH "Mingw rc compiler" FORCE)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
endif()
|
||||
|
||||
if(NOT help AND NOT HELP)
|
||||
# 'project' triggers the searching for a compiler
|
||||
project(${LYX_PROJECT})
|
||||
@ -146,7 +159,7 @@ endif()
|
||||
|
||||
if(LYX_INSTALL)
|
||||
set(LYX_NLS ON)
|
||||
if (WIN32)
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(LYX_HUNSPELL ON)
|
||||
endif()
|
||||
if(LYX_CONSOLE MATCHES "FORCE")
|
||||
@ -168,6 +181,7 @@ else()
|
||||
set(LYX_MERGE_REBUILD OFF)
|
||||
endif()
|
||||
|
||||
|
||||
if(LYX_DEPENDENCIES_DOWNLOAD)
|
||||
message(STATUS)
|
||||
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps)
|
||||
@ -509,7 +523,12 @@ if(LYX_CXX_FLAGS_EXTRA)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
find_package(Qt5Core QUIET)
|
||||
if(LYX_XMINGW)
|
||||
set(QT_MINGW_DIR ${LYX_QT4} CACHE PATH "Qt for Mingw" FORCE)
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH ${QT_MINGW_DIR} ${GNUWIN32_DIR})
|
||||
else()
|
||||
find_package(Qt5Core QUIET)
|
||||
endif()
|
||||
if (Qt5Core_FOUND)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5X11Extras)
|
||||
@ -578,6 +597,7 @@ if(LYX_NLS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
find_package(ICONV REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
@ -791,7 +811,9 @@ if(LYX_INSTALL)
|
||||
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
|
||||
message(STATUS "Python required to create doc!")
|
||||
else()
|
||||
add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
|
||||
if(UNIX)
|
||||
add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
|
||||
endif()
|
||||
add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
|
||||
endif()
|
||||
include(../Install)
|
||||
|
@ -37,7 +37,46 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
|
||||
if (APPLE)
|
||||
# We don't need absolute paths
|
||||
set(CPACK_SET_DESTDIR "OFF")
|
||||
elseif (NOT WIN32)
|
||||
elseif(WIN32)
|
||||
set(CPACK_GENERATOR ZIP)
|
||||
set(CPACK_BINARY_ZIP 1)
|
||||
if(MINGW)
|
||||
get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
|
||||
if(LYX_XMINGW)
|
||||
get_filename_component(mingw_name ${LYX_XMINGW} NAME)
|
||||
set(MINGW_BIN_PATH ${MINGW_BIN_PATH}/../${mingw_name}/lib)
|
||||
endif()
|
||||
if(EXISTS ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
|
||||
list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
|
||||
elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
|
||||
list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
|
||||
elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
|
||||
list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
|
||||
endif()
|
||||
if(EXISTS ${MINGW_BIN_PATH}/libstdc++-6.dll)
|
||||
list(APPEND runtime ${MINGW_BIN_PATH}/libstdc++-6.dll)
|
||||
endif()
|
||||
if(EXISTS ${MINGW_BIN_PATH}/libwinpthread-1.dll)
|
||||
list(APPEND runtime ${MINGW_BIN_PATH}/libwinpthread-1.dll)
|
||||
endif()
|
||||
if(NOT runtime)
|
||||
message(FATAL_ERROR "No mingw runtime found in ${MINGW_BIN_PATH}")
|
||||
endif()
|
||||
|
||||
install(FILES
|
||||
${runtime}
|
||||
${QT_BINARY_DIR}/QtCore4.dll
|
||||
${QT_BINARY_DIR}/QtGui4.dll
|
||||
${QT_BINARY_DIR}/QtNetwork4.dll
|
||||
${QT_PLUGINS_DIR}/imageformats/qgif4.dll
|
||||
${QT_PLUGINS_DIR}/imageformats/qico4.dll
|
||||
${QT_PLUGINS_DIR}/imageformats/qmng4.dll
|
||||
${QT_PLUGINS_DIR}/imageformats/qsvg4.dll
|
||||
${QT_PLUGINS_DIR}/imageformats/qtga4.dll
|
||||
${QT_PLUGINS_DIR}/imageformats/qtiff4.dll
|
||||
DESTINATION bin CONFIGURATIONS Release)
|
||||
endif()
|
||||
else()
|
||||
# needed by rpm
|
||||
set(CPACK_SET_DESTDIR "ON")
|
||||
endif()
|
||||
|
@ -41,9 +41,9 @@ endmacro(lyx_add_path _out _prefix)
|
||||
#create the implementation files from the ui files and add them
|
||||
#to the list of sources
|
||||
#usage: LYX_ADD_QT4_UI_FILES(foo_SRCS ${ui_files})
|
||||
macro(LYX_ADD_UI_FILES _sources _ui)
|
||||
macro(LYX_ADD_UI_FILES _sources _ui_files)
|
||||
set(uifiles})
|
||||
foreach (_current_FILE ${ARGN})
|
||||
|
||||
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
|
||||
set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h)
|
||||
@ -54,8 +54,9 @@ macro(LYX_ADD_UI_FILES _sources _ui)
|
||||
# Latest test showed on linux and windows show no bad consequeces,
|
||||
# so we removed the call to LyXuic.cmake
|
||||
qt_wrap_uifiles(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_)
|
||||
set(${_ui} ${${_ui}} ${_header})
|
||||
endforeach (_current_FILE)
|
||||
list(APPEND uifiles ${_header})
|
||||
endforeach()
|
||||
set(${_ui_files} ${uifiles})
|
||||
endmacro(LYX_ADD_UI_FILES)
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ if (LYX_VLD)
|
||||
lyx_add_info_files(VLD ${vld_files})
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
||||
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
||||
endif()
|
||||
|
@ -68,7 +68,7 @@ target_link_libraries(frontend_qt4
|
||||
lyx_add_gcc_pch(frontend_qt4)
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(frontend_qt4 Gdi32)
|
||||
target_link_libraries(frontend_qt4 gdi32)
|
||||
endif()
|
||||
|
||||
project_source_group("${GROUP_CODE}" frontends_qt4_sources frontends_qt4_headers)
|
||||
|
@ -29,7 +29,7 @@ include_directories(BEFORE
|
||||
${TOP_SRC_DIR}/src/support/minizip
|
||||
${ZLIB_INCLUDE_DIR})
|
||||
|
||||
if(WIN32)
|
||||
if(WIN32 AND NOT MINGW)
|
||||
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
||||
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user