Commit 7235f7a7 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@82 ec899d31-69d1-42ba-9299-647d76f65fb3
parent ca1f43e8
project(moduleml)
set(SCHEMA_NAME "coreschema")
project(${SCHEMA_NAME})
cmake_minimum_required(VERSION 2.6)
# Create lib files from xsd
set (XSD_DIR ${moduleml_SOURCE_DIR})
file (GLOB_RECURSE XSD_INPUT_FILES ${XSD_DIR}/ *.xsd)
set (OUTPUT_NAMESPACE moduleml)
#set (XSD_DIR ${CM_SOURCE_DIR})
file (GLOB_RECURSE XSD_INPUT_FILES *.xsd)
# generates headers from scratch
set (XSD_H)
set (XSD_SRCS)
#set (xmlsrcs ${CMAKE_CURRENT_BINARY_DIR}/modulemlsrcs)
foreach(xsdFile ${XSD_INPUT_FILES})
get_filename_component(xsdFileName ${xsdFile} NAME_WE)
message(STATUS "Generating code from ${xsdFileName}")
#Todo: change this !
add_custom_command(OUTPUT ${xmlsrcs}/${xsdFileName}.hxx ${xmlsrcs}/${xsdFileName}1.hxx ${xmlsrcs}/${xsdFileName}.cxx ${xmlsrcs}/${xsdFileName}1.cxx
# add_custom_command(OUTPUT ${xsdOutputFiles}
COMMAND ${XSD_EXECUTABLE}
ARGS cxx-tree --file-per-type --generate-serialization --output-dir ${xmlsrcs} --namespace-map =${OUTPUT_NAMESPACE} ${xsdFile}
# ARGS cxx-tree ${xsdFile}
if (XSD_COMMAND)
set(XSD_COMMAND xsdcxx CACHE STRING "name of the XSD code synthesis compiler")
# generates headers from scratch
foreach(xsdFile ${XSD_INPUT_FILES})
get_filename_component(xsdFileName ${xsdFile} NAME_WE)
message(STATUS "Generating code from ${xsdFileName}")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${xsdFileName}.hxx ${CMAKE_CURRENT_BINARY_DIR}/${xsdFileName}.cxx
COMMAND ${XSD_COMMAND}
ARGS cxx-tree --generate-polymorphic --generate-serialization --namespace-map =${SCHEMA_NAME} --polymorphic-type Method --polymorphic-type Criteria ${xsdFile}
DEPENDS ${xsdFile})
set(XSD_H ${XSD_H} ${xmlsrcs}/${xsdFileName}.hxx ${xmlsrcs}/${xsdFileName}1.hxx)
set(XSD_SRCS ${XSD_SRCS} ${xmlsrcs}/${xsdFileName}.cxx ${xmlsrcs}/${xsdFileName}1.cxx)
endforeach()
set(XSD_H ${XSD_H} ${CMAKE_CURRENT_BINARY_DIR}/${xsdFileName}.hxx)
set(XSD_SRCS ${XSD_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/${xsdFileName}.cxx)
endforeach()
else()
message(FATAL_ERROR "Cannot find xsdcxx command: cannot generate mml from scratch, try with MML_GENERATE_XSD_LIB set to OFF")
set(MML_GENERATE_XSD_LIB OFF)
endif()
include_directories(${XSD_INCLUDE_DIR} ${xmlsrcs})
add_library(moduleml STATIC ${XSD_H} ${XSD_SRCS}) # better use static libs for distributing executables
include_directories(${XSD_INCLUDE_DIR})
add_library(${SCHEMA_NAME} STATIC ${XSD_H} ${XSD_SRCS}) # better use static libs for distributing executables
# TODO is the following line needed?
#target_link_libraries(${SCHEMA_NAME} ${NEEDED_LIBRARIES})
#--------------
# installation
#--------------
export_headers(${XSD_H} COMPONENT ${SCHEMA_NAME})
# lib installation
install(TARGETS ${SCHEMA_NAME}
ARCHIVE DESTINATION lib/${CAMITK_SHORT_VERSION_STRING}
COMPONENT ${SCHEMA_NAME}
)
\ No newline at end of file
Supports Markdown
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