Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a156b2e
QT5 support added
DmiitriyJarosh Feb 24, 2019
ba7f702
swap travis to qt5
DmiitriyJarosh Feb 25, 2019
a2816d9
qt5 openGL added to travis
DmiitriyJarosh Feb 25, 2019
7e9d7bb
Update .travis.yml
DmiitriyJarosh Feb 25, 2019
16b9675
Update CMakeLists.txt
DmiitriyJarosh Feb 25, 2019
59791ee
Update CMakeLists.txt
DmiitriyJarosh Feb 25, 2019
708e4b6
Update .travis.yml
DmiitriyJarosh Feb 26, 2019
a6de638
added qt4 for mac vartypes to travis
DmiitriyJarosh Feb 26, 2019
eb85985
Create appveyor.yml
DmiitriyJarosh Feb 27, 2019
3b5901f
Update appveyor.yml
DmiitriyJarosh Feb 27, 2019
6dd7cfd
swap git to hg for ode
DmiitriyJarosh Feb 27, 2019
6251277
Update appveyor.yml
DmiitriyJarosh Mar 1, 2019
843afe4
Update appveyor.yml
DmiitriyJarosh Mar 1, 2019
0d9c1f5
Update appveyor.yml
DmiitriyJarosh Mar 1, 2019
ad4fd2d
Update appveyor.yml
DmiitriyJarosh Mar 1, 2019
3a3cb46
Update appveyor.yml
DmiitriyJarosh Mar 1, 2019
37f87e9
Update appveyor.yml
DmiitriyJarosh Mar 21, 2019
d32cde5
Update appveyor.yml
DmiitriyJarosh Mar 21, 2019
f2bdebb
Update appveyor.yml
DmiitriyJarosh Mar 21, 2019
8039512
critical bug fix
DmiitriyJarosh Mar 23, 2019
025c31a
dll copy script added
DmiitriyJarosh Mar 24, 2019
b2e4a71
dll copy choice of platform added
DmiitriyJarosh Mar 27, 2019
eda56d7
Update .travis.yml
DmiitriyJarosh Apr 9, 2019
27a0f6e
Update CMakeLists.txt
DmiitriyJarosh Apr 9, 2019
8358ab5
Update glwidget.h
DmiitriyJarosh Apr 9, 2019
109d66f
Update appveyor.yml
DmiitriyJarosh May 4, 2019
70230a5
Update appveyor.yml
DmiitriyJarosh May 4, 2019
29990e2
Update appveyor.yml
DmiitriyJarosh May 4, 2019
74790e1
Update appveyor.yml
DmiitriyJarosh May 4, 2019
587a5d4
Update appveyor.yml
DmiitriyJarosh May 4, 2019
0928b24
Update appveyor.yml
DmiitriyJarosh May 4, 2019
076e748
Update appveyor.yml
DmiitriyJarosh May 4, 2019
1a1b6b1
Update appveyor.yml
DmiitriyJarosh May 4, 2019
15a683b
Update appveyor.yml
DmiitriyJarosh May 4, 2019
8d898e5
Update appveyor.yml
DmiitriyJarosh May 4, 2019
bf9d64b
Update appveyor.yml
DmiitriyJarosh May 4, 2019
da902d8
Update appveyor.yml
DmiitriyJarosh May 4, 2019
9ee2221
Update appveyor.yml
DmiitriyJarosh May 4, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ bin*/*
*.swp
Thumbs.db
.idea/*
cmake-*
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Какие конкретно файлы перекрывает эта маска?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake-build-debug
cmake-build-release -- dirs which CLion creates with his cmake. Do you think it will be better to specify only them?

8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ matrix:
dist: trusty
sudo: required
- os: osx
osx_image: xcode8
osx_image: xcode10
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что не так с предыдущей версией было? Каких библиотек не хватало?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qt5 wasn't supported, was it?


addons:
apt:
packages:
- cmake
- libqt4-dev
- qt5-default
- libqt5opengl5-dev
- libgl1-mesa-dev
- libglu1-mesa-dev
- libprotobuf-dev
Expand All @@ -31,6 +32,7 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew tap cartr/qt4 ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew tap-pin cartr/qt4 ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt@4 ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt5 ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew uninstall --ignore-dependencies python ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install protobuf ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew tap robotology/formulae ; fi
Expand All @@ -52,4 +54,4 @@ script:
- mkdir build && cd build
- cmake ..
- make
- sudo make install
- sudo make install
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Таких изменений быть не должно.

100 changes: 95 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
cmake_minimum_required(VERSION 2.8)

set(USE_QT5 1)
if(USE_QT5)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) # remove if CMake >= 2.8.11 required
endif()
if(POLICY CMP0043) # compatibility with CMake 3.0.1
cmake_policy(SET CMP0043 OLD)
endif()
if(POLICY CMP0071) # compatibility with CMake 3.10.0
cmake_policy(SET CMP0071 OLD)
endif()
endif()

## Project branding, version and package mantainer
project(grSim)
Expand Down Expand Up @@ -55,10 +67,31 @@ list(APPEND libs ${OPENGL_LIBRARIES})
#include_directories(${GLUT_INCLUDE_DIR})

# Qt
set(QT_USE_QTNETWORK true)
set(QT_USE_QTOPENGL true)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
if (USE_QT5)
add_definitions(-D QT5)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Network REQUIRED)
set(QT_LIBRARIES "")
macro(qt4_wrap_cpp VARNAME)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем это? Не очень понимаю :( и ниже который.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to add support for both versions with less changes

set(${VARNAME} "")
endmacro()
# wrap functions
macro(qt4_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt4_add_resources)
qt5_add_resources(${ARGN})
endmacro()
else()
set(QT_USE_QTNETWORK true)
set(QT_USE_QTOPENGL true)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
endif()
list(APPEND libs ${QT_LIBRARIES})

# ODE
Expand Down Expand Up @@ -191,7 +224,11 @@ if(APPLE)
elseif(WIN32)
set(app ${CMAKE_PROJECT_NAME})
add_executable(${app} WIN32 ${srcs})
target_link_libraries(${app} ${libs})
if(USE_QT5)
target_link_libraries(${app} ${libs} Qt5::Core Qt5::Widgets Qt5::Network Qt5::OpenGL)
else()
target_link_libraries(${app} ${libs})
endif()
install(TARGETS ${app} DESTINATION bin)
install(DIRECTORY config DESTINATION .)
install(DIRECTORY bin DESTINATION .
Expand All @@ -200,6 +237,9 @@ elseif(WIN32)
else()
set(app ${CMAKE_PROJECT_NAME_LOWER})
add_executable(${app} ${srcs})
if(USE_QT5)
qt5_use_modules(${app} Widgets Network Core OpenGL)
endif()
target_link_libraries(${app} ${libs})
install(TARGETS ${app} DESTINATION bin)
install(DIRECTORY config DESTINATION share/${app})
Expand Down Expand Up @@ -246,4 +286,54 @@ else()
endif()
include(CPack)

set(COPY_ENABLE_FLAG 0)
set(CXX_BIT 64)
if(WIN32)
string(REPLACE "/g++.exe" "" RES ${CMAKE_CXX_COMPILER})

if(COPY_ENABLE_FLAG)
set(DLL_LIB_LIST ${RES}/zlib1.dll
${RES}/libbz2-1.dll
${RES}/libfreetype-6.dll
${RES}/libglib-2.0-0.dll
${RES}/libgraphite2.dll
${RES}/libharfbuzz-0.dll
${RES}/libiconv-2.dll
${RES}/libicudt61.dll
${RES}/libicuin61.dll
${RES}/libicuuc61.dll
${RES}/libintl-8.dll
${RES}/libpcre-1.dll
${RES}/libpcre2-16-0.dll
${RES}/libpng16-16.dll
${RES}/libprotobuf.dll
${RES}/libstdc++-6.dll
${VARTYPES_LIBRARIES}
${RES}/libwinpthread-1.dll)
set(QT5_DEBUG_DLL ${RES}/Qt5Cored.dll
${RES}/Qt5Guid.dll
${RES}/Qt5Networkd.dll
${RES}/Qt5OpenGLd.dll
${RES}/Qt5Widgetsd.dll)
set(QT5_RELEASE_DLL ${RES}/Qt5Core.dll
${RES}/Qt5Gui.dll
${RES}/Qt5OpenGL.dll
${RES}/Qt5Network.dll
${RES}/Qt5Widgets.dll)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
list(APPEND DLL_LIB_LIST ${QT5_DEBUG_DLL})
endif()
if (CXX_BIT STREQUAL 64)
list(APPEND DLL_LIB_LIST ${RES}/libgcc_s_seh-1.dll)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Обе возможности протестированы?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

else()
list(APPEND DLL_LIB_LIST ${RES}/libgcc_s_dw2-1.dll)
endif()
if(CMAKE_BUILD_TYPE STREQUAL Release)
list(APPEND DLL_LIB_LIST ${QT5_RELEASE_DLL})
endif()

file(COPY ${DLL_LIB_LIST} DESTINATION ../bin)
endif()
endif()


53 changes: 53 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
clone_folder: C:\grSim
shallow_clone: true

environment:
global:
MSYS_DIR: C:\msys64
matrix:
- platform: x86
platform_name: i686
bit: 32
QT_MinGW_DIR: C:\Qt\5.11\mingw53_32
- platform: x64
platform_name: x86_64
bit: 64
QT_MinGW_DIR: C:\Qt\5.12\mingw73_64


init:
- hg clone https://bitbucket.org/odedevs/ode ode
- git clone https://github.com/DmiitriyJarosh/vartypes.git vartypes_dir
- cd vartypes_dir
- git checkout qt5
- cd ..
- set PATH=%MSYS_DIR%\usr\bin
- pacman --noconfirm -Su mingw%bit%/mingw-w64-%platform_name%-protobuf
- pacman --noconfirm -Su mingw%bit%/mingw-w64-%platform_name%-cmake
- pacman --noconfirm -Su mingw-w64-%platform_name%-boost
- pacman --noconfirm -Sy make

build_script:
- ls
- cd ode
- mkdir build-cmake && cd build-cmake
- set PATH=%MSYS_DIR%
- mingw%bit% ../configure --enable-double-precision
- mingw%bit% make
- mingw%bit% make install
- set PATH=%MSYS_DIR%\usr\bin
- cd ..
- cd ..
- cd vartypes_dir
- set PATH=%MSYS_DIR%\mingw%bit%\bin;%QT_MinGW_DIR%\bin
- mkdir build-cmake && cd build-cmake
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему часть билдов in-source, а часть out-of-source? Можно как-то унифицировать?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a problem with calling configure for ODE, it is a bash script and i try to find way to run it in cmd? Any ideas?

- cmake -G "MinGW Makefiles" ..
- cmake --build .
- set PATH=%MSYS_DIR%
- mingw%bit% make install
- set PATH=%MSYS_DIR%
- cd ..
- mkdir C:\build_mingw_%platform%
- cd C:\build_mingw_%platform%
- mingw%bit% cmake -G "MinGW Makefiles" C:\grSim
- mingw%bit% cmake --build . -j 4
49 changes: 44 additions & 5 deletions clients/qt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
cmake_minimum_required(VERSION 2.8)

set(USE_QT5 1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

У cmake должен быть аналог pri файлов в Qt, так называемых include файлов. Туда можно и нужно выносить общие вещи между разными таргетами и просто инклюдить. Давай попробуем.

if(USE_QT5)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW) # remove if CMake >= 2.8.11 required
endif()
if(POLICY CMP0043) # compatibility with CMake 3.0.1
cmake_policy(SET CMP0043 OLD)
endif()
if(POLICY CMP0071) # compatibility with CMake 3.10.0
cmake_policy(SET CMP0071 OLD)
endif()
endif()
set(CMAKE_AUTOMOC ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(libs)

set(QT_USE_QTNETWORK TRUE)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})

if (USE_QT5)
add_definitions(-D QT5)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5Core REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Network REQUIRED)
set(QT_LIBRARIES "")
macro(qt4_wrap_cpp VARNAME)
set(${VARNAME} "")
endmacro()
# wrap functions
macro(qt4_wrap_ui)
qt5_wrap_ui(${ARGN})
endmacro()
macro(qt4_add_resources)
qt5_add_resources(${ARGN})
endmacro()
else()
set(QT_USE_QTNETWORK true)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
endif()
list(APPEND libs ${QT_LIBRARIES})

find_package(Protobuf REQUIRED)
Expand All @@ -30,6 +63,12 @@ add_executable(${app} MACOSX_BUNDLE
mainwindow.cpp
mainwindow.h
)

target_link_libraries(${app} ${libs})
if(USE_QT5)
target_link_libraries(${app} ${libs} Qt5::Core Qt5::Widgets Qt5::Network)
else()
if(USE_QT5)
qt5_use_modules(${app} Widgets Network Core OpenGL)
endif()
target_link_libraries(${app} ${libs} )
endif()

6 changes: 5 additions & 1 deletion clients/qt/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include <QtGui/QApplication>
#ifndef QT5
#include <QtGui/QApplication>
#else
#include <QtWidgets/QApplication>
#endif
#include "mainwindow.h"

int main(int argc, char *argv[])
Expand Down
9 changes: 7 additions & 2 deletions clients/qt/mainwindow.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui/QMainWindow>
#include <QtGui/QDialog>
#ifndef QT5
#include <QtGui/QMainWindow>
#include <QtGui/QDialog>
#else
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QDialog>
#endif
#include <QLineEdit>
#include <QLabel>
#include <QTimer>
Expand Down
4 changes: 3 additions & 1 deletion include/configwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ Copyright (C) 2011, Parsian Robotic Center (eew.aut.ac.ir/~parsian/grsim)

#ifndef CONFIGWIDGET_H
#define CONFIGWIDGET_H

#ifdef __WIN32__
#define WIN32_LEAN_AND_MEAN
#endif
#include <QWidget>
#include <QDockWidget>
#include <QtGui>
Expand Down
4 changes: 0 additions & 4 deletions include/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ Copyright (C) 2011, Parsian Robotic Center (eew.aut.ac.ir/~parsian/grsim)
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#if QT_VERSION >= 0x050000
#define QT5
#endif

#ifdef QT5
#include <QMdiArea>
#else
Expand Down
8 changes: 4 additions & 4 deletions include/winmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
int main(int, char**);

int CALLBACK WinMain(
__in HINSTANCE hInstance,
__in HINSTANCE hPrevInstance,
__in LPSTR lpCmdLine,
__in int nCmdShow)
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
wchar_t **wargv;//wargv is an array of LPWSTR (wide-char string)
char **argv;
Expand Down
Binary file added lib/libgrSim.dll.a
Binary file not shown.
6 changes: 5 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ Copyright (C) 2011, Parsian Robotic Center (eew.aut.ac.ir/~parsian/grsim)
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QtGui/QApplication>
#ifndef QT5
#include <QtGui/QApplication>
#else
#include <QtWidgets/QApplication>
#endif
#include "mainwindow.h"
#include "winmain.h"

Expand Down
4 changes: 4 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ void MainWindow::showHideSimulator(bool v)

void MainWindow::changeCurrentRobot()
{
if (robotwidget->robotCombo->currentIndex() >= glwidget->ssl->cfg->Robots_Count()) {
robotwidget->robotCombo->setCurrentIndex(glwidget->Current_robot);
return;
}
glwidget->Current_robot=robotwidget->robotCombo->currentIndex();
robotwidget->setPicture(glwidget->ssl->robots[glwidget->ssl->robotIndex(glwidget->Current_robot,glwidget->Current_team)]->img);
robotwidget->id = robotIndex(glwidget->Current_robot, glwidget->Current_team);
Expand Down