Commit 2b559b79 authored by Stéphane Albert's avatar Stéphane Albert

COMP: Fixed generation of fr_FR.ts (compile-time errors due to .h files at...

COMP: Fixed generation of fr_FR.ts (compile-time errors due to .h files at different place than .cxx files).
parent 76779f20
#
# Reset Qt I18N source files cache variable.
macro( reset_qt4_i18n_sources )
set( OTB_QT_I18N_INCLUDE_PATH "" CACHE INTERNAL "" FORCE )
set( OTB_QT_I18N_HEADER_FILES "" CACHE INTERNAL "" FORCE )
set( OTB_QT_I18N_SOURCE_FILES "" CACHE INTERNAL "" FORCE )
set( OTB_QT_I18N_FORM_FILES "" CACHE INTERNAL "" FORCE )
endmacro()
# string( REPLACE ".cxx" ".h" OTB_QT_I18N_HEADER_FILES OTB_QT_I18N_SOURCE_FILES )
# string( REPLACE ".cxx" ".ui" OTB_QT_I18N_HEADER_FILES OTB_QT_I18N_SOURCE_FILES )
#
# Add source files to Qt I18n translation build.
macro( add_to_qt4_i18n_sources SOURCE_FILES )
foreach( SOURCE_FILE ${ARGV} )
get_filename_component( ABS_SOURCE_FILE ${SOURCE_FILE} ABSOLUTE )
# Func
function( add_to_qt4_i18n_files RESULT )
foreach( F ${ARGN} )
message( "${F}" )
set( OTB_QT_I18N_SOURCE_FILES
${OTB_QT_I18N_SOURCE_FILES} ${ABS_SOURCE_FILE}
get_filename_component( ABS_FILE ${F} ABSOLUTE )
set( ${RESULT}
"${${RESULT}} ${ABS_FILE}"
CACHE INTERNAL "" FORCE
)
endforeach()
endfunction()
#
#
macro( add_to_qt4_i18n_include_path DIRECTORY )
set( OTB_I18N_INCLUDE_PATH
"${OTB_I18N_INCLUDE_PATH} ${DIRECTORY}"
CACHE INTERNAL "" FORCE
)
endmacro()
#
#
macro( add_to_qt4_i18n_headers INCLUDE_DIR )
get_filename_component( ABS_INCLUDE_DIR ${INCLUDE_DIR} ABSOLUTE )
set( OTB_QT_I18N_INCLUDE_PATH
"${OTB_QT_I18N_INCLUDE_PATH} ${ABS_INCLUDE_DIR}"
CACHE INTERNAL "" FORCE
)
foreach( F ${ARGN} )
string( REPLACE ".cxx" ".h" HEADER ${F} )
list( APPEND HEADERS ${HEADER} )
endforeach()
message( "HEADERS=${HEADERS}" )
foreach( F ${HEADERS} )
message( "F=${F}" )
set( ABS_FILE "${ABS_INCLUDE_DIR}/${F}" )
if( EXISTS ${ABS_FILE} )
set( OTB_QT_I18N_HEADER_FILES
"${OTB_QT_I18N_HEADER_FILES} ${ABS_FILE}"
CACHE INTERNAL "" FORCE
)
endif()
endforeach()
endmacro()
#
# Add source files to Qt I18n translation build.
macro( add_to_qt4_i18n_sources )
add_to_qt4_i18n_files( OTB_QT_I18N_SOURCE_FILES ${ARGN} )
endmacro()
#
# Add source files to Qt I18n translation build.
macro( add_to_qt4_i18n_forms )
add_to_qt4_i18n_files( OTB_QT_I18N_FORM_FILES ${ARGN} )
endmacro()
#
#
macro( generate_qt4_project TRANSLATIONS FILENAME )
message( STATUS "Generating Qt4 '${FILENAME}' project file for I18N." )
file( WRITE
${FILENAME}
"# OTB autogenerated .pro file needed to generate Qt I18N translations
INCLUDEPATH = ${OTB_QT_I18N_INCLUDE_PATH}
HEADERS = ${OTB_QT_I18N_HEADER_FILES}
SOURCES = ${OTB_QT_I18N_SOURCE_FILES}
FORMS = ${OTB_QT_I18N_FORM_FILES}
TRANSLATIONS = ${TRANSLATIONS}"
)
endmacro()
......@@ -47,6 +47,8 @@ qt4_add_resources( OTBMapla_RESOURCES_RCC ${OTBMapla_RESOURCES} )
#############################################################################
add_to_qt4_i18n_sources( ${OTBMapla_SRCS} )
add_to_qt4_i18n_headers( "../include" ${OTBMapla_SRCS} )
add_to_qt4_i18n_forms( ${OTBMapla_FORMS} )
##########################[Mapla library]####################################
add_library( OTBMapla
......
......@@ -30,6 +30,8 @@ qt4_add_resources( OTBMonteverdi_RESOURCES_RCC ${OTBMonteverdi_RESOURCES} )
#############################################################################
add_to_qt4_i18n_sources( ${OTBMonteverdi_SRCS} )
add_to_qt4_i18n_headers( "../include" ${OTBMonteverdi_SRCS} )
add_to_qt4_i18n_forms( ${OTBMonteverdi_FORMS} )
#############################################################################
add_library( OTBMonteverdi
......
......@@ -71,6 +71,7 @@ endif()
#############################################################################
add_to_qt4_i18n_sources( ${OTBMonteverdiCore_SRCS} )
add_to_qt4_i18n_headers( "../include" ${OTBMonteverdiCore_SRCS} )
#############################################################################
qt4_wrap_cpp( OTBMonteverdiCore_SRC_MOC ${OTBMonteverdiCore_HEADERS_MOC} )
......
......@@ -157,6 +157,8 @@ qt4_add_resources( OTBMonteverdiGUI_RESOURCES_RCC ${OTBMonteverdiGUI_RESOURCES}
#############################################################################
add_to_qt4_i18n_sources( ${OTBMonteverdiGUI_SRCS} )
add_to_qt4_i18n_headers( "../include" ${OTBMonteverdiGUI_SRCS} )
add_to_qt4_i18n_forms( ${OTBMonteverdiGUI_FORMS} )
#############################################################################
add_library( OTBMonteverdiGUI
......
......@@ -26,8 +26,12 @@ if( OTBQt4_ENABLED )
message( STATUS "Qt I18N source files: " ${OTB_QT_I18N_SOURCE_FILES} )
set( OTB_QT_I18N_PRO "${CMAKE_CURRENT_BINARY_DIR}/i18n.pro" )
generate_qt4_project( ${OTB_TS_TRANSLATIONS} ${OTB_QT_I18N_PRO} )
qt4_create_translation( OTB_QM_TRANSLATIONS
${OTB_QT_I18N_SOURCE_FILES}
${OTB_QT_I18N_PRO}
${OTB_TS_TRANSLATIONS}
)
......
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