Am Mittwoch, 25. Juni 2014 um 11:28:17, schrieb Kornel Benko <kor...@lyx.org>
> Am Dienstag, 24. Juni 2014 um 18:49:46, schrieb Scott Kostyshak 
> <skost...@lyx.org>
> > On Tue, Jun 24, 2014 at 6:23 PM, Uwe Stöhr <uwesto...@web.de> wrote:
> > 
> > > So what I need is a way to compile LyX 2.1.x using either Qt 4.8.x or Qt 
> > > 5.3
> > > using MSVC 2013. Is this possible? and if yes, how?
> > 
> > Hi Uwe,
> > 
> > Sorry you're having trouble with this. 6 hours dealing with build
> > errors is not fun at all!
> > 
> > Are you able to build a previous version of LyX? For example, 2.1
> > release? I don't understand whether you're having trouble building
> > because of changes that have been made to the CMake code or changes to
> > your build environment from your mainboard crash.
> 
> I understood that he _is_ trying 2.1. 
> QT5 will be used there, if cmake finds it. So one has to deinstall QT5.
> 
> > Kornel and I have made significant changes to the CMake code and both
> > of us only have access to test on Linux (and worse, both only on
> > Ubuntu) so it's hard for us to test that it works on other platforms.
> > Thanks for your patience. However, to my knowledge we have not made
> > any significant changes to the 2.1.x branch. Do you mean master
> > branch?
> > 
> > On master branch, there is now a flag that controls whether CMake
> > compiles LyX with Qt 4 or Qt 5. Qt 4 is the default. To try with Qt 5,
> > set the flag -DLYX_USE_QT=QT5
> 
> I would discourage QT5 for now, we know QT4 was working on windows, it may 
> also work on 64-bit windows.
> 
> > Scott
> 

Uwe, please try this patch (on 2.1 branch).
The patch implements the use of LYX_USE_QT variable, so the default compilation 
should use
qt4 even if also qt5 devel files are installed.

        Kornel
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 023c3e1..f2b700c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,6 +74,11 @@ include(LyXMacros)
 # 3. parameter: default value, ON or OFF
 # 4. parameter: system on which option is used: ALL, GCC, MSVC, ...
 
+# Usage LYX_COMBO
+# 1. parameter: name without prefix 'LYX_'
+# 2. parameter: description
+# 3. parameter: default value
+# 4-n parameter: possible other string values
 
 LYX_OPTION_INIT()
 
@@ -119,7 +124,7 @@ LYX_OPTION(DEPENDENCIES_DOWNLOAD "Download dependencies for MSVC 10" OFF MSVC)
 # APPLE specific
 LYX_OPTION(DMG                   "Build as Mac bundle, needed for .dmg  (experimental) " OFF MAC)
 LYX_OPTION(COCOA                 "Use Cocoa on Mac" OFF MAC)
-
+LYX_COMBO(USE_QT                 "Use Qt version as frontend" QT4 QT5)
 
 if(help OR HELP)
 	message(STATUS)
@@ -477,9 +482,11 @@ if(LYX_CXX_FLAGS_EXTRA)
 	endforeach()
 endif()
 
-find_package(Qt5Core QUIET)
-if (Qt5Core_FOUND)
+if(LYX_USE_QT MATCHES "QT5")
+  find_package(Qt5Core REQUIRED)
+  if (Qt5Core_FOUND)
 	find_package(Qt5Widgets REQUIRED)
+        find_package(Qt5X11Extras)
 	set(QTVERSION ${Qt5Core_VERSION})
 	macro (qt_use_modules)
 		qt5_use_modules(${ARGN})
@@ -490,7 +497,8 @@ if (Qt5Core_FOUND)
 	macro (qt_wrap_uifiles)
 		qt5_wrap_ui(${ARGN})
 	endmacro()
-else()
+  endif()
+elseif(LYX_USE_QT MATCHES "QT4")
 	find_package(Qt4 "4.5.0" REQUIRED)
 	macro (qt_use_modules)
 	endmacro()
@@ -500,6 +508,8 @@ else()
 	macro (qt_wrap_uifiles)
 		qt4_wrap_ui(${ARGN})
 	endmacro()
+else()
+  message(FATAL_ERROR "Unhandled value for LYX_USE_QT (${LYX_USE_QT})")
 endif()
 
 find_package(Magic)
@@ -517,12 +527,12 @@ endif()
 if(LYX_ENCHANT)
 	find_package(Enchant REQUIRED)
 	include_directories(${ENCHANT_INCLUDE_DIR})
-endif()
+    endif()
 
 if(LYX_HUNSPELL)
 	find_package(Hunspell REQUIRED)
 	include_directories(${HUNSPELL_INCLUDE_DIR})
-endif()
+  endif()
 
 if(LYX_NLS)
 	FIND_PROGRAM(LYX_PYTHON_EXECUTABLE python2 python HINTS ${GNUWIN32_DIR}/python)
@@ -760,12 +770,12 @@ 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")
+			add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
 		add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
 	endif()
 	if(NOT(LYX_BUNDLE AND APPLE))
-		include(../Install)
-	endif()
+	include(../Install)
+endif()
 endif()
 
 add_subdirectory(sourcedoc "${TOP_BINARY_DIR}/sourcedoc")
@@ -775,7 +785,7 @@ if(LYX_ENABLE_URLTESTS)
 endif()
 
 message(STATUS)
-message(STATUS "Build options, switch LYX_* variables by -DLYX_*=ON or OFF:")
+message(STATUS "Build params, switch LYX_* options by -DLYX_*=ON or OFF, LYX_* combos by -DLYX_*=value:")
 message(STATUS)
 LYX_OPTION_LIST_ALL(used)
 
diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake
index 48e29d8..4ce1566 100644
--- a/development/cmake/modules/LyXMacros.cmake
+++ b/development/cmake/modules/LyXMacros.cmake
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2006-2011 Peter Kümmel, <syntheti...@gmx.net>
+#  Copyright (c) 2006-2011 Peter K�mmel, <syntheti...@gmx.net>
 #
 #  Redistribution and use in source and binary forms, with or without
 #  modification, are permitted provided that the following conditions
@@ -173,7 +173,7 @@ macro(lyx_const_touched_files _allinone_name _list)
 	else()
 		lyx_add_info_files(MergedFiles ${${_list}})
 	endif()
-	
+
 	set(${_file_list} ${_file_const} ${_file_touched} ${lyx_${groupname}_info_files})
 
 	foreach (_current_FILE ${${_list}})
@@ -232,6 +232,21 @@ macro(LYX_OPTION _name _description _default _sys)
 	set(LYX_${_name}_show_message ${_msg})
 endmacro()
 
+macro(LYX_COMBO _name _description _default)
+  set(_lyx_name "LYX_${_name}")
+  set(${_lyx_name} ${_default} CACHE STRING "${_description}")
+  set(_combo_list ${_default} ${ARGN})
+  set_property(CACHE ${_lyx_name} PROPERTY STRINGS ${_combo_list})
+  list(APPEND LYX_OPTIONS ${_lyx_name})
+  set(${_lyx_name}_show_message ON)
+  string(REGEX REPLACE ";" " " _use_list "${_combo_list}")
+  set(${_lyx_name}_description "${_description} (${_use_list})")
+  # Now check the value
+  list(FIND _combo_list ${${_lyx_name}} _idx)
+  if (_idx LESS 0)
+    message(FATAL_ERROR "${_lyx_name} set to \"${${_lyx_name}}\", but has to be only one of (${_use_list})")
+  endif()
+endmacro()
 
 macro(LYX_OPTION_LIST_ALL)
 	if(UNIX)
@@ -249,7 +264,10 @@ macro(LYX_OPTION_LIST_ALL)
 	foreach(_option ${LYX_OPTIONS})
 		if(${_option}_show_message OR ${ARGV0} STREQUAL "help")
 			string(SUBSTRING "${_option}                            " 0 25 _var)
-			if(${_option})
+                        get_property(_prop CACHE ${_option} PROPERTY STRINGS)
+                        if(_prop)
+                          set(_isset ${${_option}})
+			elseif(${_option})
 				set(_isset ON)
 			else()
 				set(_isset OFF)

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to