Commit 04752eca authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Require Qt5

parent 1b32a1e8
......@@ -13,8 +13,6 @@ SET(PROJECT_CONTACT "vlmc-devel@videolan.org")
SET(PROJECT_VENDOR "VLMC Team")
SET(ORG_WEBSITE "videolan.org")
option(FORCE_QT4 "Forces VLMC to build using Qt4" OFF)
# Configuring build type
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING
......@@ -121,70 +119,16 @@ INCLUDE_DIRECTORIES(${FREI0R_INCLUDE_DIR})
SET(CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
# search for Qt4
if (NOT FORCE_QT4)
find_package(Qt5Core QUIET)
if (Qt5Core_FOUND)
message(STATUS "Using qt5")
# go on with other packages
if(WITH_GUI)
find_package(Qt5 COMPONENTS Widgets Gui Xml Network)
else()
find_packages(Qt5 COMPONENTS Xml Network)
endif()
macro(qt_use_modules)
qt5_use_modules(${ARGN})
endmacro()
macro(qt_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
find_package(Qt5LinguistTools REQUIRED)
macro(qt_add_translation)
qt5_add_translation(${ARGN})
endmacro()
endif()
endif()
if(NOT Qt5Core_FOUND)
if (NOT FORCE_QT4)
message(STATUS "Could not find Qt5, searching for Qt4 instead...")
find_package(Qt5Core QUIET)
if (Qt5Core_FOUND)
# go on with other packages
if(WITH_GUI)
find_package(Qt5 COMPONENTS Widgets Gui Xml Network)
else()
find_packages(Qt5 COMPONENTS Xml Network)
endif()
set(NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork")
if( WITH_GUI )
list(APPEND NEEDED_QT4_COMPONENTS "QtGui")
endif()
find_package(Qt4 REQUIRED COMPONENTS ${NEEDED_QT4_COMPONENTS})
message(STATUS "Found Qt4 & ${NEEDED_QT4_COMPONENTS} modules")
macro(qt_use_modules)
endmacro()
macro(qt_wrap_ui)
qt4_wrap_ui(${ARGN})
endmacro()
macro(qt_add_resources)
qt4_add_resources(${ARGN})
endmacro()
macro(qt_add_translation)
qt4_add_translation(${ARGN})
endmacro()
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
# On linux & using Qt4 we need to manually add -lX11
if (UNIX AND NOT APPLE)
list(APPEND VLMC_LIBS -lX11)
endif()
find_package(Qt5LinguistTools REQUIRED)
endif()
# layout of VLMC installation
......
......@@ -96,9 +96,9 @@ CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake ${CMAKE_CURRENT_BINARY_D
IF (NOT WITH_GUI)
LIST (APPEND VLMC_SRCS Main/main.cpp Renderer/ConsoleRenderer.cpp )
QT_ADD_RESOURCES(VLMC_RCC_SRCS ${VLMC_RCC})
qt5_add_resources(VLMC_RCC_SRCS ${VLMC_RCC})
ADD_EXECUTABLE(vlmc ${GUI_TYPE} ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_RCC_SRCS})
qt_use_modules(vlmc Core Xml Network)
qt5_use_modules(vlmc Core Xml Network)
TARGET_LINK_LIBRARIES(vlmc ${VLMC_LIBS})
#Add GUI stuff if required
......@@ -215,8 +215,8 @@ ELSE(NOT WITH_GUI)
LIST( APPEND VLMC_UIS Gui/widgets/ui/CrashHandler.ui )
ENDIF(WITH_CRASHHANDLER_GUI)
QT_WRAP_UI(VLMC_UIS_H ${VLMC_UIS})
QT_ADD_RESOURCES(VLMC_RCC_SRCS ${VLMC_RCC})
qt5_wrap_ui(VLMC_UIS_H ${VLMC_UIS})
qt5_add_resources(VLMC_RCC_SRCS ${VLMC_RCC})
IF( MINGW )
# resource compilation for MinGW
......@@ -249,7 +249,7 @@ message(${FOUNDATION_FRAMEWORK})
ADD_EXECUTABLE( vlmc ${GUI_TYPE} ${VLMC_SRCS} ${VLMC_MOC_SRCS} ${VLMC_UIS_H} ${VLMC_RCC_SRCS} )
TARGET_LINK_LIBRARIES( vlmc ${VLMC_LIBS} )
if (NOT Qt4_FOUND)
qt_use_modules(vlmc Core Gui Widgets Xml Network)
qt5_use_modules(vlmc Core Gui Widgets Xml Network)
else()
# We need to know the target for this one, which is not the case when doing most of the QT4/5 specific stuff.
# We could hide this command in qt_use_modules macro, but this would be some kind of black magic uglyness
......@@ -272,10 +272,10 @@ ADD_CUSTOM_COMMAND(
ADD_DEFINITIONS( -W -Wall -Wextra )
if( !APPLE )
if( NOT APPLE )
# Ensure we can use some C++11 features
target_compile_features(vlmc PUBLIC cxx_nullptr cxx_range_for)
ENDIF( !APPLE )
endif()
IF(UNIX)
IF (WITH_PROFILING)
......
......@@ -96,7 +96,7 @@ ENDFOREACH()
IF(QT_LRELEASE_EXECUTABLE)
## Wraps the collected translations
QT4_ADD_TRANSLATIONS(vlmc_QMS ${vlmc_TS})
qt5_add_translation(vlmc_QMS ${vlmc_TS})
## Create a target that runs lrelease for all the .ts files
## "ALL" means that it will be run by default.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment