CMakeLists.txt 4 KB
Newer Older
Joseph Mirabel's avatar
Joseph Mirabel committed
1
2
3
4
5
#
# Copyright (c) 2015 CNRS
# Authors: Joseph Mirabel
#
#
6
7
# This file is part of hpp-gui
# hpp-gui is free software: you can redistribute it
Joseph Mirabel's avatar
Joseph Mirabel committed
8
9
10
11
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of the License, or (at your option) any later version.
#
12
# hpp-gui is distributed in the hope that it will be
Joseph Mirabel's avatar
Joseph Mirabel committed
13
14
15
16
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Lesser Public License for more details.  You should have
# received a copy of the GNU Lesser General Public License along with
17
# hpp-gui  If not, see
Joseph Mirabel's avatar
Joseph Mirabel committed
18
19
20
21
22
23
24
# <http://www.gnu.org/licenses/>.

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

SET(CXX_DISABLE_WERROR TRUE)

INCLUDE(cmake/base.cmake)
Joseph Mirabel's avatar
Joseph Mirabel committed
25
INCLUDE(cmake/boost.cmake)
26
INCLUDE(cmake/hpp.cmake)
Guilhem Saurel's avatar
Guilhem Saurel committed
27
INCLUDE(cmake//python.cmake)
Joseph Mirabel's avatar
Joseph Mirabel committed
28

29
30
# Tells pkg-config to read qtversion and cmake_plugin from pkg config file.
LIST(APPEND PKG_CONFIG_ADDITIONAL_VARIABLES qtversion cmake_plugin)
31

32
33
SET(PROJECT_NAME "hpp-gui")
SET(PROJECT_DESCRIPTION "Graphical interface for HPP ")
Joseph Mirabel's avatar
Joseph Mirabel committed
34

35
SETUP_HPP_PROJECT()
Joseph Mirabel's avatar
Joseph Mirabel committed
36

Guilhem Saurel's avatar
Guilhem Saurel committed
37
FINDPYTHON()
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
ADD_REQUIRED_DEPENDENCY("gepetto-viewer-corba >= 1.3")

# Get desired Qt version
string(REPLACE "." ";" DESIRED_QT_VERSION_LIST ${GEPETTO_VIEWER_CORBA_QTVERSION})
list(GET DESIRED_QT_VERSION_LIST 0 DESIRED_QT_VERSION_MAJOR)

IF(${DESIRED_QT_VERSION_MAJOR} EQUAL 4)
  SET(USE_QT4 True)
ELSEIF(${DESIRED_QT_VERSION_MAJOR} EQUAL 5)
  SET(USE_QT4 False)
ELSE()
  MESSAGE(FATAL_ERROR "This package is only compatible with Qt 4 and Qt 5")
ENDIF()
MESSAGE(STATUS "Looking for Qt ${DESIRED_QT_VERSION_MAJOR}.")

53
54
55
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
IF(USE_QT4)
  FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtOpenGl QtNetwork)
56
  SET(PKG_CONFIG_EXTRA "qtversion: ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}")
57
58
59
60
61
62
ELSE(USE_QT4)
  FOREACH (component "Core" "Widgets" "Gui" "OpenGL" "Concurrent" "Network")
    FIND_PACKAGE ("Qt5${component}" REQUIRED)
    LIST(APPEND QT_INCLUDE_DIRS ${Qt5${component}_INCLUDE_DIRS})
    LIST(APPEND QT_LIBRARIES    ${Qt5${component}_LIBRARIES}   )
  ENDFOREACH (component "Core" "Widgets" "Gui" "OpenGL" "Network")
63
  SET(PKG_CONFIG_EXTRA "qtversion=${Qt5Core_VERSION}")
64
ENDIF(USE_QT4)
Joseph Mirabel's avatar
Joseph Mirabel committed
65

66
SET(BOOST_COMPONENTS thread regex)
Joseph Mirabel's avatar
Joseph Mirabel committed
67
SEARCH_FOR_BOOST ()
68

Joseph Mirabel's avatar
Joseph Mirabel committed
69
ADD_OPTIONAL_DEPENDENCY("hpp-corbaserver")
70
ADD_OPTIONAL_DEPENDENCY("hpp-manipulation-corba")
71
ADD_OPTIONAL_DEPENDENCY("remoteimu")
Joseph Mirabel's avatar
Joseph Mirabel committed
72
73
74
75
76
77
78

# Activate hpp-util logging if requested
SET (HPP_DEBUG FALSE CACHE BOOL "trigger hpp-util debug output")
IF (HPP_DEBUG)
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHPP_DEBUG")
ENDIF()

79
80
81
82
83
84
# This line allows QT-MOC to compile with the include from gepetto-gui
# It cannot be done through the pkg-config framework because the moc settings
# are generated before PKG_CONFIG_USE_DEPENDENCY calls.
# Without this, file
# gepetto/gui/plugin-interface.hh
# is not found.
85
INCLUDE_DIRECTORIES(${GEPETTO_VIEWER_CORBA_INCLUDE_DIRS})
Joseph Mirabel's avatar
Joseph Mirabel committed
86

87
ADD_SUBDIRECTORY(plugins)
Joseph Mirabel's avatar
Joseph Mirabel committed
88
ADD_SUBDIRECTORY(pyplugins)
89

90
91
92
93
94
95
96
97
98
99
# If settings.conf not yet installed, install it
IF (EXISTS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui/settings.conf")
  MESSAGE (STATUS
    "File ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui/settings.conf detected.")
ELSE ()
  MESSAGE (STATUS "File ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui/settings.conf does not exist. Will install it.")
  INSTALL (FILES etc/gepetto-gui/settings.conf
    DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui)
ENDIF ()

100
101
102
103
104
105
106
107
108
109
# If basic.conf not yet installed, install it
IF (EXISTS "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui/basic.conf")
  MESSAGE (STATUS
    "File ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui/basic.conf detected.")
ELSE ()
  MESSAGE (STATUS "File ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui/basic.conf does not exist. Will install it.")
  INSTALL (FILES etc/gepetto-gui/basic.conf
    DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/gepetto-gui)
ENDIF ()

110
SETUP_HPP_PROJECT_FINALIZE()