Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 9aed8c40 authored by promayon's avatar promayon
Browse files

NEW wizard compilation on linux! (fixed CMakeLists.txt and findXSD)

NEW find xerces-c now in cmake/modules


git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@83 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 7235f7a7
......@@ -232,7 +232,7 @@ macro(component_extension)
set(LIBXML2_LIBRARIES)
if(${COMPONENT_NAME_CMAKE}_NEEDS_LIBXML2)
# LibXml2 is required
include(CamiTKFindXml2)
find_package(Xml2)
if (LIBXML2_FOUND)
add_definitions(${LIBXML2_DEFINITIONS})
include_directories(${LIBXML2_INCLUDE_DIR})
......
......@@ -11,7 +11,8 @@
# Look for a root installation
FIND_PATH(XERCESC_ROOT_DIR include/xercesc/parsers/SAXParser.hpp
/usr
$ENV{XSDDIR}
$ENV{XERCESC_DIR}
$ENV{XERCESC_ROOT_DIR}
DOC "The root of an installed xerces-c installation"
)
......
project(TOOLS)
# list of TOOLS (option)
set(TOOLS_LIST lml pml mml)
set(TOOLS_LIST lml pml mml generator)
# qtpropertybrowser is mandatory
set(TOOLS_SUBDIRS qtpropertybrowser)
......
......@@ -5,11 +5,10 @@ cmake_minimum_required(VERSION 2.6)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${generator_SOURCE_DIR})
# Find XSD Code Synthesis
message(STATUS "xsd dir: $ENV{XSDDIR}")
find_package(XSD REQUIRED)
find_package(XercesC REQUIRED)
set (xmlsrcs ${CMAKE_CURRENT_BINARY_DIR}/xmlsrcs)
find_package(XSD REQUIRED)
find_package(XercesC REQUIRED)
add_subdirectory(schema)
add_subdirectory(wizard)
......@@ -15,14 +15,15 @@ FIND_PATH(XSD_INCLUDE_DIR xsd/cxx/parser/elements.hxx
/usr/include
)
FIND_PROGRAM(XSD_EXECUTABLE
NAMES
xsd
# check if the plateform can compile the xsd automatically
FIND_PROGRAM(XSD_COMMAND
NAMES xsd xsdcxx
PATHS
"[HKEY_CURRENT_USER\\xsd\\bin"
$ENV{XSDDIR}/bin
/usr/local/bin
/usr/bin
${CMAKE_FIND_ROOT_PATH}/bin #Add paths here
)
# if the include and the program are found then we have it
......
# - Find Xerces-C
# from http://cartwheel.idyll.org/browser/trunk/FindXercesC.cmake
# The following settings are defined
# XERCESC_ROOT_DIR, the root of the include and lib directory
# XERCESC_INCLUDE_DIR, the full path of the include dir (ADVANCED)
# XERCESC_LIBRARIES, the name of the xerces-c library (ADVANCED)
#####
# Find Xerces-C
# Look for a root installation
FIND_PATH(XERCESC_ROOT_DIR include/xercesc/parsers/SAXParser.hpp
/usr
$ENV{XSDDIR}
DOC "The root of an installed xerces-c installation"
)
# try to find the header
FIND_PATH(XERCESC_INCLUDE_DIR xercesc/parsers/SAXParser.hpp
${XERCESC_ROOT_DIR}/include
/usr/include
/usr/local/include
)
# Find the library
FIND_LIBRARY(XERCESC_LIBRARY
NAMES xerces-c
PATHS
${XERCESC_ROOT_DIR}/lib
/usr/lib
/usr/local/lib
DOC "The name of the xerces-c library"
)
# patch for bad detection
set(XERCESC_INCLUDE_DIR /usr/local/include)
IF (XERCESC_ROOT_DIR)
IF (XERCESC_INCLUDE_DIR AND XERCESC_LIBRARY)
SET (XERCESC_FOUND TRUE)
SET (XERCESC_LIBRARIES "${XERCESC_LIBRARY}")
# FIXME: There should be a better way of handling this?
# FIXME: How can we test to see if the lib dir isn't
# FIXME: one of the default dirs?
LINK_DIRECTORIES(${XERCESC_ROOT_DIR}/lib)
ENDIF (XERCESC_INCLUDE_DIR AND XERCESC_LIBRARY)
ENDIF (XERCESC_ROOT_DIR)
IF (XERCESC_FOUND)
IF (NOT XERCESC_FIND_QUIETLY)
MESSAGE (STATUS "Found Xerces-C: ${XERCESC_LIBRARY}")
ENDIF (NOT XERCESC_FIND_QUIETLY)
ELSE (XERCESC_FOUND)
IF (XERCESC_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Xerces-C")
ENDIF (XERCESC_FIND_REQUIRED)
ENDIF (XERCESC_FOUND)
MARK_AS_ADVANCED(
XERCESC_INCLUDE_DIR
XERCESC_LIBRARY
)
......@@ -4,7 +4,7 @@
#ifndef ACTIONGENERATOR_H
#define ACTIONGENERATOR_H
using namespace moduleml;
using namespace coreschema;
class ActionGenerator : public ElementGenerator {
public :
......
# the name of the C++ library generated by the XML Schema
set(SCHEMA_NAME "coreschema")
# Find Qt4
# by default only QtCore and QtGui modules are enabled
# other modules must be enabled like this:
......@@ -24,10 +27,10 @@ ADD_DEFINITIONS(
set(wizard_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${xmlsrcs}
${XSD_INCLUDE_DIR}
${CAMITK_INCLUDE_DIR}/${SCHEMA_NAME}
${XSD_INCLUDE_DIR}
)
message ("include dir: ${wizard_INCLUDE_DIR}")
include_directories(${wizard_INCLUDE_DIR})
......@@ -85,6 +88,12 @@ gather_headers_and_sources(wizard)
add_executable(wizard ${wizard_SOURCES})
target_link_libraries(wizard moduleml ${XERCESC_LIBRARY} ${QT_LIBRARIES})
target_link_libraries(wizard ${SCHEMA_NAME} ${XERCESC_LIBRARY} ${QT_LIBRARIES})
add_dependencies(wizard ${SCHEMA_NAME})
add_dependencies(wizard moduleml)
\ No newline at end of file
# installation
install(TARGETS wizard
RUNTIME DESTINATION bin
COMPONENT wizard
)
\ No newline at end of file
......@@ -14,7 +14,7 @@ void ComponentGenerator::createElement() throw (QString) {
// TODO manage exception (despite Qt...).
// TODO find how to read an xml file with an absolute path !!!
this->theComponent = moduleml::component(xmlFileStr, xml_schema::flags::dont_validate);
this->theComponent = coreschema::component(xmlFileStr, xml_schema::flags::dont_validate);
this->elementClassName = QString(this->theComponent->classNames().componentClass().c_str());
this->hasParameters = theComponent->properties().present();
......
......@@ -5,7 +5,7 @@
#ifndef COMPONENTGENERATOR_H
#define COMPONENTGENERATOR_H
using namespace moduleml;
using namespace coreschema;
class ComponentGenerator : public ElementGenerator {
public :
......
......@@ -7,7 +7,7 @@
#include <Parameter.hxx>
#include <ParameterType.hxx>
using namespace moduleml;
using namespace coreschema;
ElementGenerator::ElementGenerator(QString xmlFilename, QString devDirectoryName) {
out = NULL;
......
......@@ -9,7 +9,7 @@
#ifndef ELEMENTGENERATOR_H
#define ELEMENTGENERATOR_H
using namespace moduleml;
using namespace coreschema;
class ElementGenerator {
......
......@@ -18,16 +18,16 @@ ExtTypeWindow::ExtTypeWindow(ExtensionWindow * dad, QString workingDirectory, Ex
this->type = type;
typeStr = "";
switch (this->type) {
case ExtTypeType::Action:
case Action:
typeStr = "Action";
break;
case ExtTypeType::Application:
case Application:
typeStr = "Application";
break;
case ExtTypeType::Component:
case Component:
typeStr = "Component";
break;
case ExtTypeType::Viewer:
case Viewer:
typeStr = "Viewer";
break;
default:
......@@ -56,7 +56,7 @@ void ExtTypeWindow::personnalizeInterface() {
ui.extensionClassNameLabel->setText("File and class name of the " + typeStr);
ui.extTypeClassNameLineEdit->setText("Example" + typeStr);
switch (this->type) {
case ExtTypeType::Action:
case Action:
ui.componentGroupBox->setTitle("Component on which apply the Action");
ui.componentInheritCheckBox->setChecked(true);
ui.componentInheritCheckBox->hide();
......@@ -65,7 +65,7 @@ void ExtTypeWindow::personnalizeInterface() {
ui.representationGroupBox->hide();
ui.displayGroupBox->hide();
break;
case ExtTypeType::Component:
case Component:
ui.componentGroupBox->setTitle("Parent component if ihnerited");
ui.componentInheritCheckBox->setChecked(false);
ui.componentClassComboBox->setEnabled(false);
......@@ -144,10 +144,10 @@ void ExtTypeWindow::okClicked() {
className = ui.extTypeClassNameLineEdit->text();
switch (this->type) {
case ExtTypeType::Action:
case Action:
succeed = makeActionXML();
break;
case ExtTypeType::Component:
case Component:
succeed = makeComponentXML();
break;
default:
......@@ -198,30 +198,30 @@ bool ExtTypeWindow::makeActionXML() {
qTags.push_back(e->ui.lineEdit->text());
// Name
moduleml::Action::name_type aName(qName.toStdString());
coreschema::Action::name_type aName(qName.toStdString());
// Description
moduleml::Action::description_type aDesc(qDescription.toStdString());
coreschema::Action::description_type aDesc(qDescription.toStdString());
// Class names (action class, component class, extension class)
moduleml::ClassNames aClasses(qComponentClass.toStdString(), qExtensionName.toStdString());
coreschema::ClassNames aClasses(qComponentClass.toStdString(), qExtensionName.toStdString());
aClasses.actionClass(qActionClassName.toStdString());
moduleml::Action::classification_type aClassification(qFamily.toStdString());
coreschema::Action::classification_type aClassification(qFamily.toStdString());
foreach (QString t, qTags)
aClassification.tag().push_back(t.toStdString());
// Action definition
moduleml::Action myAction(aName, aDesc, aClasses, aClassification);
coreschema::Action myAction(aName, aDesc, aClasses, aClassification);
// Optional fields
// Parameters
if (! this->parameters.empty()) {
moduleml::Parameters params;
coreschema::Parameters params;
foreach (ParameterWidget * p, this->parameters) {
QString pName = p->ui.parameterNameLineEdit->text();
QString pType = p->ui.parameterTypeComboBox->currentText();
QString pDefault = p->ui.parameterDefaultValueLineEdit->text();
// bool edit = p->ui.parameterEditablecheckBox->isChecked();
moduleml::Parameter aParam(pName.toStdString(), pType.toStdString());
coreschema::Parameter aParam(pName.toStdString(), pType.toStdString());
if (! pDefault.isEmpty())
aParam.defaultValue(pDefault.toStdString());
// aParam.editable(edit);
......@@ -231,7 +231,7 @@ bool ExtTypeWindow::makeActionXML() {
myAction.parameters(params);
}
// Properties
moduleml::Action::properties_type props;
coreschema::Action::properties_type props;
props.modal(ui.modalCheckBox->isChecked());
props.delayed(ui.delayedCheckBox->isChecked());
props.embedded(ui.embededCheckBox->isChecked());
......@@ -241,7 +241,7 @@ bool ExtTypeWindow::makeActionXML() {
xml_schema::namespace_infomap map;
map[""].schema = "../../schemas/Action.xsd";
std::ostringstream oss;
moduleml::action(oss, myAction, map);
coreschema::action(oss, myAction, map);
std::string xml (oss.str ());
// Writing in the right xml file
......@@ -274,28 +274,28 @@ bool ExtTypeWindow::makeComponentXML() {
QString qRep(ui.representationComboBox->currentText());
// Name
moduleml::Component::name_type aName(qName.toStdString());
coreschema::Component::name_type aName(qName.toStdString());
// Description
moduleml::Component::description_type aDesc(qDescription.toStdString());
coreschema::Component::description_type aDesc(qDescription.toStdString());
// Class names (component class, extension class)
moduleml::ClassNames aClasses(qComponentClassName.toStdString(), qExtensionName.toStdString());
// Reprsentation
moduleml::Representation aRep(qRep.toStdString());
coreschema::ClassNames aClasses(qComponentClassName.toStdString(), qExtensionName.toStdString());
// Reprsentation
coreschema::Representation aRep(qRep.toStdString());
// Component definition
moduleml::Component myComponent(aName, aDesc, aClasses, aRep);
coreschema::Component myComponent(aName, aDesc, aClasses, aRep);
// Optional fields
// Properties
if (! this->parameters.empty()) {
moduleml::Parameters params;
coreschema::Parameters params;
foreach (ParameterWidget * p, this->parameters) {
QString pName = p->ui.parameterNameLineEdit->text();
QString pType = p->ui.parameterTypeComboBox->currentText();
QString pDefault = p->ui.parameterDefaultValueLineEdit->text();
// bool edit = p->ui.parameterEditablecheckBox->isChecked();
moduleml::Parameter aParam(pName.toStdString(), pType.toStdString());
coreschema::Parameter aParam(pName.toStdString(), pType.toStdString());
if (! pDefault.isEmpty())
aParam.defaultValue(pDefault.toStdString());
// aParam.editable(edit);
......@@ -309,7 +309,7 @@ bool ExtTypeWindow::makeComponentXML() {
xml_schema::namespace_infomap map;
map[""].schema = "../../schemas/Component.xsd";
std::ostringstream oss;
moduleml::component(oss, myComponent, map);
coreschema::component(oss, myComponent, map);
std::string xml (oss.str ());
// Writing in the right xml file
......
......@@ -381,7 +381,7 @@ void ExtensionGenerator::generateComponentExtensionFiles() throw (QString) {
it < theExtension->components().get().componentFile().end(); it ++) {
if ((*it).TopLevel() == true) {
QFileInfo componentFileInfo(this->xmlFileName.path(), QString((*it).file().get().c_str()));
std::auto_ptr<Component> comp = moduleml::component(componentFileInfo.absoluteFilePath().toStdString(), xml_schema::flags::dont_validate);
std::auto_ptr<Component> comp = coreschema::component(componentFileInfo.absoluteFilePath().toStdString(), xml_schema::flags::dont_validate);
outc << " new " << comp->classNames().componentClass().c_str() << "(fileName);" << endl;
}
}
......
......@@ -5,13 +5,13 @@
#include <QFileInfo>
#include <QDir>
// Includes from moduleml
// Includes from coreschema
#include <Extension.hxx>
#ifndef EXTENSIONGENERATOR_H
#define EXTENSIONGENERATOR_H
using namespace moduleml;
using namespace coreschema;
......
......@@ -14,7 +14,7 @@
#include <QDesktopServices>
using namespace moduleml;
using namespace coreschema;
ExtensionWindow::ExtensionWindow(QMainWindow * dad, QString workingDirectory, ExtTypeType extType) : QMainWindow(dad)
{
......@@ -55,7 +55,7 @@ void ExtensionWindow::addExtTypeFile(QString extTypeFileName) {
RemovableLineEdit * extTypeLine = new RemovableLineEdit(this);
switch (this->extType) {
case ExtTypeType::Component:
case Component:
extTypeLine->ui.TopLevelRadioButton->show();
if (this->extTypeFiles.empty()) {
extTypeLine->ui.TopLevelRadioButton->setChecked(true);
......@@ -81,7 +81,7 @@ void ExtensionWindow::addExtTypeFile(QString extTypeFileName) {
void ExtensionWindow::addExtFileButtonClicked() {
RemovableLineEdit * fileExt;
switch(this->extType) {
case ExtTypeType::Component:
case Component:
fileExt = new RemovableLineEdit(this);
fileExt->ui.dotLabel->show();
fileExt->ui.lineEdit->setText("example");
......@@ -168,7 +168,7 @@ void ExtensionWindow::okClicked() {
Extension::name_type name(ui.extensionNameLineEdit->text().toStdString());
Extension::description_type description(ui.extensionDescriptionPlainTextEdit->toPlainText().toStdString());
Extension::extensionClass_type extensionClass(ui.extensionClassNameLineEdit->text().toStdString());
moduleml::Extension ext(name, description, extensionClass);
coreschema::Extension ext(name, description, extensionClass);
Components::componentExtension_sequence fileExtSeq;
Actions myActions;
......
......@@ -22,7 +22,7 @@ int main(int argc, char * argv[])
}
else {
std::cout << "Usage: " << std::endl;
std::cout << "wizard xmlFileName.xm pathToDevelopmentDirectory" << std::endl;
std::cout << "wizard xmlFileName.xml pathToDevelopmentDirectory" << std::endl;
}
return 0;
......
......@@ -35,7 +35,7 @@ void NewbieWindow::actionButtonClicked() {
int ret = QMessageBox::warning(this, tr("Before going further..."), tr("Please select a valid development directory\n"));
return;
}
ExtensionWindow * win = new ExtensionWindow(this, ui.devDirectoryLineEdit->text(), ExtTypeType::Action);
ExtensionWindow * win = new ExtensionWindow(this, ui.devDirectoryLineEdit->text(), Action);
win->show();
this->hide();
// QMessageBox::warning(this, "Newbie Window", "Action Button Clicked");
......@@ -53,7 +53,7 @@ void NewbieWindow::componentButtonClicked() {
return;
}
// QMessageBox::warning(this, "Newbie Window", "Component Button Clicked");
ExtensionWindow * win = new ExtensionWindow(this, ui.devDirectoryLineEdit->text(), ExtTypeType::Component);
ExtensionWindow * win = new ExtensionWindow(this, ui.devDirectoryLineEdit->text(), Component);
win->show();
this->hide();
......
......@@ -23,7 +23,7 @@ if (NOT CAMITK_SOURCE_DIR)
endif()
# find xml2
include(CamiTKFindXml2)
find_package(Xml2 REQUIRED)
set(LML_INCLUDE_DIRECTORIES
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment