Commit 0ac58c8d authored by jcarpent's avatar jcarpent
Browse files

[cmake] Add new macro to create tree of src files in IDE e.g. Xcode, Qt Creator, etc

parent 500ee4c4
MACRO (ADD_HEADERS_GROUP NAME LIST_OF_FILES)
SOURCE_GROUP ( "Header Files\\${NAME}" FILES ${${LIST_OF_FILES}} )
ENDMACRO (ADD_HEADERS_GROUP)
MACRO(ADD_GROUP GROUP_NAME FILENAMES)
FOREACH(filename ${${FILENAMES}})
GET_FILENAME_COMPONENT(filenamePath ${filename} PATH)
IF(NOT (filenamePath STREQUAL ""))
STRING(REGEX REPLACE "/" "\\\\" filenamePath ${filenamePath})
SOURCE_GROUP("${GROUP_NAME}\\${filenamePath}" FILES ${filename})
ELSE()
SOURCE_GROUP("${GROUP_NAME}" FILES ${filename})
ENDIF()
ENDFOREACH()
ENDMACRO(ADD_GROUP)
MACRO (ADD_HEADERS_SUB_GROUP GROUP SUB_GROUP LIST_OF_FILES)
SOURCE_GROUP ( "Header Files\\${GROUP}\\${SUB_GROUP}" FILES ${${LIST_OF_FILES}} )
ENDMACRO (ADD_HEADERS_SUB_GROUP)
MACRO(ADD_HEADER_GROUP FILENAMES)
ADD_GROUP("Header Files" ${FILENAMES})
ENDMACRO(ADD_HEADER_GROUP FILENAMES)
MACRO(ADD_SOURCE_GROUP FILENAMES)
ADD_GROUP("Source Files" ${FILENAMES})
ENDMACRO(ADD_SOURCE_GROUP FILENAMES)
MACRO (ADD_SOURCES_GROUP NAME LIST_OF_FILES)
SOURCE_GROUP ( "Source Files\\${NAME}" FILES ${${LIST_OF_FILES}} )
ENDMACRO (ADD_SOURCES_GROUP)
# ----------------------------------------------------
# --- PYTHON -----------------------------------------
......@@ -77,20 +86,12 @@ IF (UNIX )
ADD_LIBRARY ( ${PROJECT_NAME} SHARED ${HEADERS} ${${PROJECT_NAME}_SOURCES} )
SET_TARGET_PROPERTIES( ${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
ADD_HEADERS_GROUP ("math" ${PROJECT_NAME}_MATH_HEADERS )
ADD_HEADER_GROUP(HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)
# Install target libpinocchio.so
INSTALL(FILES
"${CMAKE_BINARY_DIR}/src/lib${PROJECT_NAME}.so"
DESTINATION ${CMAKE_INSTALL_LIBDIR})
ADD_HEADERS_GROUP ("tools" ${PROJECT_NAME}_TOOLS_HEADERS )
ADD_HEADERS_GROUP ("spatial" ${PROJECT_NAME}_SPATIAL_HEADERS )
ADD_HEADERS_GROUP ("multibody" ${PROJECT_NAME}_MULTIBODY_HEADERS )
ADD_HEADERS_SUB_GROUP ("multibody" "joint" ${PROJECT_NAME}_MULTIBODY_JOINT_HEADERS )
ADD_HEADERS_SUB_GROUP ("multibody" "parser" ${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS )
ADD_HEADERS_GROUP ("algorithm" ${PROJECT_NAME}_ALGORITHM_HEADERS )
ADD_HEADERS_GROUP ("simulation" ${PROJECT_NAME}_SIMULATION_HEADERS )
ADD_HEADERS_GROUP ("python" ${PROJECT_NAME}_PYTHON_HEADERS )
ENDIF ( )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment