diff --git a/CMake/OTBApplicationMacros.cmake b/CMake/OTBApplicationMacros.cmake index 49081c7d3988ea4d298d0ccd78c72b228221a199..65b8ef174bfead276ffb7dba05d56df7ceea7f20 100644 --- a/CMake/OTBApplicationMacros.cmake +++ b/CMake/OTBApplicationMacros.cmake @@ -119,6 +119,19 @@ macro(otb_create_application) CACHE STRING "List of all applications" FORCE) mark_as_advanced(OTB_APPLICATIONS_NAME_LIST) + if(NOT ${APPLICATION_NAME} MATCHES "(TestApplication|ApplicationExample)") + set(descriptor_output_dir "${OTB_BINARY_DIR}/${OTB_INSTALL_DESCR_DIR}") + set(dfile "${descriptor_output_dir}/${APPLICATION_NAME}.txt") + add_custom_command(TARGET "${APPLICATION_TARGET_NAME}" POST_BUILD + COMMAND "$<TARGET_FILE:otbQgisDescriptor>" + "${APPLICATION_NAME}" + "${APPLICATION_BINARY_PATH}" + "${descriptor_output_dir}/" + #COMMENT "./bin/otbQgisDescriptor ${APPLICATION_NAME} ${APPLICATION_BINARY_PATH} ${descriptor_output_dir}" + WORKING_DIRECTORY ${OTB_BINARY_DIR} VERBATIM) + install(FILES ${dfile} DESTINATION ${OTB_INSTALL_DESCR_DIR}) + endif() + endmacro() macro(otb_test_application) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44dbd2b25f3172111f988bf3fe0142a8e53e4c03..0cd6bd3281880893e061f33a5ed66b7c9dd6ff5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,10 @@ if(NOT OTB_INSTALL_PACKAGE_DIR) set(OTB_INSTALL_PACKAGE_DIR "${OTB_INSTALL_LIBRARY_DIR}/cmake/OTB-${OTB_VERSION_MAJOR}.${OTB_VERSION_MINOR}") endif() +if(NOT OTB_INSTALL_DESCR_DIR) + set (OTB_INSTALL_DESCR_DIR "share/otb/description") +endif() + #convert path to native for reconfiguring otbcli.bat.in file(TO_NATIVE_PATH "${OTB_INSTALL_APP_DIR}" OTB_INSTALL_APP_DIR_NATIVE) diff --git a/Modules/Wrappers/QGIS/src/CMakeLists.txt b/Modules/Wrappers/QGIS/src/CMakeLists.txt index ec8a07e7bd2da70c3f31f2efc3af5fc4829f201e..c6c0762ea8231ab95475481d61caed6564ddd6a3 100644 --- a/Modules/Wrappers/QGIS/src/CMakeLists.txt +++ b/Modules/Wrappers/QGIS/src/CMakeLists.txt @@ -21,36 +21,9 @@ add_executable(otbQgisDescriptor otbQgisDescriptor.cxx) target_link_libraries(otbQgisDescriptor ${OTBQgis_LIBRARIES}) otb_module_target(otbQgisDescriptor) -set(dfiles) -set(app_list ${OTB_APPLICATIONS_NAME_LIST}) -list(REMOVE_ITEM app_list "TestApplication") -list(REMOVE_ITEM app_list "ApplicationExample") -list(REMOVE_DUPLICATES app_list) -foreach(otb_app ${app_list}) - set(dfile "${OTB_BINARY_DIR}/descriptors/${otb_app}.txt") - add_custom_command(OUTPUT "${dfile}" - COMMAND "$<TARGET_FILE:otbQgisDescriptor>" - "${otb_app}" "${OTB_BINARY_DIR}/lib/otb/applications" "${OTB_BINARY_DIR}/descriptors/" - DEPENDS otbQgisDescriptor - WORKING_DIRECTORY ${OTB_BINARY_DIR} - COMMENT "./bin/otbQgisDescriptor ${otb_app} ./lib/otb/applications ./descriptors/" - VERBATIM) -list(APPEND dfiles "${dfile}") -endforeach() - -add_custom_target(clean_algs_txt - COMMAND "${CMAKE_COMMAND}" "-E" "remove_directory" "${OTB_BINARY_DIR}/descriptors/" - COMMAND "${CMAKE_COMMAND}" "-E" "remove_directory" "${CMAKE_INSTALL_PREFIX}/descriptors/" - COMMAND "${CMAKE_COMMAND}" "-E" "make_directory" "${OTB_BINARY_DIR}/descriptors/" - COMMAND "${CMAKE_COMMAND}" "-E" "echo" "Generating descriptor files for QGIS" - DEPENDS otbQgisDescriptor - ) - -add_custom_target(generate_qgis_descriptor - COMMAND "${CMAKE_COMMAND}" "-E" "echo" "Installing: ${CMAKE_INSTALL_PREFIX}/descriptors/" - COMMAND "${CMAKE_COMMAND}" "-E" "copy_directory" "${OTB_BINARY_DIR}/descriptors" "${CMAKE_INSTALL_PREFIX}/descriptors" - DEPENDS clean_algs_txt ${dfiles} +add_custom_command(TARGET otbQgisDescriptor + POST_BUILD + COMMAND "${CMAKE_COMMAND}" "-E" "echo" "make_directory ${OTB_BINARY_DIR}/${OTB_INSTALL_DESCR_DIR}/" + COMMAND "${CMAKE_COMMAND}" "-E" "make_directory" "${OTB_BINARY_DIR}/${OTB_INSTALL_DESCR_DIR}/" ) -#otb_module_target_label(generate_qgis_descriptor) - diff --git a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx index 8f482b26443f7e861a6159fb80fa8a0ac04bac3a..820b261c2850fdf032508101c1f7123215d9fc4a 100644 --- a/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx +++ b/Modules/Wrappers/QGIS/src/otbQgisDescriptor.cxx @@ -99,7 +99,6 @@ int main(int argc, char* argv[]) } std::ofstream dFile; dFile.open (output_file, std::ios::out); - std::cerr << "Writing " << output_file << std::endl; std::string output_parameter_name; bool hasRasterOutput = false; @@ -331,13 +330,14 @@ int main(int argc, char* argv[]) dFile << "*QgsProcessingParameterEnum|outputpixeltype|Output pixel type|uint8;int;float;double|False|2|True" << std::endl; } + std::cerr << "[100%] Writing " << output_file << std::endl; dFile.close(); std::ofstream indexFile; indexFile.open (algs_txt, std::ios::out | std::ios::app ); indexFile << group << "|" << module << std::endl; indexFile.close(); - std::cerr << "Updated " << algs_txt << std::endl; + //std::cerr << "Updated " << algs_txt << std::endl; appli = nullptr; ApplicationRegistry::CleanRegistry(); diff --git a/Packaging/install_qgis_bindings.cmake b/Packaging/install_qgis_bindings.cmake index 76fd389e75323b62ecfbb26ddc922c18437f30f0..0a4ae1f797a970a9e671ee0aebe21b02454eadca 100644 --- a/Packaging/install_qgis_bindings.cmake +++ b/Packaging/install_qgis_bindings.cmake @@ -20,7 +20,7 @@ function(install_qgis_bindings) if(HAVE_QGIS) - install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/descriptors + install(DIRECTORY ${SUPERBUILD_INSTALL_DIR}/share/otb/description DESTINATION ${PKG_STAGE_DIR}) endif() endfunction()