Updates to cmake scripts needed to build with mingw on Fedora.

These are not really right. Things are hardcoded that probably should
not be. These are marked (hopefully) with "# RKH" comments. Possibly
what's needed is another flag? Anyway, help welcome.
This commit is contained in:
Richard Kimberly Heck 2018-08-30 15:28:13 -04:00
parent dbbb7fbb78
commit 65bc3149ab
6 changed files with 148 additions and 45 deletions

View File

@ -25,6 +25,12 @@ set(TOP_SCRIPT_PATH "${TOP_CMAKE_PATH}/scripts")
set(CMAKE_MODULE_PATH "${TOP_MODULE_PATH}")
# RKH
if(WIN32 AND MINGW)
set(Qt5Core_DIR "/usr/i686-w64-mingw32/sys-root/mingw/lib/cmake/Qt5Core/")
set(GNUWIN32_DIR "/cvs/lyx/lyx-dependencies/lyx-windows-deps-msvc2010/")
endif()
set(CMAKE_PROJECT_NAME ${LYX_PROJECT})
message(STATUS)
@ -304,7 +310,12 @@ include(LyXPaths)
file(STRINGS "${TOP_SRC_DIR}/configure.ac" _config_lines)
if(WIN32)
set(CMAKE_PREFIX_PATH Specify-path-to-Qt CACHE PATH "Used Qt version")
# RKH
if (MINGW)
set(CMAKE_PREFIX_PATH "/usr/i686-w64-mingw32/sys-root/mingw/lib/cmake/Qt5Core/" "/usr/i686-w64-mingw32/sys-root/mingw/lib/cmake/Qt5Widgets/")
else()
set(CMAKE_PREFIX_PATH Specify-path-to-Qt CACHE PATH "Used Qt version")
endif()
if(MSVC)
set(LYX_3RDPARTY_BUILD ON CACHE BOOL "Build 3rdparty libraries" FORCE)
endif()
@ -793,17 +804,23 @@ if(LYX_NLS)
endif()
endif()
if(LYX_EXTERNAL_ICONV)
find_package(ICONV REQUIRED)
# RKH
if(WIN32 AND MINGW)
find_package(ICONV REQUIRED)
find_package(ZLIB REQUIRED)
else()
add_subdirectory(3rdparty/libiconv)
set(HAVE_ICONV_CONST 1)
endif()
if(LYX_EXTERNAL_ICONV)
find_package(ICONV REQUIRED)
else()
add_subdirectory(3rdparty/libiconv)
set(HAVE_ICONV_CONST 1)
endif()
if(LYX_EXTERNAL_Z)
find_package(ZLIB REQUIRED)
else()
add_subdirectory(3rdparty/zlib)
if(LYX_EXTERNAL_Z)
find_package(ZLIB REQUIRED)
else()
add_subdirectory(3rdparty/zlib)
endif()
endif()
if(LYX_USE_STD_REGEX)
@ -998,7 +1015,7 @@ if (CMAKE_GENERATOR MATCHES Xcode)
ENDIF(XCODE_VERSION VERSION_LESS "5.0")
ENDIF(CMAKE_GENERATOR MATCHES Xcode)
if (WIN32 AND Qt5Core_FOUND)
if (WIN32 AND NOT MINGW AND Qt5Core_FOUND)
set(Z_PREFIX 1)
endif()

View File

