From d98637444f62d80624e5b8de4e982a570195fdc2 Mon Sep 17 00:00:00 2001 From: fmessmer Date: Mon, 30 Jul 2018 16:07:40 +0200 Subject: [PATCH 1/3] set project-dir to build space --- cmake/rosjava.cmake.em | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cmake/rosjava.cmake.em b/cmake/rosjava.cmake.em index 87cf7cd..7f84616 100644 --- a/cmake/rosjava.cmake.em +++ b/cmake/rosjava.cmake.em @@ -84,10 +84,11 @@ macro(catkin_rosjava_setup) ################################### # Execution ################################### + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-${PROJECT_NAME} ALL #COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} "env" "|" "grep" "ROS" - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} ${gradle_tasks} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src VERBATIM COMMENT "Gradling tasks for ${PROJECT_NAME}" ) @@ -108,9 +109,10 @@ macro(catkin_rosjava_setup) if(NOT TARGET gradle-clean) add_custom_target(gradle-clean) endif() + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-clean-${PROJECT_NAME} COMMAND ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src COMMENT "Cleaning gradle project for ${PROJECT_NAME}" ) add_dependencies(gradle-clean gradle-clean-${PROJECT_NAME}) @@ -130,10 +132,11 @@ macro(catkin_android_setup) else() set(gradle_tasks ${ARGV}) endif() + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-${PROJECT_NAME} ALL - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_tasks} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src VERBATIM ) catkin_package_xml() @@ -146,9 +149,10 @@ macro(catkin_android_setup) if(NOT TARGET gradle-clean) add_custom_target(gradle-clean) endif() + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-clean-${PROJECT_NAME} COMMAND ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ) add_dependencies(gradle-clean gradle-clean-${PROJECT_NAME}) endmacro() From 905fce833e6cf291435601ad85249911e2d5a26a Mon Sep 17 00:00:00 2001 From: fmessmer Date: Mon, 30 Jul 2018 17:45:53 +0200 Subject: [PATCH 2/3] set project-cache-dir to build space --- cmake/rosjava.cmake.em | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/rosjava.cmake.em b/cmake/rosjava.cmake.em index 7f84616..1d4dcc9 100644 --- a/cmake/rosjava.cmake.em +++ b/cmake/rosjava.cmake.em @@ -87,7 +87,7 @@ macro(catkin_rosjava_setup) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-${PROJECT_NAME} ALL #COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} "env" "|" "grep" "ROS" - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src/.gradle -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src VERBATIM COMMENT "Gradling tasks for ${PROJECT_NAME}" @@ -135,7 +135,7 @@ macro(catkin_android_setup) file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-${PROJECT_NAME} ALL - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src/.gradle -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src VERBATIM ) From 70fdb038d6e1a52706f150fcc448622588a812fb Mon Sep 17 00:00:00 2001 From: fmessmer Date: Mon, 30 Jul 2018 20:42:18 +0200 Subject: [PATCH 3/3] simplify macros --- cmake/rosjava.cmake.em | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/cmake/rosjava.cmake.em b/cmake/rosjava.cmake.em index 1d4dcc9..2a90eda 100644 --- a/cmake/rosjava.cmake.em +++ b/cmake/rosjava.cmake.em @@ -84,11 +84,10 @@ macro(catkin_rosjava_setup) ################################### # Execution ################################### - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-${PROJECT_NAME} ALL #COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} "env" "|" "grep" "ROS" - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src/.gradle -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} ${gradle_options} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/.gradle -PbuildDir=${PROJECT_BINARY_DIR} ${gradle_tasks} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} VERBATIM COMMENT "Gradling tasks for ${PROJECT_NAME}" ) @@ -109,10 +108,9 @@ macro(catkin_rosjava_setup) if(NOT TARGET gradle-clean) add_custom_target(gradle-clean) endif() - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-clean-${PROJECT_NAME} COMMAND ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} clean - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Cleaning gradle project for ${PROJECT_NAME}" ) add_dependencies(gradle-clean gradle-clean-${PROJECT_NAME}) @@ -132,11 +130,10 @@ macro(catkin_android_setup) else() set(gradle_tasks ${ARGV}) endif() - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-${PROJECT_NAME} ALL - COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src/.gradle -PbuildDir=${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src ${gradle_tasks} - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src + COMMAND ${ROSJAVA_ENV} ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} --project-dir ${CMAKE_CURRENT_SOURCE_DIR} --project-cache-dir ${PROJECT_BINARY_DIR}/.gradle -PbuildDir=${PROJECT_BINARY_DIR} ${gradle_tasks} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} VERBATIM ) catkin_package_xml() @@ -149,10 +146,9 @@ macro(catkin_android_setup) if(NOT TARGET gradle-clean) add_custom_target(gradle-clean) endif() - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src) add_custom_target(gradle-clean-${PROJECT_NAME} COMMAND ${CATKIN_ENV} ${${PROJECT_NAME}_gradle_BINARY} clean - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-src + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} ) add_dependencies(gradle-clean gradle-clean-${PROJECT_NAME}) endmacro()