Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
added compliant_qtquickgui + interactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxime Tournier committed Jan 30, 2017
1 parent e6fc2e6 commit d9400ff
Show file tree
Hide file tree
Showing 10 changed files with 640 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
.DS_Store
*~
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@ sofa_add_application(applications-dev/projects/qtQuickSofa qtQuickSofa)
set(SOFAQTQUICKGUI_TARGETS "")

find_package(image QUIET)
find_package(Compliant QUIET)
find_package(SofaQtQuickGUI QUIET)
# if(PLUGIN_IMAGE AND PLUGIN_SOFAQTQUICKGUI)

if(image_FOUND AND SofaQtQuickGUI_FOUND)
list(APPEND SOFAQTQUICKGUI_TARGETS image_qtquickgui)
message("Adding automatically image_qtquickgui (image and SofaQtQuickGUI are activated)")
message("Adding (auto) image_qtquickgui (image and SofaQtQuickGUI are activated)")
add_subdirectory(applications-dev/plugins/image_qtquickgui)
endif()

if(Compliant_FOUND AND SofaQtQuickGUI_FOUND)
list(APPEND SOFAQTQUICKGUI_TARGETS compliant_qtquickgui)
message("Adding (auto) compliant_qtquickgui (since Compliant and SofaQtQuickGUI are activated)")
add_subdirectory(applications-dev/plugins/compliant_qtquickgui)
endif()


## Version
set(SOFAQTQUICKGUI_VERSION "1.0")

Expand Down
101 changes: 101 additions & 0 deletions applications-dev/plugins/compliant_qtquickgui/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
cmake_minimum_required(VERSION 2.8.12)
project(compliant_qtquickgui)

set(compliant_qtquickgui_MAJOR_VERSION 0)
set(compliant_qtquickgui_MINOR_VERSION 1)
set(compliant_qtquickgui_VERSION ${compliant_qtquickgui_MAJOR_VERSION}.${compliant_qtquickgui_MINOR_VERSION})

set(SOURCE_FILES
CompliantQtQuickGUI.cpp
SofaCompliantInteractor.cpp
)

set(MOC_FILES
SofaCompliantInteractor.h
)

set(HEADER_FILES
CompliantQtQuickGUI.h
SofaCompliantInteractor.h
)

set(QML_FILES
# data/qml/SofaImage/qmldir
# data/qml/SofaImage/SofaImagePlaneItem.qml
# data/qml/SofaDataTypes/SofaDataType_imageplane.qml
data/qml/SofaInteractors/UserInteractor_Compliant.qml
)

set(QRC_FILES
data/qml/compliant_qml.qrc
)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

find_package(SofaFramework REQUIRED)
find_package(Compliant REQUIRED)
find_package(SofaQtQuickGUI REQUIRED)

# TODO do we need all the crap following?


# on Window, Qt packages need the glu32 lib full path, but they do not find it without help
if(WIN32)
if(CMAKE_CL_64)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x64")
else()
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:/Program Files (x86)/Windows Kits/8.0/Lib/win8/um/x86")
endif()

# to fix a bug when one is compiling a debug version of the code
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-DQT_NO_DEBUG)
endif()
endif()

find_package(Qt5 COMPONENTS Core Gui Widgets Quick Qml REQUIRED PATHS "${SOFA-EXTERNAL_QT5_PATH}")
# make sure to use QT > 5.0

include_directories(${Qt5Core_INCLUDE_DIRS})
include_directories(${Qt5Gui_INCLUDE_DIRS})
include_directories(${Qt5Widgets_INCLUDE_DIRS})
include_directories(${Qt5Qml_INCLUDE_DIRS})
include_directories(${Qt5Quick_INCLUDE_DIRS})

add_definitions(${Qt5Core_DEFINITIONS})
add_definitions(${Qt5Gui_DEFINITIONS})
add_definitions(${Qt5Widgets_DEFINITIONS})
add_definitions(${Qt5Qml_DEFINITIONS})
add_definitions(${Qt5Quick_DEFINITIONS})


