-
Notifications
You must be signed in to change notification settings - Fork 0
added qt5 and win support #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
a156b2e
ba7f702
a2816d9
7e9d7bb
16b9675
59791ee
708e4b6
a6de638
eb85985
3b5901f
6dd7cfd
6251277
843afe4
0d9c1f5
ad4fd2d
3a3cb46
37f87e9
d32cde5
f2bdebb
8039512
025c31a
b2e4a71
eda56d7
27a0f6e
8358ab5
109d66f
70230a5
29990e2
74790e1
587a5d4
0928b24
076e748
1a1b6b1
15a683b
8d898e5
bf9d64b
da902d8
9ee2221
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,3 +6,4 @@ bin*/* | |
| *.swp | ||
| Thumbs.db | ||
| .idea/* | ||
| cmake-* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,13 +12,14 @@ matrix: | |
| dist: trusty | ||
| sudo: required | ||
| - os: osx | ||
| osx_image: xcode8 | ||
| osx_image: xcode10 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Что не так с предыдущей версией было? Каких библиотек не хватало?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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 | ||
|
|
@@ -52,4 +54,4 @@ script: | |
| - mkdir build && cd build | ||
| - cmake .. | ||
| - make | ||
| - sudo make install | ||
| - sudo make install | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Таких изменений быть не должно. |
||
| 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) | ||
|
|
@@ -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) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А зачем это? Не очень понимаю :( и ниже который.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
@@ -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 . | ||
|
|
@@ -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}) | ||
|
|
@@ -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) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Обе возможности протестированы?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
|
|
||
|
|
||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А почему часть билдов in-source, а часть out-of-source? Можно как-то унифицировать?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,47 @@ | ||
| cmake_minimum_required(VERSION 2.8) | ||
|
|
||
| set(USE_QT5 1) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
|
@@ -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() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Какие конкретно файлы перекрывает эта маска?
There was a problem hiding this comment.
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?