WSL/SLF GitLab Repository

Commit 783f157e authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The CMakeLists.txt now (almost) supports both qt5 and qt6 (for qt6,...

The CMakeLists.txt now (almost) supports both qt5 and qt6 (for qt6, qt5_add_translation must be replaced by the proper one). The compilation instructions were not up to date, they have been updated.
parent b97a8b7a
......@@ -24,9 +24,11 @@ IF(CMAKE_VERSION VERSION_LESS "3.7.0")
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
ENDIF()
FIND_PACKAGE(Qt5 COMPONENTS Widgets Xml XmlPatterns REQUIRED)
SET(QT5_LIBRARIES Qt5::Widgets Qt5::Xml Qt5::XmlPatterns)
MARK_AS_ADVANCED(FORCE Qt5Core_DIR Qt5Gui_DIR Qt5Network_DIR Qt5Widgets_DIR Qt5XmlPatterns_DIR Qt5Xml_DIR Qt5_DIR)
#in order to support both Qt5 and QT6 (knowing that we require XmlPatterns and this module is already deprecated since qt5.13 and gone in qt6)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Xml XmlPatterns REQUIRED)
SET(QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Xml Qt${QT_VERSION_MAJOR}::XmlPatterns)
MARK_AS_ADVANCED(FORCE Qt${QT_VERSION_MAJOR}Core_DIR Qt${QT_VERSION_MAJOR}Gui_DIR Qt${QT_VERSION_MAJOR}Network_DIR Qt${QT_VERSION_MAJOR}Widgets_DIR Qt${QT_VERSION_MAJOR}XmlPatterns_DIR Qt${QT_VERSION_MAJOR}Xml_DIR Qt${QT_VERSION_MAJOR}_DIR)
#finally, SET compile flags
SET(CMAKE_CXX_FLAGS "${ARCH} ${EXTRA}" CACHE STRING "" FORCE)
......@@ -62,8 +64,8 @@ ENDIF(APPLE)
# Generate the .qm translation files and potentially the .ts files
SET(SUPPORT_TRANSLATIONS OFF CACHE BOOL "Support translating the user interface? (this may require the qttools5-dev package)")
IF(SUPPORT_TRANSLATIONS)
FIND_PACKAGE(Qt5LinguistTools REQUIRED)
MARK_AS_ADVANCED(FORCE Qt5LinguistTools_DIR)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR}LinguistTools REQUIRED)
MARK_AS_ADVANCED(FORCE Qt${QT_VERSION_MAJOR}LinguistTools_DIR)
FILE(GLOB TS_FILES ${PROJECT_SOURCE_DIR}/resources/langs/*.ts)
SET_SOURCE_FILES_PROPERTIES(${TS_FILES} PROPERTIES OUTPUT_LOCATION "resources/l10n")
qt5_add_translation(QM_FILES ${TS_FILES})
......@@ -81,7 +83,7 @@ ENDIF(SUPPORT_TRANSLATIONS)
ADD_EXECUTABLE(${TARGET} ${TARGET_TYPE} ${EXTRA_LIBS_SRC} ${SOURCES} ${RESOURCES} ${QM_FILES} ${TRANSLATION_RESOURCES})
INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/")
TARGET_LINK_LIBRARIES(${TARGET} ${QT5_LIBRARIES})
TARGET_LINK_LIBRARIES(${TARGET} ${QT_LIBRARIES})
SET_TARGET_PROPERTIES(${TARGET} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/bin"
CLEAN_DIRECT_OUTPUT 1
......@@ -90,7 +92,7 @@ INSTALL(TARGETS ${TARGET} RUNTIME DESTINATION bin ${INSTALL_OSX} COMPONENT exe)
# Retrieve the absolute path to qmake and then use that path to find
# the binaries
GET_TARGET_PROPERTY(_qmake_executable Qt5::qmake IMPORTED_LOCATION)
GET_TARGET_PROPERTY(_qmake_executable Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
GET_FILENAME_COMPONENT(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
IF(WIN32)
......
......@@ -23,7 +23,7 @@ You can find precompiled packages for your plateform currently at https://models
Compilation from source
--------------------
You will need a C++ compiler (such as g++ on GNU/Linux), and the Qt compiler (translating code written for the Qt toolkit to pure C++).
You will need a C++ compiler (such as g++ on GNU/Linux), cmake, and the Qt compiler (translating code written for the Qt toolkit to pure C++).
On GNU/Linux, you can install relatively small toolkits to compile Inishell through the command line:
```bash
......@@ -35,7 +35,7 @@ sudo apt install libqt5xmlpatterns5-dev
```bash
cd inishell
qmake
ccmake .
make
```
......
Supports Markdown
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