Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
JPSvis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JuPedSim
JPSvis
Commits
7daf70e0
Commit
7daf70e0
authored
10 years ago
by
Mohcine Chraibi
Browse files
Options
Downloads
Patches
Plain Diff
Support only for qt4
No support for qt5. Is that needed?
parent
2e900b8c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CMakeLists.txt
+63
-58
63 additions, 58 deletions
CMakeLists.txt
with
63 additions
and
58 deletions
CMakeLists.txt
+
63
−
58
View file @
7daf70e0
# ------------------------- Begin Generic CMake Variable Logging ------------------
# todo: how to check these:
# sudo apt-get install libvtk-java
# sudo apt-get install python-vtk
# SET(DESIRED_QT_VERSION "3")
# the short system name, e.g. "Linux", "FreeBSD" or "Windows"
MESSAGE
(
STATUS
"CMAKE_SYSTEM_NAME: "
${
CMAKE_SYSTEM_NAME
}
)
...
...
@@ -19,9 +18,15 @@ MESSAGE( STATUS "CMAKE_C_COMPILER: " ${CMAKE_C_COMPILER} )
MESSAGE
(
STATUS
"CMAKE_CXX_COMPILER: "
${
CMAKE_CXX_COMPILER
}
)
# ------------------------- End of Generic CMake Variable Logging ------------------
cmake_minimum_required
(
VERSION 2.8
)
#set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/" ${CMAKE_MODULE_PATH})
# set project's name
project
(
JPSvis
)
list
(
APPEND CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
)
message
(
STATUS
"MODULE_PATH"
${
CMAKE_MODULE_PATH
}
)
set
(
CMAKE_COLOR_MAKEFILE ON
)
set
(
JPSVIS_MAJOR_VERSION 0
)
set
(
JPSVIS_MINOR_VERSION 5
)
...
...
@@ -130,34 +135,15 @@ set( SAMPLE_RCS
forms/icons.qrc
)
# by default only QtCore and QtGui modules are enabled
# other modules must be enabled like this:
# set( QT_USE_QT3SUPPORT TRUE )
set
(
QT_USE_QTXML TRUE
)
# needed!
# set(QT_USE_QTOPENGL TRUE)
# set(QT_USE_QTNETWORK)
# set(QT_USE_QTOPENGL)
# set(QT_USE_QTSQL)
# set(QT_USE_QTSVG)
# set(QT_USE_QTTEST)
# set(QT_USE_QTDBUS)
# set(QT_USE_QTSCRIPT)
# set(QT_USE_QTWEBKIT)
# set(QT_USE_QTXMLPATTERNS)
# set(QT_USE_PHONON)
set
(
CMAKE_INCLUDE_CURRENT_DIR ON
)
#set(VTK_USE_HYBRID ON CACHE BOOL "doc" FORCE)
find_package
(
VTK REQUIRED
)
#set(VTK_DIR "/usr/include/vtk-5.8" CACHE PATH "VTK directory override" FORCE)
#set(VTK_INCLUDE_DIRS "/usr/include/vtk-5.8") # CACHE PATH "VTK directory override" FORCE)
#set(VTK_LIBRARY_DIRS "/usr/lib/vtk-5.8/" CACHE PATH "VTK directory override" FORCE)
if
(
VTK_FOUND
)
message
(
"found VTK. Version:"
${
VTK_VERSION
}
. VTK_DIR:
${
VTK_DIR
}
)
message
(
STATUS
"found VTK. Version: "
${
VTK_VERSION
}
" | VTK_DIR: "
${
VTK_DIR
}
)
message
(
STATUS
"VTK_QT_Version: "
${
VTK_QT_VERSION
}
)
else
(
VTK_FOUND
)
message
(
FATAL_ERROR
"Cannot build the executable without VTK. Please set the
...
...
@@ -165,49 +151,68 @@ VTK_DIR")
endif
(
VTK_FOUND
)
include
(
${
VTK_USE_FILE
}
)
if
(
${
VTK_VERSION
}
VERSION_GREATER
"6"
AND VTK_QT_VERSION VERSION_GREATER
"4"
)
message
(
WARNING: JPSvis is not tested with vtk
${
VTK_VERSION
}
)
endif
()
# # Instruct CMake to run moc automatically when needed.
# Instruct CMake to run moc automatically when needed.
set
(
CMAKE_AUTOMOC ON
)
#find_package(Qt5Widgets REQUIRED QUIET)
find_package
(
Qt4 REQUIRED
)
#find_package(Qt5Widgets REQUIRED)
#find_package(Qt5Test REQUIRED)
#--------------- here comes QT. Version problem (4 or 5?)
#FIND_PACKAGE( Qt4 REQUIRED )
#FIND_PACKAGE(QT REQUIRED)
if
(
"
${
DESIRED_QT_VERSION
}
"
STREQUAL
""
)
set
(
DESIRED_QT_VERSION
"4"
)
endif
()
if
(
${
DESIRED_QT_VERSION
}
VERSION_GREATER
"4"
OR
${
DESIRED_QT_VERSION
}
VERSION_LESS
"3"
)
message
(
FATAL_ERROR
"QT version "
${
DESIRED_QT_VERSION
}
" not supported"
)
endif
()
message
(
STATUS
"DESIRED_QT_VERSION "
${
DESIRED_QT_VERSION
}
)
#include(${QT_USE_FILE})
# this command finds Qt4 libraries and sets all required variables
# note that it's Qt4, not QT4 or qt4
FIND_PACKAGE
(
Qt4 REQUIRED
)
# add some useful macros and variables
# (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains a path to CMake script)
include
(
${
QT_USE_FILE
}
)
# this command will generate rules that will run rcc on all files from SAMPLE_RCS
# in result SAMPLE_RC_SRCS variable will contain paths to files produced by rcc
FIND_PROGRAM
(
QT_QMAKE_EXECUTABLE NAMES qmake REQUIRED
)
FIND_PACKAGE
(
Qt COMPONENTS QtXml QT_USE_QTNETWORK REQUIRED
)
message
(
STATUS
"QT5_INSTALLED "
${
QT3_INSTALLED
}
)
message
(
STATUS
"QT4_INSTALLED "
${
QT4_INSTALLED
}
)
message
(
STATUS
"QT3_INSTALLED "
${
QT3_INSTALLED
}
)
# by default only QtCore and QtGui modules are enabled
# other modules must be enabled like this:
set
(
QT_USE_QTXML TRUE
)
# needed!
set
(
QT_USE_QTNETWORK TRUE
)
# add some useful macros and variables
# (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains a path to CMake script)
include
(
${
QT_USE_FILE
}
)
# this command will generate rules that will run rcc on all files from SAMPLE_RCS
# in result SAMPLE_RC_SRCS variable will contain paths to files produced by rcc
if
(
${
QT4_INSTALLED
}
)
QT4_ADD_RESOURCES
(
SAMPLE_RC_SRCS
${
SAMPLE_RCS
}
)
# and finally this will run moc:
QT4_WRAP_CPP
(
SAMPLE_MOC_HDRS
${
SAMPLE_MOC_HDRS
}
)
# this will run uic on .ui files:
QT4_WRAP_UI
(
SAMPLE_UI_HDRS
${
SAMPLE_UIS
}
)
QT4_ADD_RESOURCES
(
SAMPLE_RESOURCES_RCS
${
SAMPLE_RCS
}
)
elseif
(
${
QT5_INSTALLED
}
)
find_package
(
Qt5Widgets REQUIRED
)
endif
()
#QT4_WRAP_UI(helloworld_FORMS_HEADERS ${helloworld_FORMS})
QT4_ADD_RESOURCES
(
SAMPLE_RESOURCES_RCS
${
SAMPLE_RCS
}
)
# we need this to be able to include headers produced by uic in our code
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
INCLUDE_DIRECTORIES
(
${
CMAKE_BINARY_DIR
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
if
(
${
VTK_VERSION
}
VERSION_GREATER
"6"
)
# AND VTK_QT_VERSION VERSION_GREATER "4"
message
(
WARNING
"JPSvis is not tested with vtk "
${
VTK_VERSION
}
)
endif
()
# we need this to be able to include headers produced by uic in our code
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
INCLUDE_DIRECTORIES
(
${
CMAKE_BINARY_DIR
}
)
INCLUDE_DIRECTORIES
(
${
CMAKE_CURRENT_BINARY_DIR
}
)
# here we instruct CMake to build JPSvis executable from all of the source files
ADD_EXECUTABLE
(
JPSvis
${
SAMPLE_SRCS
}
ADD_EXECUTABLE
(
JPSvis
${
SAMPLE_SRCS
}
${
SAMPLE_MOC_HDRS
}
${
SAMPLE_UI_HDRS
}
${
SAMPLE_RESOURCES_RCS
}
...
...
@@ -216,13 +221,13 @@ FIND_PACKAGE( Qt4 REQUIRED )
# last thing we have to do is to tell CMake what libraries our executable needs,
# luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:
set
(
VTK_USE_GUISUPPORT ON
)
set
(
VTK_USE_QT ON
)
set
(
VTK_USE_QVTK_QTOPENGL ON
)
set
(
VTK_USE_QT ON
)
#
set(VTK_USE_QVTK_QTOPENGL ON )
#TARGET_LINK_LIBRARIES( JPSvis ${QT_LIBRARIES} QVTK) # QVTK is for VTK 5.x. For VTK 6, use ${VTK_LIBRARIES} instead
if
(
${
VTK_VERSION
}
VERSION_LESS
"6"
)
TARGET_LINK_LIBRARIES
(
JPSvis
${
QT_LIBRARIES
}
QVTK
)
else
()
TARGET_LINK_LIBRARIES
(
JPSvis
${
VTK_LIBRARIES
}
QVTK
)
TARGET_LINK_LIBRARIES
(
JPSvis
${
VTK_LIBRARIES
}
)
endif
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment