Skip to content

Commit

Permalink
Merge branch '5-migration-der-quellen-auf-qt5' into 'main'
Browse files Browse the repository at this point in the history
Resolve "Migration der Quellen auf QT5"

Closes fmuecke#5

See merge request r_bernhard/Ipponboard!18
  • Loading branch information
r-bernhard committed Feb 25, 2024
2 parents 1766c4a + 373074e commit 5d4acb2
Show file tree
Hide file tree
Showing 35 changed files with 501 additions and 480 deletions.
2 changes: 1 addition & 1 deletion Widgets/ScaledImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef WIDGETS__SCALEDIMAGE_H_
#define WIDGETS__SCALEDIMAGE_H_

#include <QtGui/QWidget>
#include <QWidget>
#include <QImage>
#include <QResizeEvent>

Expand Down
10 changes: 7 additions & 3 deletions _build/_cmake_qt4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.6)

project(Ipponboard VERSION 2.0.0 LANGUAGES C CXX)
project(Ipponboard VERSION 2.1.0 LANGUAGES C CXX)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -82,6 +82,9 @@ endif()

include_directories(${BASE_DIR}/Widgets ${BOOST_DIR} ${XMLQUERY} )

#add_compile_options(-D__QT4__ -D__WITH_X11__ -Wall -Weffc++ -pedantic)
add_compile_options(-D__QT4__ -D__WITH_X11__)

#####################################################
# Target Ipponboard: create a binary
#####################################################
Expand Down Expand Up @@ -131,6 +134,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set_target_properties(Ipponboard_Debug PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BASE_DIR}/_build/bin"
OUTPUT_NAME Ipponboard
COMPILE_FLAGS -D_WITH_GAMEPAD_
#LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup"
#CMAKE_SUPPRESS_REGENERATION true
)
Expand Down Expand Up @@ -170,5 +174,5 @@ endif()
#)

# compile Testsuites
add_subdirectory(${BASE_DIR}/test/cmake_qt4 ${BASE_DIR}/_build/_build_cmake_qt4/test)
#add_subdirectory(${BASE_DIR}/GamepadDemo/cmake_qt4 ${BASE_DIR}/_build/_build_cmake_qt4/GamepadDemo)
add_subdirectory(${BASE_DIR}/test/_cmake_qt4 ${BASE_DIR}/_build/_build_cmake_qt4/test)
#add_subdirectory(${BASE_DIR}/GamepadDemo/_cmake_qt4 ${BASE_DIR}/_build/_build_cmake_qt4/GamepadDemo)
242 changes: 180 additions & 62 deletions _build/_cmake_qt5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,70 +1,188 @@
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 3.6)

project(Ipponboard VERSION 1.0 LANGUAGES C CXX)
message(STATUS "using: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
project(Ipponboard VERSION 2.2.0 LANGUAGES C CXX)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTOUIC ON)

find_package(Qt5 5.15.2 REQUIRED Core Gui XmlPatterns)
set (CMAKE_PREFIX_PATH $ENV{QTDIR})
set(CMAKE_LIBRARY_PATH $ENV{QTDIR}/lib )

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_PREFIX_PATH "$ENV{QTDIR}")
message(STATUS "Using CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}, CMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}")

set (BOOST_DIR D:\\dev\\inst\\boost_1_82_0)
set (XMLQUERY C:\\devtools\\qt\\qt-4.8.7-x86-vs2017\\include\\QtXmlPatterns)
find_package(Qt5 5.15.2 COMPONENTS Widgets XmlPatterns PrintSupport Multimedia REQUIRED)

set (BASE_DIR ../..)

#####################################################
# compile Ipponboard
#####################################################
set( SOURCES
../core/Controller.cpp ../core/Controller.h
../core/ControllerConfig.h
../core/Enums.h
../core/Fight.cpp ../core/Fight.h
../core/FightCategory.cpp ../core/FightCategory.h
../core/Fighter.cpp ../core/Fighter.h
../core/Rules.cpp ../core/Rules.h
../core/Score.cpp ../core/Score.h
../core/StateMachine.cpp ../core/StateMachine.h
../core/Tournament.h
../core/TournamentMode.cpp ../core/TournamentMode.h
../core/TournamentModel.cpp ../core/TournamentModel.h
../core/iController.h
../core/iControllerCore.h
../core/iGoldenScoreView.h
../core/iView.h
../util/SimpleCsvFile.hpp
../util/array_helpers.h
../util/json.hpp
../util/jsoncpp/json.cpp
../util/path_helpers.h
../widgets/Countdown.cpp ../widgets/Countdown.h ../widgets/Countdown.ui
../widgets/ScaledImage.cpp ../widgets/ScaledImage.h
../widgets/ScaledText.cpp ../widgets/ScaledText.h
../base/AddFighterDlg.cpp ../base/AddFighterDlg.h ../base/AddFighterDlg.ui
../base/ClubManager.cpp ../base/ClubManager.h
../base/ClubManagerDlg.cpp ../base/ClubManagerDlg.h ../base/ClubManagerDlg.ui
../base/ClubParser.h
../base/DonationManager.cpp ../base/DonationManager.h
../base/FightCategoryManager.cpp ../base/FightCategoryManager.h
../base/FightCategoryManagerDlg.cpp ../base/FightCategoryManagerDlg.h ../base/FightCategoryManagerDlg.ui
../base/FightCategoryParser.cpp ../base/FightCategoryParser.h
../base/FighterManager.cpp ../base/FighterManager.h
../base/FighterManagerDlg.cpp ../base/FighterManagerDlg.h ../base/FighterManagerDlg.ui
../base/Main.cpp
../base/MainWindow.cpp ../base/MainWindow.h ../base/MainWindow.ui
../base/MainWindowBase.cpp ../base/MainWindowBase.h
../base/MainWindowTeam.cpp ../base/MainWindowTeam.h ../base/MainWindowTeam.ui
../base/ModeManagerDlg.cpp ../base/ModeManagerDlg.h ../base/ModeManagerDlg.ui
../base/ScoreScreen.cpp ../base/ScoreScreen.h ../base/ScoreScreen.ui
../base/SettingsDlg.cpp ../base/SettingsDlg.h ../base/SettingsDlg.ui
../base/SplashScreen.cpp ../base/SplashScreen.h ../base/SplashScreen.ui
../base/UpdateChecker.cpp ../base/UpdateChecker.h
../base/VersionComparer.cpp ../base/VersionComparer.h
../base/View.cpp ../base/View.h
../base/pch.h
../base/view_horizontal.ui
../base/view_vertical_single.ui
${BASE_DIR}/core/Controller.cpp ${BASE_DIR}/core/Controller.h
${BASE_DIR}/core/ControllerConfig.h
${BASE_DIR}/core/Enums.h
${BASE_DIR}/core/Fight.cpp ${BASE_DIR}/core/Fight.h
${BASE_DIR}/core/FightCategory.cpp ${BASE_DIR}/core/FightCategory.h
${BASE_DIR}/core/Fighter.cpp ${BASE_DIR}/core/Fighter.h
${BASE_DIR}/core/Rules.cpp ${BASE_DIR}/core/Rules.h
${BASE_DIR}/core/Score.cpp ${BASE_DIR}/core/Score.h
${BASE_DIR}/core/StateMachine.cpp ${BASE_DIR}/core/StateMachine.h
${BASE_DIR}/core/Tournament.h
${BASE_DIR}/core/TournamentMode.cpp ${BASE_DIR}/core/TournamentMode.h
${BASE_DIR}/core/TournamentModel.cpp ${BASE_DIR}/core/TournamentModel.h
${BASE_DIR}/core/iController.h
${BASE_DIR}/core/iControllerCore.h
${BASE_DIR}/core/iGoldenScoreView.h
${BASE_DIR}/core/iView.h
${BASE_DIR}/util/SimpleCsvFile.hpp
${BASE_DIR}/util/array_helpers.h
${BASE_DIR}/util/json.hpp
${BASE_DIR}/util/jsoncpp/json.cpp
${BASE_DIR}/util/path_helpers.h
${BASE_DIR}/util/screen_helpers.h
${BASE_DIR}/Widgets/Countdown.cpp ${BASE_DIR}/Widgets/Countdown.h ${BASE_DIR}/Widgets/Countdown.ui
${BASE_DIR}/Widgets/ScaledImage.cpp ${BASE_DIR}/Widgets/ScaledImage.h
${BASE_DIR}/Widgets/ScaledText.cpp ${BASE_DIR}/Widgets/ScaledText.h
${BASE_DIR}/base/AddFighterDlg.cpp ${BASE_DIR}/base/AddFighterDlg.h ${BASE_DIR}/base/AddFighterDlg.ui
${BASE_DIR}/base/ClubManager.cpp ${BASE_DIR}/base/ClubManager.h
${BASE_DIR}/base/ClubManagerDlg.cpp ${BASE_DIR}/base/ClubManagerDlg.h ${BASE_DIR}/base/ClubManagerDlg.ui
${BASE_DIR}/base/ClubParser.h
${BASE_DIR}/base/DonationManager.cpp ${BASE_DIR}/base/DonationManager.h
${BASE_DIR}/base/FightCategoryManager.cpp ${BASE_DIR}/base/FightCategoryManager.h
${BASE_DIR}/base/FightCategoryManagerDlg.cpp ${BASE_DIR}/base/FightCategoryManagerDlg.h ${BASE_DIR}/base/FightCategoryManagerDlg.ui
${BASE_DIR}/base/FightCategoryParser.cpp ${BASE_DIR}/base/FightCategoryParser.h
${BASE_DIR}/base/FighterManager.cpp ${BASE_DIR}/base/FighterManager.h
${BASE_DIR}/base/FighterManagerDlg.cpp ${BASE_DIR}/base/FighterManagerDlg.h ${BASE_DIR}/base/FighterManagerDlg.ui
${BASE_DIR}/base/Main.cpp
${BASE_DIR}/base/MainWindow.cpp ${BASE_DIR}/base/MainWindow.h ${BASE_DIR}/base/MainWindow.ui
${BASE_DIR}/base/MainWindowBase.cpp ${BASE_DIR}/base/MainWindowBase.h
${BASE_DIR}/base/MainWindowTeam.cpp ${BASE_DIR}/base/MainWindowTeam.h ${BASE_DIR}/base/MainWindowTeam.ui
${BASE_DIR}/base/ModeManagerDlg.cpp ${BASE_DIR}/base/ModeManagerDlg.h ${BASE_DIR}/base/ModeManagerDlg.ui
${BASE_DIR}/base/ScoreScreen.cpp ${BASE_DIR}/base/ScoreScreen.h ${BASE_DIR}/base/ScoreScreen.ui
${BASE_DIR}/base/SettingsDlg.cpp ${BASE_DIR}/base/SettingsDlg.h ${BASE_DIR}/base/SettingsDlg.ui
${BASE_DIR}/base/SplashScreen.cpp ${BASE_DIR}/base/SplashScreen.h ${BASE_DIR}/base/SplashScreen.ui
${BASE_DIR}/base/UpdateChecker.cpp ${BASE_DIR}/base/UpdateChecker.h
${BASE_DIR}/base/VersionComparer.cpp ${BASE_DIR}/base/VersionComparer.h
${BASE_DIR}/base/View.cpp ${BASE_DIR}/base/View.h
${BASE_DIR}/base/pch.h
${BASE_DIR}/base/view_horizontal.ui
${BASE_DIR}/base/view_vertical_single.ui
${BASE_DIR}/base/qrc_ipponboard.cpp
)

#set(CMAKE_INCLUDE_CURRENT_DIR ON)
include_directories(base ${BOOST_DIR} ${XMLQUERY} )
add_executable(Ipponboard ${SOURCES} )
target_link_libraries(Ipponboard Qt5::Core Qt5::Gui Qt5::XmlPatterns)
if(WIN32)
message(STATUS "using: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
set(BOOST_DIR C:/dev/inst/boost_1_82_0)
else()
set(BOOST_DIR /usr/include/boost)
endif()

# common include directories
include_directories(${BASE_DIR}/Widgets )
include_directories(${Qt5Widgets_INCLUDE_DIRS})
include_directories(${Qt5PrintSupport_INCLUDE_DIRS})
include_directories(${Qt5XmlPatterns_INCLUDE_DIRS})
include_directories(${Qt5Multimedia_INCLUDE_DIRS})


#add_compile_options(-fPIC -fpermissive -Wall -Weffc++ -pedantic)
add_compile_options(-fPIC -fpermissive)

#####################################################
# Target Ipponboard: create a binary
#####################################################
if (CMAKE_BUILD_TYPE STREQUAL "Release")
if (WIN32)
add_executable(Ipponboard ${SOURCES} ${BASE_DIR}/gamepad/gamepad.h ${BASE_DIR}/base/Ipponboard.rc)
set_target_properties(Ipponboard PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BASE_DIR}/_build/bin"
LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup"
CMAKE_SUPPRESS_REGENERATION true
COMPILE_FLAGS -D_WITH_GAMEPAD_
)

add_custom_command(TARGET Ipponboard POST_BUILD
COMMAND call "${BASE_DIR}/base/_copy_files.cmd" -release
)

#####################################################
# Target setup
#####################################################
add_custom_target(setup
COMMAND call "../win/_build_doc.cmd" ${BASE_DIR}
COMMAND cmd /c "%INNO_DIR%/iscc.exe" /Q /O${BASE_DIR}/_build/bin ${BASE_DIR}/setup/setup.iss
)

target_include_directories(Ipponboard PRIVATE ${BOOST_DIR})
target_link_libraries(Ipponboard PRIVATE Qt5::Widgets Qt5::XmlPatterns Qt5::PrintSupport Qt5::Multimedia)
else()
#if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.1.0)
# message(FATAL_ERROR "Require at least gcc-11.1.0, because c++-17 is needed")
#endif()

add_executable(Ipponboard ${SOURCES} ${BASE_DIR}/base/Ipponboard.rc)
set_target_properties(Ipponboard PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BASE_DIR}/_build/bin/Release"
)

target_include_directories(Ipponboard PRIVATE ${BOOST_DIR})
target_link_libraries(Ipponboard PRIVATE Qt5::Widgets Qt5::XmlPatterns Qt5::PrintSupport Qt5::Multimedia)
endif()
endif()

#####################################################
# Target Ipponboard_Debug: create a debug binary
#####################################################
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (WIN32)
add_executable(Ipponboard_Debug ${SOURCES} ${BASE_DIR}/gamepad/gamepad.h ${BASE_DIR}/base/Ipponboard.rc)
set_target_properties(Ipponboard_Debug PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BASE_DIR}/_build/bin"
OUTPUT_NAME Ipponboard
COMPILE_FLAGS -D_WITH_GAMEPAD_
#LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup"
#CMAKE_SUPPRESS_REGENERATION true
)

add_custom_command(TARGET Ipponboard_Debug POST_BUILD
# the following environment variable is needed, if using VStudio GUI (solution)
COMMAND set QTDIR="c:\\dev\\inst\\qt\\qt-5.15.2-x64-msvc2017"
COMMAND call "${BASE_DIR}/base/_copy_files.cmd" -debug
)

target_include_directories(Ipponboard_Debug PRIVATE ${BOOST_DIR})
target_link_libraries(Ipponboard_Debug PRIVATE Qt5::Widgets Qt5::XmlPatterns Qt5::PrintSupport Qt5::Multimedia)
else()
#if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11.1.0)
# message(FATAL_ERROR "Require at least gcc-11.1.0, because c++-17 is needed")
#endif()

add_executable(Ipponboard_Debug ${SOURCES} ${BASE_DIR}/base/Ipponboard.rc)
#target_compile_options(Ipponboard_Debug PRIVATE -fPIC -fpermissive)
set_target_properties(Ipponboard_Debug PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${BASE_DIR}/_build/bin/Debug"
OUTPUT_NAME Ipponboard
)

target_include_directories(Ipponboard_Debug PRIVATE ${BOOST_DIR})
target_link_libraries(Ipponboard_Debug PRIVATE Qt5::Widgets Qt5::XmlPatterns Qt5::PrintSupport Qt5::Multimedia)
endif()
endif()

# create the qt resource file
#add_custom_command(TARGET ${PROJECT_NAME} PRE_BUILD
# COMMAND rcc -name ipponboard "%BASE_DIR%/base/ipponboard.qrc" -o "%BASE_DIR%/base/qrc_ipponboard.cpp"
#)

#####################################################
# Target run ALL
#####################################################
#add_custom_target(run ALL
# COMMAND rcc -name ipponboard "%BASE_DIR%/base/ipponboard.qrc" -o "%BASE_DIR%/base/qrc_ipponboard.cpp"
#)

# compile Testsuites
add_subdirectory(${BASE_DIR}/test/_cmake_qt5 ${BASE_DIR}/_build/_build_cmake_qt5/test)
#add_subdirectory(${BASE_DIR}/GamepadDemo/_cmake_qt5 ${BASE_DIR}/_build/_build_cmake_qt5/GamepadDemo)
6 changes: 0 additions & 6 deletions _build/linux/_copy_files
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ echo sounds
mkdir -p $DEST/sounds
cp $ROOT/base/sounds/*.wav $DEST/sounds || exit 1

echo QT and C++ runtimes
cp $QTDIR/lib/libQtCore.so.4 $DEST|| exit 1
cp $QTDIR/lib/libQtGui.so.4 $DEST|| exit 1
cp $QTDIR/lib/libQtNetwork.so.4 $DEST|| exit 1
cp $QTDIR/lib/libQtXmlPatterns.so.4 $DEST|| exit 1

echo Categories and modes
cp $ROOT/base/categories.json $DEST|| exit 1
cp $ROOT/base/TournamentModes.ini $DEST|| exit 1
Expand Down
12 changes: 12 additions & 0 deletions _build/linux/_copy_files_qt4
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function deploy_qt_local {
echo QT and C++ runtimes
cp $QTDIR/lib/libQtCore.so.4 $DEST|| exit 1
cp $QTDIR/lib/libQtGui.so.4 $DEST|| exit 1
cp $QTDIR/lib/libQtNetwork.so.4 $DEST|| exit 1
cp $QTDIR/lib/libQtXmlPatterns.so.4 $DEST|| exit 1
}

############################
function deploy_without_qt {
echo
}
50 changes: 50 additions & 0 deletions _build/linux/_copy_files_qt5
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
##########################
function deploy_qt_local {
# qt.conf
echo deploy qt.conf
QT_CONF=$DEST/qt.conf

echo [Paths]>$QT_CONF
echo \# local deployment>>$QT_CONF
echo Prefix=./qt5>>$QT_CONF

# start script
echo deploy start script
IPPONBOARD_STARTER=$DEST/startIpponboard.sh
echo \#/bin/bash>$IPPONBOARD_STARTER
echo LD_LIBRARY_PATH=./qt5 ./Ipponboard>>$IPPONBOARD_STARTER
chmod 755 $IPPONBOARD_STARTER

# qt5 libraries and plugins
echo deploying QT5 libraries and plugins, please wait...
mkdir -p $DEST/qt5
cp $QTDIR/lib/libQt5Widgets.so.5 $DEST/qt5|| exit 1
cp $QTDIR/lib/libQt5XmlPatterns.so.5 $DEST/qt5|| exit 1
cp $QTDIR/lib/libQt5PrintSupport.so.5 $DEST/qt5|| exit 1
cp $QTDIR/lib/libQt5Multimedia.so.5 $DEST/qt5|| exit 1
cp $QTDIR/lib/libQt5Gui.so.5 $DEST/qt5|| exit 1
cp $QTDIR/lib/libQt5Core.so.5 $DEST/qt5|| exit 1
cp $QTDIR/lib/libQt5Network.so.5 $DEST/qt5|| exit 1
cp -r $QTDIR/plugins/platforms $DEST
}

############################
function deploy_without_qt {
# qt.conf
echo deploy qt.conf
QT_CONF=$DEST/qt.conf

echo [Paths]>$QT_CONF
if [ $DIST == "deb" ]; then
echo \# Debian based deployment. Please execute \"sudo apt install libqt5xmlpatterns5 libqt5multimedia5 libqt5printsupport5 libxcb1\">>$QT_CONF
elif [ $DIST == "rh" ]; then
echo \# Redhat based deployment. Please execute \"sudo yum install qt5-qtxmlpatterns qt5-qtmultimedia xcb-util\">>$QT_CONF
fi
echo Prefix=$QT_OS_DIR>>$QT_CONF

# start script
IPPONBOARD_STARTER=$DEST/startIpponboard.sh
echo \#/bin/bash>$IPPONBOARD_STARTER
echo LD_LIBRARY_PATH=$QT_OS_DIR QT_QPA_PLATFORM_PLUGIN_PATH=$QT_OS_DIR/qt5/plugins/platforms ./Ipponboard>>$IPPONBOARD_STARTER
chmod 755 $IPPONBOARD_STARTER
}
4 changes: 2 additions & 2 deletions _build/linux/_create_versioninfo.linux
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ pushd "$_base_dir"

# --> CHANGE VERSION HERE:
VER1=2
VER2=1
VER2=2
VER3=0
TAG=Win_Linux
TAG=pre
# that's it. <--

git log -1 --format=%h > .revision
Expand Down
Loading

0 comments on commit 5d4acb2

Please sign in to comment.