qt5_wrap_cpp(MOC_FILES ${MOC_FILES}) # do not use "set(CMAKE_AUTOMOC ON)" since all the mocced files will be compiled by a single compilation unit leading to a "out of heap space" issue on MSVC
qt5_add_resources(RESOURCE_FILES ${QRC_FILES})

add_definitions(-DQT_PLUGIN)

add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${MOC_FILES} ${SOURCE_FILES} ${QRC_FILES} ${RESOURCE_FILES} ${QML_FILES} ${CONFIG_FILES})


# if(NOT MSVC)
# target_compile_options(${PROJECT_NAME} PUBLIC "$<$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,CXX>:${CXX11_FLAG}>")
# endif()

# find_package(CImg REQUIRED)
# target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CImg_INCLUDE_DIRS}>")

# if(APPLE)
# find_package(X11)
# if(NOT X11_FOUND)
# message(FATAL_ERROR "Failed to find X11 which is required to build plugin 'image'")
# endif()
# target_link_libraries(${PROJECT_NAME} ${X11_X11_LIB})
# target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${X11_X11_INCLUDE_PATH}>")
# endif()

set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-DSOFA_BUILD_COMPLIANT_QTQUICKGUI")

target_link_libraries(${PROJECT_NAME} Compliant SofaQtQuickGUI)

## Install rules for the library; CMake package configurations files
sofa_create_package(${PROJECT_NAME} ${compliant_qtquickgui_VERSION} ${PROJECT_NAME} ${PROJECT_NAME})
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
Copyright 2015, Anatoscope
This file is part of sofaqtquick.
sofaqtquick is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
sofaqtquick is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with sofaqtquick. If not, see <http://www.gnu.org/licenses/>.
*/

#include "CompliantQtQuickGUI.h"

#include <QApplication>
#include <QDebug>

#include <QQuickPaintedItem>

#include "SofaCompliantInteractor.h"

using namespace sofa::qtquick;

const int versionMajor = 1;
const int versionMinor = 0;

static void initResources()
{
Q_INIT_RESOURCE(compliant_qml);
}

namespace sofa
{

namespace component
{

extern "C" {
SOFA_COMPLIANT_QTQUICKGUI_API void initExternalModule();
SOFA_COMPLIANT_QTQUICKGUI_API const char* getModuleName();
SOFA_COMPLIANT_QTQUICKGUI_API const char* getModuleVersion();
SOFA_COMPLIANT_QTQUICKGUI_API const char* getModuleLicense();
SOFA_COMPLIANT_QTQUICKGUI_API const char* getModuleDescription();
SOFA_COMPLIANT_QTQUICKGUI_API const char* getModuleComponentList();
}

void initExternalModule()
{
static bool first = true;
if (first)
{
first = false;

initResources();

qmlRegisterType<SofaCompliantInteractor> ("SofaCompliantInteractor",
versionMajor, versionMinor, "SofaCompliantInteractor");
}
}

const char* getModuleName()
{
return "Compliant Plugin - QtQuick GUI";
}

const char* getModuleVersion()
{
return "0.1";
}

const char* getModuleLicense()
{
return "LGPL";
}

const char* getModuleDescription()
{
return "Compliant QtQuick GUI";
}

const char* getModuleComponentList()
{
return "";
}

} // namespace component

} // namespace sofa
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright 2015, Anatoscope
This file is part of sofaqtquick.
sofaqtquick is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
sofaqtquick is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with sofaqtquick. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef COMPLIANT_QTQUICKGUI_INIT_H
#define COMPLIANT_QTQUICKGUI_INIT_H

#include <sofa/helper/system/config.h>

#ifdef SOFA_BUILD_COMPLIANT_QTQUICKGUI
#define SOFA_COMPLIANT_QTQUICKGUI_API SOFA_EXPORT_DYNAMIC_LIBRARY
#else
#define SOFA_COMPLIANT_QTQUICKGUI_API SOFA_IMPORT_DYNAMIC_LIBRARY
#endif

#endif //COMPLIANT_QTQUICKGUI_INIT_H

Loading

0 comments on commit d9400ff

Please sign in to comment.