@ -270,22 +270,30 @@ if(LYX_USE_QT MATCHES "QT5")
else()
set(lyx_qt5_config "QtCore/qconfig.h")
endif()
check_cxx_source_runs(
"
#include <${lyx_qt5_config}>
#include <string>
using namespace std;
string a(QT_QPA_DEFAULT_PLATFORM_NAME);
int main(int argc, char **argv)
{
if (a.compare(\"xcb\") == 0)
return(0);
else
return 1;
}
"
QT_USES_X11)
set(QPA_XCB ${QT_USES_X11})
if(WIN32)
set(QT_USES_X11 CACHE "Win32 compiled without X11" 0)
# The try_run for minngw would not work here anyway
else()
check_cxx_source_runs(
"
#include <${lyx_qt5_config}>
#include <string>
using namespace std;
string a(QT_QPA_DEFAULT_PLATFORM_NAME);
int main(int argc, char **argv)
{
if (a.compare(\"xcb\") == 0)
return(0);
else
return 1;
}
"
QT_USES_X11)
endif()
if(QT_USES_X11)
set(QPA_XCB ${QT_USES_X11})
endif()
if (Qt5X11Extras_FOUND)
get_target_property(_x11extra_prop Qt5::X11Extras IMPORTED_CONFIGURATIONS)

View File

@ -44,25 +44,48 @@ elseif(WIN32)
set(runtime)
if(LYX_XMINGW)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE)
list(APPEND runtime /usr/${LYX_XMINGW}/lib/libwinpthread-1.dll)
else()
set(GCC_LIBGCC ${CMAKE_CXX_COMPILER})
endif()
get_filename_component(MINGW_RUNTIME_PATH ${GCC_LIBGCC} PATH)
# RKH
# get_filename_component(MINGW_RUNTIME_PATH ${GCC_LIBGCC} PATH)
set(MINGW_RUNTIME_PATH "/usr/i686-w64-mingw32/sys-root/mingw/bin")
macro(add_runtime_dll _DLL)
file(GLOB GCC_RUNTIME ${MINGW_RUNTIME_PATH}/${_DLL})
list(APPEND runtime ${GCC_RUNTIME})
endmacro()
add_runtime_dll(iconv.dll)
add_runtime_dll(libgcc*.dll)
add_runtime_dll(libstd*.dll)
add_runtime_dll(libwin*.dll)
add_runtime_dll(libbz2-1.dll)
add_runtime_dll(libfreetype-6.dll)
add_runtime_dll(libglib-2.0-0.dll)
add_runtime_dll(libgraphite2.dll)
add_runtime_dll(libharfbuzz-0.dll)
add_runtime_dll(libicudt6*.dll)
add_runtime_dll(libicuin6*.dll)
add_runtime_dll(libicuuc6*.dll)
add_runtime_dll(libintl-8.dll)
add_runtime_dll(libjpeg-62.dll)
add_runtime_dll(libpcre-1.dll)
add_runtime_dll(libpcre2-16-0.dll)
add_runtime_dll(libpng16-16.dll)
add_runtime_dll(libtiff-5.dll)
add_runtime_dll(libwebp-7.dll)
add_runtime_dll(libwebpdemux-2.dll)
add_runtime_dll(zlib1.dll)
if(NOT runtime)
message(FATAL_ERROR "No mingw runtime found in ${MINGW_RUNTIME_PATH}")
endif()
if(LYX_USE_QT MATCHES "QT5")
get_target_property(qmakebin Qt5::qmake IMPORTED_LOCATION)
get_filename_component(QT_BINARY_DIR ${qmakebin} PATH)
# RKH
# get_filename_component(QT_BINARY_DIR ${qmakebin} PATH)
set(QT_BINARY_DIR "/usr/i686-w64-mingw32/sys-root/mingw/bin")
install(FILES
${runtime}
${QT_BINARY_DIR}/Qt5Core.dll
@ -77,23 +100,32 @@ elseif(WIN32)
DESTINATION bin
CONFIGURATIONS Release)
install(FILES
${QT_BINARY_DIR}/../plugins/platforms/qminimal.dll
${QT_BINARY_DIR}/../plugins/platforms/qwindows.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/platforms/qminimal.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/platforms/qwindows.dll
DESTINATION bin/platforms
CONFIGURATIONS Release)
install(FILES
${QT_BINARY_DIR}/../plugins/printsupport/windowsprintersupport.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/printsupport/windowsprintersupport.dll
DESTINATION bin/printsupport
CONFIGURATIONS Release)
install(FILES
${QT_BINARY_DIR}/../plugins/imageformats/qgif.dll
${QT_BINARY_DIR}/../plugins/imageformats/qjpeg.dll
${QT_BINARY_DIR}/../plugins/imageformats/qsvg.dll
${QT_BINARY_DIR}/../plugins/imageformats/qico.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qgif.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qicns.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qico.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qjpeg.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qsvg.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qtga.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qtiff.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qwbmp.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qwebp.dll
DESTINATION bin/imageformats
CONFIGURATIONS Release)
install(FILES
${QT_BINARY_DIR}/../plugins/iconengines/qsvgicon.dll
${QT_BINARY_DIR}/../lib/qt5/plugins/styles/qwindowsvistastyle.dll
DESTINATION bin/styles
CONFIGURATIONS Release)
install(FILES
${QT_BINARY_DIR}/../lib/qt5/plugins/iconengines/qsvgicon.dll
DESTINATION bin/iconengines
CONFIGURATIONS Release)
else()

View File

@ -32,10 +32,17 @@ if (ICONV_INCLUDE_DIR)
set(ICONV_FIND_QUIETLY TRUE)
endif()
find_path(ICONV_INCLUDE_DIR iconv.h PATHS
/usr/include
/usr/local/include)
# RKH
if (WIN32 AND MINGW)
find_path(ICONV_INCLUDE_DIR iconv.h PATHS
/usr/i686-w64-mingw32/sys-root/mingw/include
)
else()
find_path(ICONV_INCLUDE_DIR iconv.h PATHS
/usr/include
/usr/local/include)
endif()
find_file(ICONV_HEADER iconv.h
PATHS ${ICONV_INCLUDE_DIR} NO_DEFAULT_PATH)

View File

@ -0,0 +1,33 @@
#!/bin/bash
CMAKE="mingw32-cmake";
MINGW="i686-w64-mingw32";
LYXSRC="";
DEVEL="";
function usage() {
echo "cmingw [-dD] /path/to/lyx-repo";
echo;
echo "Uses cmake to configures LyX for a mingw build.";
}
while getopts ":dDh" opt; do
case $opt in
d ) CMAKE="echo $CMAKE";;
h ) usage;
exit 0;;
D ) DEVEL="-DLYX_CONSOLE=FORCE _DLYX_DEBUG=ON";;
/? ) echo -e $USAGE;
exit 1;;
esac
done
$CMAKE $LYXSRC \
-DCMAKE_VERBOSE_MAKEFILE=1 \
-DLYX_CPACK=1 $DEVEL \
-DLYX_XMINGW=$MINGW \
-DLYX_USE_QT=QT5 \
-DLYX_QUIET=1 \
-DLYX_HUNSPELL=1 \
-DLYX_3RDPARTY_BUILD=1 \
-DLYX_MERGE_FILES=0

View File

@ -94,9 +94,14 @@ if (LYX_VLD)
lyx_add_info_files(VLD ${vld_files})
endif()
if(WIN32 AND NOT MINGW)
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
if(WIN32)
if (MINGW)
set(FILE_RC_COMPILED ${TOP_CMAKE_PATH}/lyx.coff)
message(STATUS "Using icon defined in resource file: ${FILE_RC_COMPILED}")
else()
set(FILE_RC ${TOP_CMAKE_PATH}/lyx.rc)
message(STATUS "Using icon defined in resource file: ${FILE_RC}")
endif()
endif()
lyx_find_info_files(LyXInfoFiles ${TOP_SRC_DIR}/*)
@ -133,6 +138,7 @@ target_link_libraries(${_lyx}
frontend_qt
graphics
support
${FILE_RC_COMPILED}
${MYTHESLIB_LIBRARY}
${ICONV_LIBRARY}
${LYX_QTMAIN_LIBRARY}