diff --git a/eus_assimp/CMakeLists.txt b/eus_assimp/CMakeLists.txt index 490acd269..f43d32fdc 100644 --- a/eus_assimp/CMakeLists.txt +++ b/eus_assimp/CMakeLists.txt @@ -1,3 +1,7 @@ +if(NOT USE_ROSBUILD) + include(catkin.cmake) + return() +endif() cmake_minimum_required(VERSION 2.4.6) include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) @@ -23,12 +27,16 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) include (FindPkgConfig) pkg_check_modules (SDLIMG SDL_image) +rosbuild_find_ros_package(assimp_devel) +set(ENV{PKG_CONFIG_PATH} ${assimp_devel_PACKAGE_PATH}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}) +pkg_check_modules(assimpdevel assimp_devel REQUIRED) + #common commands for building c++ executables and libraries rosbuild_find_ros_package(euslisp) # for using convex decomposition in openrave/3rdparty rosbuild_find_ros_package(openrave) -include_directories(/usr/include /usr/X11R6/include ${euslisp_PACKAGE_PATH}/jskeus/eus/include ${openrave_PACKAGE_PATH}/openrave_git/3rdparty/convexdecomposition ${SDLIMG_INCLUDE_DIRS}) -link_directories ("${openrave_PACKAGE_PATH}/build/3rdparty/convexdecomposition") +include_directories(/usr/include /usr/X11R6/include ${euslisp_PACKAGE_PATH}/jskeus/eus/include ${openrave_PACKAGE_PATH}/openrave_git/3rdparty/convexdecomposition ${SDLIMG_INCLUDE_DIRS} ${assimpdevel_INCLUDE_DIRS}) +link_directories ("${openrave_PACKAGE_PATH}/build/3rdparty/convexdecomposition" ${assimpdevel_LIBRARY_DIRS}) rosbuild_add_library(eus_assimp src/eus_assimp.cpp) #rosbuild_add_boost_directories() @@ -38,6 +46,7 @@ if(EXISTS ${openrave_PACKAGE_PATH}/build/3rdparty/convexdecomposition/libconvexd target_link_libraries(eus_assimp convexdecomposition) add_definitions(-DCOMPILE_CONVEX_DECOMPOSITION=1) endif() +target_link_libraries(eus_assimp ${assimpdevel_LIBRARIES}) if(SDLIMG_FOUND) # message(STATUS "SDL_image found") @@ -58,3 +67,7 @@ endif() rosbuild_add_compile_flags(eus_assimp ${COMPILE_FLAGS}) set_target_properties(eus_assimp PROPERTIES PREFIX "" SUFFIX ".so") + +add_dependencies(eus_assimp libassimp_devel) + +set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/euslisp) \ No newline at end of file diff --git a/eus_assimp/Makefile b/eus_assimp/Makefile index b75b928f2..73e8a9171 100644 --- a/eus_assimp/Makefile +++ b/eus_assimp/Makefile @@ -1 +1,2 @@ -include $(shell rospack find mk)/cmake.mk \ No newline at end of file +EXTRA_CMAKE_FLAGS = -DUSE_ROSBUILD:BOOL=1 +include $(shell rospack find mk)/cmake.mk diff --git a/eus_assimp/catkin.cmake b/eus_assimp/catkin.cmake new file mode 100644 index 000000000..b570895e9 --- /dev/null +++ b/eus_assimp/catkin.cmake @@ -0,0 +1,62 @@ +# http://ros.org/doc/groovy/api/catkin/html/user_guide/supposed.html +cmake_minimum_required(VERSION 2.8.3) +project(eus_assimp) + +# Load catkin and all dependencies required for this package +# TODO: remove all from COMPONENTS that are not catkin packages. +find_package(catkin REQUIRED COMPONENTS euslisp) + +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CATKIN_DEVEL_PREFIX}/lib/pkgconfig") + +find_package(PkgConfig) +pkg_check_modules(assimpdevel assimp_devel REQUIRED) +# CATKIN_MIGRATION: removed during catkin migration +# rosbuild_add_boost_directories() +if(EXISTS ${euslisp_SOURCE_DIR}/jskeus) + set(euslisp_PACKAGE_PATH ${euslisp_SOURCE_DIR}) +else() + set(euslisp_PACKAGE_PATH ${euslisp_PREFIX}/share/euslisp) +endif() +message("-- Set euslisp_PACKAGE_PATH to ${euslisp_PACKAGE_PATH}") +set(euslisp_INCLUDE_DIRS ${euslisp_PACKAGE_PATH}/jskeus/eus/include) +message("-- Set euslisp_INCLUDE_DIRS to ${euslisp_INCLUDE_DIRS}") +include_directories(/usr/include /usr/X11R6/include ${euslisp_INCLUDE_DIRS} ${assimpdevel_INCLUDE_DIRS}) +link_directories(${assimpdevel_LIBRARY_DIRS}) +add_library(eus_assimp src/eus_assimp.cpp) + +target_link_libraries(eus_assimp ${assimpdevel_LIBRARIES}) +set_target_properties(eus_assimp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/euslisp) +add_dependencies(eus_assimp libassimp_devel) + +# compile flags +add_definitions(-O2 -Wno-write-strings -Wno-comment) +add_definitions(-Di486 -DLinux -D_REENTRANT -DVERSION='\"9.00\"' -DTHREADED -DPTHREAD -DX11R6_1) +add_definitions('-DREPOVERSION="\\"${REPOVERSION}\\""') +if(${CMAKE_SYSTEM_PROCESSOR} MATCHES amd64* OR + ${CMAKE_SYSTEM_PROCESSOR} MATCHES x86_64* ) + add_definitions(-Dx86_64) +else() + add_definitions(-Di486) +endif() + +if(${CMAKE_SYSTEM_NAME} MATCHES Darwin) + add_definitions(-Dx86_64) + set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -flat_namespace -undefined suppress") +endif() + +set_target_properties(eus_assimp PROPERTIES PREFIX "" SUFFIX ".so") + +## LIBRARIES: libraries you create in this project that dependent projects also need +## CATKIN_DEPENDS: catkin_packages dependent projects also need +## DEPENDS: system dependencies of this project that dependent projects also need +catkin_package( + DEPENDS + CATKIN_DEPENDS # euslisp TODO + INCLUDE_DIRS # TODO include + LIBRARIES assimp_devel # TODO +) + +# install +install(DIRECTORY euslisp + DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} + USE_SOURCE_PERMISSIONS) diff --git a/eus_assimp/euslisp/eus-assimp.l b/eus_assimp/euslisp/eus-assimp.l index ac11a2f2e..5c101000f 100644 --- a/eus_assimp/euslisp/eus-assimp.l +++ b/eus_assimp/euslisp/eus-assimp.l @@ -1,7 +1,7 @@ ;; ;; assimp mesh reader for euslisp ;; -(require :eus-assimp "package://eus_assimp/lib/eus_assimp.so") +(require :eus-assimp "package://eus_assimp/euslisp/eus_assimp.so") (defconstant *aiProcess_CalcTangentSpace* #x1) (defconstant *aiProcess_JoinIdenticalVertices* #x2) diff --git a/eus_assimp/package.xml b/eus_assimp/package.xml new file mode 100644 index 000000000..3eb4cda4b --- /dev/null +++ b/eus_assimp/package.xml @@ -0,0 +1,28 @@ + + eus_assimp + 0.1.0 + eus_assimp + + Yohei Kakiuchi + + BSD + + + + Yohei Kakiuchi + + catkin + + + assimp_devel + + roseus + assimp_devel + + + + + + + + diff --git a/eus_assimp/src/eus_assimp.cpp b/eus_assimp/src/eus_assimp.cpp index 0af414c0d..2170d91a1 100644 --- a/eus_assimp/src/eus_assimp.cpp +++ b/eus_assimp/src/eus_assimp.cpp @@ -1,15 +1,8 @@ -#if 0 -// assimp 2 -#include -#include -#include -#endif - -// assimp 3 -#include -#include -#include -#include +// assimp_devel +#include +#include +#include +#include // convex decomposition #if COMPILE_CONVEX_DECOMPOSITION