diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..96624440 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,104 @@ +# http://ros.org/doc/groovy/api/catkin/html/user_guide/supposed.html +cmake_minimum_required(VERSION 2.8.3) +project(euslisp) + +find_package(catkin) + +# check arch and os +execute_process(COMMAND bash -c "gcc -dumpmachine" OUTPUT_VARIABLE gcc_dump_machine OUTPUT_STRIP_TRAILING_WHITESPACE) +message("-- gcc dumpmachine returns ${gcc_dump_machine}") +if(gcc_dump_machine MATCHES "x86_64-linux-.*" OR gcc_dump_machine MATCHES "x86_64-redhat-linux") + set(ARCHDIR "Linux64") + set(MAKEFILE "Makefile.Linux64") +elseif(gcc_dump_machine MATCHES "i686-linux-.*" OR gcc_dump_machine MATCHES "i686-redhat-linux") + set(ARCHDIR "Linux") + set(MAKEFILE "Makefile.Linux.thread") +elseif(gcc_dump_machine MATCHES "arm.*-.*") + set(ARCHDIR "LinuxARM") + set(MAKEFILE "Makefile.LinuxARM") +elseif(gcc_dump_machine MATCHES "aarch64.*-.*") + set(ARCHDIR "LinuxARM") + set(MAKEFILE "Makefile.LinuxARM") +elseif(gcc_dump_machine MATCHES "cygwin.*-.*") + set(ARCHDIR "Cygwin") + set(MAKEFILE "Makefile.Cygwin") +elseif(gcc_dump_machine MATCHES ".*darwin.*") + set(ARCHDIR "Darwin") + set(MAKEFILE "Makefile.Darwin") +else() + message(FATAL_ERROR "-- -- This machine is not supported") +endif() + +# build euslisp +add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/lisp/Makefile + COMMAND cmake -E create_symlink ${MAKEFILE} Makefile + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/lisp/) +add_custom_target(compile_euslisp ALL + DEPENDS ${PROJECT_SOURCE_DIR}/lisp/Makefile + COMMAND export EUSDIR=${PROJECT_SOURCE_DIR} lt_cv_sys_lib_dlsearch_path_spec=${lt_cv_sys_lib_dlsearch_path_spec} LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/${ARCHDIR}/lib:\$LD_LIBRARY_PATH && \$\(MAKE\) -C ${PROJECT_SOURCE_DIR}/lisp -f Makefile EUSRPATH=) + +add_custom_target(install_euslisp + COMMAND export EUSDIR=${PROJECT_SOURCE_DIR} lt_cv_sys_lib_dlsearch_path_spec=${lt_cv_sys_lib_dlsearch_path_spec} LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/${ARCHDIR}/lib:\$LD_LIBRARY_PATH && ${CMAKE_COMMAND} -E make_directory \${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin && \$\(MAKE\) -C ${PROJECT_SOURCE_DIR}/lisp -f Makefile install PUBBINDIR=\${DESTDIR}${CMAKE_INSTALL_PREFIX}/bin) + +install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} --build . --target install_euslisp)") +install(DIRECTORY contrib lib lisp models ${ARCHDIR} + DESTINATION share/euslisp/jskeus/eus/ + USE_SOURCE_PERMISSIONS) +install(DIRECTORY doc + DESTINATION share/euslisp/jskeus/eus/ + USE_SOURCE_PERMISSIONS + PATTERN "doc/html" EXCLUDE + PATTERN "doc/mails" EXCLUDE + PATTERN "doc/hirukawa" EXCLUDE + PATTERN "doc/help.cltl" EXCLUDE + PATTERN "doc/publications" EXCLUDE + PATTERN "doc/latex/fig" EXCLUDE + PATTERN "doc/jlatex/fig" EXCLUDE + ) +install(FILES package.xml DESTINATION share/euslisp/) +install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink lisp/c include WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/share/euslisp/jskeus/eus/)") + +catkin_package(CFG_EXTRAS euslisp-extras.cmake) +catkin_add_env_hooks(99.euslisp SHELLS sh DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/env-hooks) + +string(REGEX MATCH "catkin" need_catkin "$ENV{_}") +get_filename_component(install_dir_name ${CMAKE_INSTALL_PREFIX} NAME) +if(need_catkin AND NOT install_dir_name MATCHES "install") # check if install_prefix end with /install, we can remove this section of we remove all rosrun euslisp ... usage + install(CODE " +## this is tricky force write catkin marker file +set(_catkin_marker_file \"\${CMAKE_INSTALL_PREFIX}/.catkin\") +# check if the develspace marker file exists yet +if(EXISTS \${_catkin_marker_file}) + file(READ \${_catkin_marker_file} _existing_sourcespaces) + if(_existing_sourcespaces STREQUAL \"\") + # write this sourcespace to the marker file + set(_catkin_marker_file_content \" ${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}\") # head space is necessary because it is converted to semicolon. + separate_arguments(_catkin_marker_file_content) + file(APPEND \${_catkin_marker_file} \"${_catkin_marker_file_content}\") + else() + # append to existing list of sourcespaces if it's not in the list + list(FIND _existing_sourcespaces \"${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}\" _existing_sourcespace_index) + if(_existing_sourcespace_index EQUAL -1) + set(_catkin_marker_file_content \" ${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}\") # head space is necessary because it is converted to semicolon. + separate_arguments(_catkin_marker_file_content) + file(APPEND \${_catkin_marker_file} \"${_catkin_marker_file_content}\") + endif() + endif() +else() + # create a new develspace marker file + # NOTE: extra care must be taken when running multiple catkin jobs in parallel + # so that this does not overwrite the result of a similar call in another package + set(_catkin_marker_file_content \" ${CMAKE_INSTALL_PREFIX}/${CATKIN_PACKAGE_SHARE_DESTINATION}\") # head space is necessary because it is converted to semicolon. + separate_arguments(_catkin_marker_file_content) + file(APPEND \${_catkin_marker_file} \"${_catkin_marker_file_content}\") +endif() +") +else() + install(CODE " +file(GLOB catkin_install_files \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/*.py \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/setup.* \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/env.* \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/.ros* \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/.catkin*) +foreach(file \${catkin_install_files}) + message(\"Removing: \${file}\") + file(REMOVE \${file}) +endforeach() +") +endif() diff --git a/cmake/euslisp-extras.cmake.in b/cmake/euslisp-extras.cmake.in new file mode 100644 index 00000000..b07f5f52 --- /dev/null +++ b/cmake/euslisp-extras.cmake.in @@ -0,0 +1,7 @@ +# euslisp.cmake +set(EUSDIR @CMAKE_INSTALL_PREFIX@/share/euslisp/jskeus/eus) +set(ARCHDIR @ARCHDIR@) +set(euslisp_INCLUDE_DIRS ${EUSDIR}/include) +message("-- set EUSDIR to ${EUSDIR}") +message("-- set ARCHDIR to ${ARCHDIR}") + diff --git a/env-hooks/99.euslisp.sh.in b/env-hooks/99.euslisp.sh.in new file mode 100644 index 00000000..c8dcd935 --- /dev/null +++ b/env-hooks/99.euslisp.sh.in @@ -0,0 +1,5 @@ +export ARCHDIR=@ARCHDIR@ +export EUSDIR="@CMAKE_INSTALL_PREFIX@/share/euslisp/jskeus/eus/" +export LD_LIBRARY_PATH=$EUSDIR/$ARCHDIR/lib:$LD_LIBRARY_PATH +export PATH=$EUSDIR/$ARCHDIR/bin:$PATH + diff --git a/package.xml b/package.xml new file mode 100644 index 00000000..f7ee5640 --- /dev/null +++ b/package.xml @@ -0,0 +1,42 @@ + + euslisp + 9.24.0 + EusLisp is an integrated programming system for the + research on intelligent robots based on Common Lisp and + Object-Oriented programming + Kei Okada + + BSD + + http://euslisp.github.io/EusLisp/manual.html + https://github.com/euslisp/EusLisp/issues + + Toshihiro Matsui + + catkin + + opengl + libjpeg + libx11-dev + libxext + libpng-dev + libpq-dev + cmake_modules + mk + xfonts-100dpi + xfonts-75dpi + + opengl + libjpeg + libx11-dev + libxext + libpng-dev + libpq-dev + xfonts-100dpi + xfonts-75dpi + + + + cmake + +