Skip to content
Snippets Groups Projects
Commit a10faf3b authored by Fernando Herrero's avatar Fernando Herrero
Browse files

Add submodule check/init and make target. Move and rename privileges.sh script...

Add submodule check/init and make target. Move and rename privileges.sh script to /scripts/set_example_privileges.sh.
parent d0c1f027
No related branches found
No related tags found
No related merge requests found
...@@ -96,4 +96,4 @@ ELSE(UNIX) ...@@ -96,4 +96,4 @@ ELSE(UNIX)
COMMENT "packaging only implemented in unix" COMMENT "packaging only implemented in unix"
TARGET uninstall TARGET uninstall
) )
ENDIF(UNIX) ENDIF(UNIX)
\ No newline at end of file
echo "battery_monitor_test: setting example privileges (needs sudo)"
sudo chown root:audio bin/battery_monitor_test sudo chown root:audio bin/battery_monitor_test
sudo chmod u+s bin/battery_monitor_test sudo chmod u+s bin/battery_monitor_test
\ No newline at end of file
...@@ -35,3 +35,28 @@ INSTALL(FILES ../scripts/unbind_ftdi_udev.sh ...@@ -35,3 +35,28 @@ INSTALL(FILES ../scripts/unbind_ftdi_udev.sh
DESTINATION share/iri/${PROJECT_NAME}/scripts DESTINATION share/iri/${PROJECT_NAME}/scripts
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ)
ADD_SUBDIRECTORY(examples) ADD_SUBDIRECTORY(examples)
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()
SET(firmware_dir avr8_smbus_battery_monitor)
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${firmware_dir}/Makefile")
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()
add_custom_target(firmware ALL COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../${firmware_dir}
)
...@@ -4,6 +4,6 @@ ADD_EXECUTABLE(battery_monitor_test battery_monitor_test.cpp) ...@@ -4,6 +4,6 @@ ADD_EXECUTABLE(battery_monitor_test battery_monitor_test.cpp)
TARGET_LINK_LIBRARIES(battery_monitor_test battery_monitor) TARGET_LINK_LIBRARIES(battery_monitor_test battery_monitor)
add_custom_command(TARGET battery_monitor_test POST_BUILD add_custom_command(TARGET battery_monitor_test POST_BUILD
COMMAND sh ./privileges.sh COMMAND sh ./scripts/set_example_privileges.sh
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment