mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-19 14:30:32 +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
|
# Supress regeneration
|
||||||
set(CMAKE_SUPPRESS_REGENERATION FALSE)
|
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)
|
if(NOT help AND NOT HELP)
|
||||||
# 'project' triggers the searching for a compiler
|
# 'project' triggers the searching for a compiler
|
||||||
project(${LYX_PROJECT})
|
project(${LYX_PROJECT})
|
||||||
@ -146,7 +159,7 @@ endif()
|
|||||||
|
|
||||||
if(LYX_INSTALL)
|
if(LYX_INSTALL)
|
||||||
set(LYX_NLS ON)
|
set(LYX_NLS ON)
|
||||||
if (WIN32)
|
if(WIN32 AND NOT MINGW)
|
||||||
set(LYX_HUNSPELL ON)
|
set(LYX_HUNSPELL ON)
|
||||||
endif()
|
endif()
|
||||||
if(LYX_CONSOLE MATCHES "FORCE")
|
if(LYX_CONSOLE MATCHES "FORCE")
|
||||||
@ -168,6 +181,7 @@ else()
|
|||||||
set(LYX_MERGE_REBUILD OFF)
|
set(LYX_MERGE_REBUILD OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(LYX_DEPENDENCIES_DOWNLOAD)
|
if(LYX_DEPENDENCIES_DOWNLOAD)
|
||||||
message(STATUS)
|
message(STATUS)
|
||||||
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps)
|
set(LYX_DEPENDENCIES_DIR ${TOP_BINARY_DIR}/msvc2010-deps)
|
||||||
@ -509,7 +523,12 @@ if(LYX_CXX_FLAGS_EXTRA)
|
|||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
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)
|
if (Qt5Core_FOUND)
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5Widgets REQUIRED)
|
||||||
find_package(Qt5X11Extras)
|
find_package(Qt5X11Extras)
|
||||||
@ -578,6 +597,7 @@ if(LYX_NLS)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
find_package(ICONV REQUIRED)
|
find_package(ICONV REQUIRED)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
|
|
||||||
@ -791,7 +811,9 @@ if(LYX_INSTALL)
|
|||||||
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
|
if(${LYX_PYTHON_EXECUTABLE} MATCHES "-NOTFOUND")
|
||||||
message(STATUS "Python required to create doc!")
|
message(STATUS "Python required to create doc!")
|
||||||
else()
|
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")
|
add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
|
||||||
endif()
|
endif()
|
||||||
include(../Install)
|
include(../Install)
|
||||||
|
@ -37,7 +37,46 @@ set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
|
|||||||
if (APPLE)
|
if (APPLE)
|
||||||
# We don't need absolute paths
|
# We don't need absolute paths
|
||||||
set(CPACK_SET_DESTDIR "OFF")
|
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
|
# needed by rpm
|
||||||
set(CPACK_SET_DESTDIR "ON")
|
set(CPACK_SET_DESTDIR "ON")
|
||||||
endif()
|
endif()
|
||||||
|
@ -41,9 +41,9 @@ endmacro(lyx_add_path _out _prefix)
|
|||||||
#create the implementation files from the ui files and add them
|
#create the implementation files from the ui files and add them
|
||||||
#to the list of sources
|
#to the list of sources
|
||||||
#usage: LYX_ADD_QT4_UI_FILES(foo_SRCS ${ui_files})
|
#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})
|
foreach (_current_FILE ${ARGN})
|
||||||
|
|
||||||
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
get_filename_component(_tmp_FILE ${_current_FILE} ABSOLUTE)
|
||||||
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
|
get_filename_component(_basename ${_tmp_FILE} NAME_WE)
|
||||||
set(_header ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.h)
|
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,
|
# Latest test showed on linux and windows show no bad consequeces,
|
||||||
# so we removed the call to LyXuic.cmake
|
# so we removed the call to LyXuic.cmake
|
||||||
qt_wrap_uifiles(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_)
|
qt_wrap_uifiles(${_header} ${_tmp_FILE} OPTIONS -tr lyx::qt_)
|
||||||
set(${_ui} ${${_ui}} ${_header})
|
list(APPEND uifiles ${_header})
|
||||||
endforeach (_current_FILE)
|
endforeach()
|
||||||
|
set(${_ui_files} ${uifiles})
|
||||||
endmacro(LYX_ADD_UI_FILES)
|
endmacro(LYX_ADD_UI_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ if (LYX_VLD)
|
|||||||
lyx_add_info_files(VLD ${vld_files})
|
lyx_add_info_files(VLD ${vld_files})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32 AND NOT MINGW)
|
||||||
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
||||||
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
||||||
endif()
|
endif()
|
||||||
|
@ -68,7 +68,7 @@ target_link_libraries(frontend_qt4
|
|||||||
lyx_add_gcc_pch(frontend_qt4)
|
lyx_add_gcc_pch(frontend_qt4)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(frontend_qt4 Gdi32)
|
target_link_libraries(frontend_qt4 gdi32)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project_source_group("${GROUP_CODE}" frontends_qt4_sources frontends_qt4_headers)
|
project_source_group("${GROUP_CODE}" frontends_qt4_sources frontends_qt4_headers)
|
||||||
|
@ -29,7 +29,7 @@ include_directories(BEFORE
|
|||||||
${TOP_SRC_DIR}/src/support/minizip
|
${TOP_SRC_DIR}/src/support/minizip
|
||||||
${ZLIB_INCLUDE_DIR})
|
${ZLIB_INCLUDE_DIR})
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32 AND NOT MINGW)
|
||||||
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
|
||||||
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user