Skip to content

Commit

Permalink
Added support for MacOSX PackageMaker. Now ARGoS can be installed als…
Browse files Browse the repository at this point in the history
…o on Mac.
  • Loading branch information
Carlo Pinciroli committed Mar 27, 2013
1 parent b79181c commit b4ce002
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ configure_file(
#
# Install extra stuff
#
# Configuration file for /etc/ld.so.conf.d/
configure_file(
${CMAKE_SOURCE_DIR}/scripts/argos3.conf.in
${CMAKE_BINARY_DIR}/argos3.conf
@ONLY)
install(FILES ${CMAKE_BINARY_DIR}/argos3.conf DESTINATION /etc/ld.so.conf.d)
if(NOT APPLE)
# Configuration file for /etc/ld.so.conf.d/
configure_file(
${CMAKE_SOURCE_DIR}/scripts/argos3.conf.in
${CMAKE_BINARY_DIR}/argos3.conf
@ONLY)
install(FILES ${CMAKE_BINARY_DIR}/argos3.conf DESTINATION /etc/ld.so.conf.d)
endif(NOT APPLE)
# Configuration file for pkg-config
configure_file(
${CMAKE_SOURCE_DIR}/scripts/argos3.pc.in
Expand Down
2 changes: 2 additions & 0 deletions src/cmake/ARGoSBuildFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ if(APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup")
set(ARGOS_DYNAMIC_LIBRARY_EXTENSION "dylib")
set(ARGOS_DYNAMIC_LIBRARY_VARIABLE "DYLD_LIBRARY_PATH")
else(APPLE)
# Linux
# Avoid discarding unused symbols to allow plugins to work
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed")
set(ARGOS_DYNAMIC_LIBRARY_EXTENSION "so")
set(ARGOS_DYNAMIC_LIBRARY_VARIABLE "LD_LIBRARY_PATH")
endif(APPLE)
22 changes: 21 additions & 1 deletion src/cmake/ARGoSPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ set(CPACK_PACKAGE_VENDOR "IRIDIA-ULB")
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/../doc/ARGoS_LICENSE.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/../README.asciidoc")
set(CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/README.html")
set(CPACK_STRIP_FILES ON)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${ARGOS_PROCESSOR_ARCH}-${CPACK_PACKAGE_RELEASE}")

Expand All @@ -67,6 +67,26 @@ set(CPACK_RPM_PACKAGE_REQUIRES "gcc >= 4.2, gcc-c++ >= 4.2, cmake >= 2.6, gsl >=
set(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_HOMEPAGE})
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/scripts/argos_post_install.sh")

#
# Configuration for OSX Package Manager
#
if(APPLE)
configure_file(${CMAKE_SOURCE_DIR}/scripts/argos3_macos_wrapper.sh.in
${CMAKE_BINARY_DIR}/core/argos3_macos_wrapper.sh
@ONLY)
configure_file(${CMAKE_SOURCE_DIR}/scripts/macos_uninstall_argos3.sh.in
${CMAKE_BINARY_DIR}/macos_uninstall_argos3.sh
@ONLY)
install(FILES ${CMAKE_BINARY_DIR}/core/argos3_macos_wrapper.sh
DESTINATION bin/
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
RENAME argos3)
install(FILES ${CMAKE_BINARY_DIR}/macos_uninstall_argos3.sh
DESTINATION share/argos3/
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
RENAME uninstall_argos3.sh)
endif(APPLE)

#
# Creation of SlackBuild script
#
Expand Down
7 changes: 7 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,15 @@ if(ARGOS_BUILD_FOR_SIMULATOR)
#
# Core ARGoS3 installation
#
if(APPLE)
install(TARGETS argos3
RUNTIME DESTINATION libexec
LIBRARY DESTINATION lib/argos3
ARCHIVE DESTINATION lib/argos3)
else(APPLE)
install(TARGETS argos3
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib/argos3
ARCHIVE DESTINATION lib/argos3)
endif(APPLE)
endif(ARGOS_BUILD_FOR_SIMULATOR)
15 changes: 15 additions & 0 deletions src/scripts/argos3_macos_wrapper.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

# Add path to ARGoS3 libraries to the DYLD_LIBRARY_PATH env variable.
if [ -n "${DYLD_LIBRARY_PATH}" ]; then
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:@CMAKE_INSTALL_PREFIX@/lib/argos3
else
DYLD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib/argos3
fi
export DYLD_LIBRARY_PATH

# Execute argos3 with bash-internal command 'exec', which
# replaces the script with the argos3 executable. In this
# way, there is only one PID and the return value is handled
# correctly.
exec @CMAKE_INSTALL_PREFIX@/libexec/argos3 "$@"
19 changes: 19 additions & 0 deletions src/scripts/macos_uninstall_argos3.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

echo '====================='
echo '= ARGoS Uninstaller ='
echo '====================='
echo
echo 'To complete this operation, you will need administrative privileges.'
echo
read -p 'Press CTRL-C to exit, or any other key to proceed...'
echo
echo -n 'Uninstalling ARGoS3... '
sudo rm -rf @CMAKE_INSTALL_PREFIX@/bin/argos3
sudo rm -rf @CMAKE_INSTALL_PREFIX@/doc/argos3
sudo rm -rf @CMAKE_INSTALL_PREFIX@/include/argos3
sudo rm -rf @CMAKE_INSTALL_PREFIX@/lib/argos3
sudo rm -rf @CMAKE_INSTALL_PREFIX@/lib/pkgconfig/argos3_@[email protected]
sudo rm -rf @CMAKE_INSTALL_PREFIX@/libexec/argos3
sudo rm -rf @CMAKE_INSTALL_PREFIX@/man/man1/argos3.1.gz
sudo rm -rf @CMAKE_INSTALL_PREFIX@/share/argos3
2 changes: 1 addition & 1 deletion src/scripts/setup_env.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

export ARGOS_PLUGIN_PATH=@CMAKE_BINARY_DIR@/core:@CMAKE_BINARY_DIR@/core:@CMAKE_BINARY_DIR@/testing:@CMAKE_BINARY_DIR@/plugins/robots/foot-bot:@CMAKE_BINARY_DIR@/plugins/robots/generic:@CMAKE_BINARY_DIR@/plugins/simulator/visualizations/qt-opengl:@CMAKE_BINARY_DIR@/plugins/simulator/sensors:@CMAKE_BINARY_DIR@/plugins/simulator/entities:@CMAKE_BINARY_DIR@/plugins/simulator/physics_engines/dynamics2d:@CMAKE_BINARY_DIR@/plugins/simulator/actuators

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ARGOS_PLUGIN_PATH}
export @ARGOS_DYNAMIC_LIBRARY_VARIABLE@=${@ARGOS_DYNAMIC_LIBRARY_VARIABLE@}:${ARGOS_PLUGIN_PATH}
2 changes: 1 addition & 1 deletion src/testing/experiment/test_footbot_lua.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- ****************** -->
<!-- * Loop functions * -->
<!-- ****************** -->
<loop_functions label="test_lf" />
<!-- loop_functions label="test_lf" /-->

<!-- *************** -->
<!-- * Controllers * -->
Expand Down

0 comments on commit b4ce002

Please sign in to comment.