プロジェクト

全般

プロフィール

CMake の調査

NSIS を使用した場合の CMakeの構成を調査(gbiggs-templates を調査。)

ディレクトリ調査

 +--<RTC>
    +--cmake
    |  +--Modules
    +--doc
    |  +--content
    +--examples
    |  +--conf
    |  +--<example名>
    +--include
    |  +--<RTC名>
    +--src
    +--test
    +--tools

各ディレクトリには CMakeLists.txt がある。
ディレクトリ名 内容
./cmake cmake.in ファイルを格納
cpack_options.cmake.in
rt_middleware_logo.bmp (または自分のロゴ)
rt_middleware_logo.ico (または自分のロゴ)
<component名>-config-version.cmake.in
<component名>-config.cmake.in
<component名>.pc.in
utils.cmake
uninstall_target.cmake.in
./cmake/Modules Find<package名>.cmake を格納
./idl idlファイルを格納
./include
./include/<package名> 提供するヘッダファイル
./src ソースコード
./doc doxyfile.in を格納 オプション
./doc/content オプション
./examples オプション
./examples/conf rtc.conf ファイル
コンポーネントの設定ファイルの in ファイル
オプション
./examples/<example名> オプション
./test Google C++ Test Framework のテストコードを格納 オプション
./tools オプション

CMakeLists.txt 調査

各ディレクトリには CMakeLists.txt がある。

パッケージ名のディレクトリにある CMakeLists.txt

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(<モジュール名>)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
include(${PROJECT_SOURCE_DIR}/cmake/utils.cmake)
set(PROJECT_VERSION <バージョン> CACHE STRING "<モジュール名> version")
DISSECT_VERSION()
set(PROJECT_DESCRIPTION "<モジュール概要>")
set(PROJECT_VENDOR "<ベンダ名>")

# Add an "uninstall" target
CONFIGURE_FILE ("${PROJECT_SOURCE_DIR}/cmake/uninstall_target.cmake.in" 
    "${PROJECT_BINARY_DIR}/uninstall_target.cmake" IMMEDIATE @ONLY)
ADD_CUSTOM_TARGET (uninstall "${CMAKE_COMMAND}" -P
    "${PROJECT_BINARY_DIR}/uninstall_target.cmake")

# 
option(BUILD_DOCUMENTATION "Build the documentation" ON)
#
option(BUILD_EXAMPLES "Build and install examples" OFF)
option(BUILD_TESTS "Build the tests" OFF)
option(BUILD_TOOLS "Build the tools" OFF)

option(STATIC_LIBS "Build static libraries" OFF)
if(STATIC_LIBS)
    set(LIB_TYPE STATIC)
else(STATIC_LIBS)
    set(LIB_TYPE SHARED)
endif(STATIC_LIBS)

# Set up installation directories
set(BIN_INSTALL_DIR "bin")
set(LIB_INSTALL_DIR "lib")
set(INC_INSTALL_DIR
    "include/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}")
set(SHARE_INSTALL_DIR
    "share/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}")

# Get necessary dependency information
if(STATIC_LIBS)
    set(Boost_USE_STATIC_LIBS ON)
endif(STATIC_LIBS)
find_package(Boost COMPONENTS filesystem system REQUIRED)

# Universal settings
include_directories(${Boost_INCLUDE_DIRS})
enable_testing()

# Subdirectories
add_subdirectory(cmake)
if(BUILD_DOCUMENTATION)
    add_subdirectory(doc)
endif(BUILD_DOCUMENTATION)
if(BUILD_EXAMPLES)
    add_subdirectory(examples)
endif(BUILD_EXAMPLES)
add_subdirectory(include)
add_subdirectory(src)
if(BUILD_TESTS)
    add_subdirectory(test)
endif(BUILD_TESTS)
if(BUILD_TOOLS)
    add_subdirectory(tools)
endif(BUILD_TOOLS)

# Package creation
include(InstallRequiredSystemLibraries)
#set(PROJECT_EXECUTABLES 
#"")
set(cpack_options "${PROJECT_BINARY_DIR}/cpack_options.cmake")
configure_file("${PROJECT_SOURCE_DIR}/cmake/cpack_options.cmake.in" 
    ${cpack_options} @ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${cpack_options})
include(CPack)

./cmake のディレクトリにある CMakeLists.txt

set(PKG_DEPS "openrtm-aist")
set(PKG_LIBS -l${PROJECT_NAME_LOWER})
set(pkg_conf_file ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}.pc)
configure_file(${PROJECT_NAME_LOWER}.pc.in ${pkg_conf_file} @ONLY)
install(FILES ${pkg_conf_file}
    DESTINATION ${LIB_INSTALL_DIR}/pkgconfig/ COMPONENT component)

# Install CMake modules
set(cmake_config ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME_LOWER}-config.cmake.in
    ${cmake_config} @ONLY)
set(cmake_version_config
    ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake.in
    ${cmake_version_config} @ONLY)
set(cmake_mods ${cmake_config} ${cmake_version_config})
install(FILES ${cmake_mods} DESTINATION ${SHARE_INSTALL_DIR} COMPONENT library)

./doc のディレクトリにある CMakeLists.txt

find_package(Doxygen)
if(DOXYGEN_FOUND)
    # Search for Sphinx
    set(SPHINX_PATH "" CACHE PATH
        "Path to the directory containing the sphinx-build program")
    find_program(SPHINX_BUILD sphinx-build PATHS ${SPHINX_PATH})
    if(NOT SPHINX_BUILD)
        message(FATAL_ERROR
            "Sphinx was not found. Set SPHINX_PATH to the directory containing the sphinx-build executable, or disable BUILD_DOCUMENTATION.")
    endif(NOT SPHINX_BUILD)

    set(html_dir "${CMAKE_CURRENT_BINARY_DIR}/html")
    set(doxygen_dir "${html_dir}/doxygen")
    file(MAKE_DIRECTORY ${html_dir})
    file(MAKE_DIRECTORY ${doxygen_dir})

    # Doxygen part
    set(doxyfile "${CMAKE_CURRENT_BINARY_DIR}/doxyfile")
    configure_file(doxyfile.in ${doxyfile})
    add_custom_target(doxygen_doc ${DOXYGEN_EXECUTABLE} ${doxyfile})

    # Sphinx part
    set(conf_dir "${CMAKE_CURRENT_BINARY_DIR}/conf")
    file(MAKE_DIRECTORY "${conf_dir}")
    file(MAKE_DIRECTORY "${conf_dir}/_static")
    set(conf_py "${conf_dir}/conf.py")
    configure_file(conf.py.in ${conf_py})
    add_custom_target(sphinx_doc ALL sphinx-build -b html -c ${conf_dir}
        ${CMAKE_CURRENT_SOURCE_DIR}/content ${CMAKE_CURRENT_BINARY_DIR}/html
        DEPENDS doxygen_doc)
    install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION
        "share/doc/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}" 
        COMPONENT doc)
else(DOXYGEN_FOUND)
    message(FATAL_ERROR
        "Doxygen was not found. Cannot build documentation. Disable BUILD_DOCUMENTATION to continue")
endif(DOXYGEN_FOUND)

./idl のディレクトリにある CMakeLists.txt

set(idls ${CMAKE_CURRENT_SOURCE_DIR}/<IDLファイル名.idl>)

install(FILES ${idls} DESTINATION ${INC_INSTALL_DIR}/idl
    COMPONENT idl)

OPENRTM_COMPILE_IDL_FILES(${PROJECT_BINARY_DIR}/include/${PROJECT_NAME_LOWER}/idl
    ${idls})
set(IDL_ALL_SOURCES ${IDL_ALL_SOURCES} PARENT_SCOPE)
install(FILES ${IDL_ALL_HEADERS}
    DESTINATION ${INC_INSTALL_DIR}/${PROJECT_NAME_LOWER}/idl
    COMPONENT headers)

./include のディレクトリにある CMakeLists.txt

add_subdirectory(<package名>)

./include/<package名> のディレクトリにある CMakeLists.txt

set(hdrs <interface>_impl.h
    <モジュール名>.h)

install(FILES ${hdrs} DESTINATION ${INC_INSTALL_DIR}/${PROJECT_NAME_LOWER}
    COMPONENT library)

./src のディレクトリにある CMakeLists.txt

set(comp_srcs <モジュール名>.cpp)

set(standalone_srcs <モジュール名>Comp.cpp)

include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_BINARY_DIR})
include_directories(${OPENRTM_INCLUDE_DIRS})
add_definitions(${OPENRTM_CFLAGS})

add_library(${PROJECT_NAME_LOWER} ${LIB_TYPE} ${comp_srcs} ${ALL_IDL_SRCS})
set_source_files_properties(${ALL_IDL_SRCS} PROPERTIES GENERATED 1)
add_dependencies(${PROJECT_NAME_LOWER} ALL_IDL_TGT)
target_link_libraries(${PROJECT_NAME_LOWER} ${OPENRTM_LIBRARIES})

add_executable(${PROJECT_NAME_LOWER}_standalone ${standalone_srcs})
target_link_libraries(${PROJECT_NAME_LOWER}_standalone ${PROJECT_NAME_LOWER})

install(TARGETS ${PROJECT_NAME_LOWER} ${PROJECT_NAME_LOWER}_standalone
    EXPORT ${PROJECT_NAME_LOWER}
    RUNTIME DESTINATION ${BIN_INSTALL_DIR} COMPONENT component
    LIBRARY DESTINATION ${LIB_INSTALL_DIR} COMPONENT component
    ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT component)
install(EXPORT ${PROJECT_NAME_LOWER}
    DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME_LOWER}
    FILE ${PROJECT_NAME_LOWER}Depends.cmake)

./examples のディレクトリにある CMakeLists.txt
add_subdirectory(conf)

./examples/conf のディレクトリにある CMakeLists.txt

set(comp_conf_in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME_LOWER}.conf.in)
set(comp_conf ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}.conf)
configure_file(${comp_conf_in} ${comp_conf})

set(example_conf_files rtc.conf
                       ${comp_conf})

install(FILES ${example_conf_files}
    DESTINATION ${SHARE_INSTALL_DIR}/examples/conf COMPONENT examples)

./tests のディレクトリにある CMakeLists.txt

find_package(GTest)
if(NOT GTEST_FOUND)
    message(STATUS "GoogleTest was not found; tests will not be built.")
    return()
endif(NOT GTEST_FOUND)

include_directories(${PROJECT_SOURCE_DIR}/include
    ${PROJECT_BINARY_DIR}/include
    ${GTEST_INCLUDE_DIRS})

set(srcs test_RenameMe.cpp
    )

set(test_consts "${CMAKE_CURRENT_BINARY_DIR}/test_consts.h")
configure_file("test_consts.h.in" ${test_consts})
include_directories(${CMAKE_CURRENT_BINARY_DIR})

add_executable(all_tests ${srcs} ${test_consts})
target_link_libraries(all_tests tide ${Boost_LIBRARIES} ${GTEST_BOTH_LIBRARIES})
if(CMAKE_VERSION VERSION_LESS 2.8.4)
    add_test(AllTests all_tests)
else(CMAKE_VERSION VERSION_LESS 2.8.4)
    add_test(NAME AllTests COMMAND ${CMAKE_CURRENT_BINARY_DIR}/all_tests)
endif(CMAKE_VERSION VERSION_LESS 2.8.4)

./tools のディレクトリにある CMakeLists.txt

Find<package名>.cmake 調査

FindOpenRTM.cmake


# Find OpenRTM-aist
#
# The following additional directories are searched:
# OPENRTM_ROOT (CMake variable)
# OPENRTM_ROOT (Environment variable)
#
# This sets the following variables:
# OPENRTM_FOUND - True if OpenRTM-aist was found.
# OPENRTM_INCLUDE_DIRS - Directories containing the OpenRTM-aist include files.
# OPENRTM_LIBRARIES - Libraries needed to use OpenRTM-aist.
# OPENRTM_CFLAGS - Compiler flags for OpenRTM-aist.
# OPENRTM_VERSION - The version of OpenRTM-aist found.
# OPENRTM_VERSION_MAJOR - The major version of OpenRTM-aist found.
# OPENRTM_VERSION_MINOR - The minor version of OpenRTM-aist found.
# OPENRTM_VERSION_REVISION - The revision version of OpenRTM-aist found.
# OPENRTM_VERSION_CANDIDATE - The candidate version of OpenRTM-aist found.
# OPENRTM_IDL_COMPILER - The IDL compiler used by OpenRTM-aist.
# OPENRTM_IDL_FLAGS - The flags used to compile OpenRTM-aist IDL files.
# OPENRTM_IDL_DIR - The directory containing the OpenRTM-aist IDL files.
#
# This module also defines one macro usable in your CMakeLists.txt files:
# OPENRTM_COMPILE_IDL_FILES(file1 file2 ...)
#   Compiles the specified IDL files, placing the generated C++ source files in
#   ${CMAKE_CURRENT_BINARY_DIR}. The source files can be found in file1_SRCS,
#   file2_SRCS, etc., and all source files for all IDL files are available in
#   ALL_IDL_SRCS. To depend on the generated files, depend on the targets
#   file1_TGT, file2_TGT, etc. The target ALL_IDL_TGT is available to depend on
#   all source files generated from IDL files.

find_package(PkgConfig)
pkg_check_modules(PC_OPENRTM QUIET openrtm-aist)
pkg_check_modules(PC_COIL QUIET libcoil)

find_path(OPENRTM_INCLUDE_DIR rtm/RTC.h
    HINTS ${OPENRTM_ROOT}/include $ENV{OPENRTM_ROOT}/include
    ${PC_OPENRTM_INCLUDE_DIRS})
find_path(COIL_INCLUDE_DIR coil/config_coil.h
    HINTS ${OPENRTM_ROOT}/include $ENV{OPENRTM_ROOT}/include
    ${PC_COIL_INCLUDE_DIRS})
find_library(OPENRTM_LIBRARY RTC
    HINTS ${OPENRTM_ROOT}/lib $ENV{OPENRTM_ROOT}/lib
    ${PC_OPENRTM_LIBRARY_DIRS})
find_library(COIL_LIBRARY coil
    HINTS ${OPENRTM_ROOT}/lib $ENV{OPENRTM_ROOT}/lib
    ${PC_COIL_LIBRARY_DIRS})

set(OPENRTM_CFLAGS ${PC_OPENRTM_CFLAGS_OTHER} ${PC_COIL_CFLAGS_OTHER})
set(OPENRTM_INCLUDE_DIRS ${OPENRTM_INCLUDE_DIR} ${OPENRTM_INCLUDE_DIR}/rtm/idl
    ${COIL_INCLUDE_DIR})
set(OPENRTM_LIBRARIES ${OPENRTM_LIBRARY} ${COIL_LIBRARY} uuid dl pthread
    omniORB4 omnithread omniDynamic4)

file(STRINGS ${OPENRTM_INCLUDE_DIR}/rtm/version.h OPENRTM_VERSION
    NEWLINE_CONSUME)
#set(OPENRTM_VERSION "1.1.0")
string(REGEX MATCH "version = \"([0-9]+)\\.([0-9]+)\\.([0-9]+)-?([a-zA-Z0-9]*)\"" 
    OPENRTM_VERSION "${OPENRTM_VERSION}")
set(OPENRTM_VERSION_MAJOR ${CMAKE_MATCH_1})
set(OPENRTM_VERSION_MINOR ${CMAKE_MATCH_2})
set(OPENRTM_VERSION_REVISION ${CMAKE_MATCH_3})
set(OPENRTM_VERSION_CANDIDATE ${CMAKE_MATCH_4})

execute_process(COMMAND rtm-config --idlc OUTPUT_VARIABLE OPENRTM_IDL_COMPILER
    OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND rtm-config --idlflags OUTPUT_VARIABLE OPENRTM_IDL_FLAGS
    OUTPUT_STRIP_TRAILING_WHITESPACE)
separate_arguments(OPENRTM_IDL_FLAGS)
execute_process(COMMAND rtm-config --prefix OUTPUT_VARIABLE _rtm_prefix
    OUTPUT_STRIP_TRAILING_WHITESPACE)
set(OPENRTM_IDL_DIR
    ${_rtm_prefix}/include/openrtm-${OPENRTM_VERSION_MAJOR}.${OPENRTM_VERSION_MINOR}/rtm/idl
    CACHE STRING "Directory containing the OpenRTM-aist IDL files.")

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenRTM
    REQUIRED_VARS OPENRTM_INCLUDE_DIR COIL_INCLUDE_DIR OPENRTM_LIBRARY
    COIL_LIBRARY OPENRTM_IDL_COMPILER VERSION_VAR ${OPENRTM_VERSION})

macro(_IDL_OUTPUTS _idl _dir _result)
    set(${_result} ${_dir}/${_idl}SK.cc ${_dir}/${_idl}.hh
        ${_dir}/${_idl}DynSK.cc)
endmacro(_IDL_OUTPUTS)

macro(_COMPILE_IDL _idl_file)
    get_filename_component(_idl ${_idl_file} NAME_WE)
    set(_idl_srcs_var ${_idl}_SRCS)
    _IDL_OUTPUTS(${_idl} ${CMAKE_CURRENT_BINARY_DIR} ${_idl_srcs_var})

    add_custom_command(OUTPUT ${${_idl_srcs_var}}
        COMMAND ${OPENRTM_IDL_COMPILER} ${OPENRTM_IDL_FLAGS}
        -I${OPENRTM_IDL_DIR} ${_idl_file}
        WORKING_DIRECTORY ${CURRENT_BINARY_DIR}
        DEPENDS ${_idl_file}
        COMMENT "Compiling ${_idl_file}" VERBATIM)
    add_custom_target(${_idl}_TGT DEPENDS ${${_idl_srcs_var}})
    set(ALL_IDL_SRCS ${ALL_IDL_SRCS} ${${_idl_srcs_var}})
    if(NOT TARGET ALL_IDL_TGT)
        add_custom_target(ALL_IDL_TGT)
    endif(NOT TARGET ALL_IDL_TGT)
    add_dependencies(ALL_IDL_TGT ${_idl}_TGT)
endmacro(_COMPILE_IDL)

# Module exposed to the user
macro(OPENRTM_COMPILE_IDL_FILES)
    foreach(idl ${ARGN})
        _COMPILE_IDL(${idl})
    endforeach(idl)
endmacro(OPENRTM_COMPILE_IDL_FILES)

ツール

Sphinx

http://sphinx-users.jp/gettingstarted/install_windows.html

graphviz

http://graphviz.org/Download..php

breathe

https://github.com/michaeljones/breathe

NSIS

NSIS は exe 形式のインストーラを生成する。
http://www.digzip.com/software/ja/tag/nsis-2-46-setup-exe-%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB/

Google Test

WIX を使用する場合

上記のディレクトリ構成で WIX を使用してパッケージを作成する場合、修正が必要となる。

修正するファイル

  • 修正するファイル
    • ./CMakeLists.txt
    • ./cmake/cpack_options.cmake.in
    • ./doc/CMakeLists.txt
    • ./idl/CMakeLists.txt
    • ./src/CMakeLists.txt
  • 追加するファイル
    • ./cmake/wix.xsl.in

修正内容

  • ./CMakeLists.txt
    @@ -21,6 +21,8 @@
     option(BUILD_DOCUMENTATION "Build the documentation" ON)
     option(BUILD_TESTS "Build the tests" ON)
     option(BUILD_TOOLS "Build the tools" ON)
    +option(BUILD_IDL "Build and install idl" OFF)
    +option(BUILD_SOURCES "Build and install sources" OFF)
    
     option(STATIC_LIBS "Build static libraries" OFF)
     if(STATIC_LIBS)
    @@ -30,18 +32,18 @@
     endif(STATIC_LIBS)
    
     # Set up installation directories
    -set(BIN_INSTALL_DIR "bin")
    -set(LIB_INSTALL_DIR "lib")
    +set(BIN_INSTALL_DIR "components/bin")
    +set(LIB_INSTALL_DIR "components/lib")
     set(INC_INSTALL_DIR
    -    "include/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}")
    +    "components/include/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}")
     set(SHARE_INSTALL_DIR
    -    "share/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}")
    +    "components/share/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}")
    
     # Get necessary dependency information
     if(NOT WIN32)
         list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Modules)
     endif(NOT WIN32)
    -find_package(OpenRTM 1 REQUIRED)
    +find_package(OpenRTM REQUIRED)
    
     # Universal settings
     enable_testing()
    @@ -54,7 +56,9 @@
     if(BUILD_EXAMPLES)
         add_subdirectory(examples)
     endif(BUILD_EXAMPLES)
    -add_subdirectory(idl)
    +if(BUILD_IDL)
    +    add_subdirectory(idl)
    +endif(BUILD_IDL)
     add_subdirectory(include)
     add_subdirectory(src)
     if(BUILD_TESTS)
    @@ -63,6 +67,9 @@
     if(BUILD_TOOLS)
         add_subdirectory(tools)
     endif(BUILD_TOOLS)
    +if(BUILD_SOURCES)
    +    add_subdirectory(src)
    +endif(BUILD_SOURCES)
    
     # Package creation
     include(InstallRequiredSystemLibraries)
    
  • ./cmake/cpack_options.cmake.in
    @@ -4,22 +4,28 @@
     set(CPACK_PACKAGE_VERSION_PATCH "@PROJECT_VERSION_REVISION@")
     set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "@PROJECT_DESCRIPTION@")
     set(CPACK_PACKAGE_VENDOR "@PROJECT_VENDOR@")
    -set(CPACK_PACKAGE_INSTALL_DIRECTORY "@PROJECT_NAME@")
    +set(CPACK_PACKAGE_INSTALL_DIRECTORY "@PROJECT_NAME@@PROJECT_VERSION_MAJOR@@PROJECT_VERSION_MINOR@@PROJECT_VERSION_REVISION@")
     set(CPACK_PACKAGE_FILE_NAME "@PROJECT_NAME@-@PROJECT_VERSION@")
     set(CPACK_RESOURCE_FILE_LICENSE "@PROJECT_SOURCE_DIR@/COPYING.LESSER")
    
    -set(CPACK_COMPONENTS_ALL component headers idl)
    -set(CPACK_COMPONENT_COMPONENT_DISPLAY_NAME "RT-Component")
    +set(CPACK_COMPONENTS_ALL component)
    +set(CPACK_COMPONENT_COMPONENT_DISPLAY_NAME "Applications")
     set(CPACK_COMPONENT_COMPONENT_DESCRIPTION
         "Component library and stand-alone executable")
    -set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Header files")
    -set(CPACK_COMPONENT_HEADERS_DESCRIPTION
    +if(INSTALL_HEADERS)
    +    set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL}  headers)
    +    set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "Header files")
    +    set(CPACK_COMPONENT_HEADERS_DESCRIPTION
         "Header files from the component.")
    -set(CPACK_COMPONENT_HEADERS_DEPENDS component)
    -set(CPACK_COMPONENT_IDL_DISPLAY_NAME "IDL files")
    -set(CPACK_COMPONENT_IDL_DESCRIPTION
    +    set(CPACK_COMPONENT_HEADERS_DEPENDS component)
    +endif(INSTALL_HEADERS)
    +if(INSTALL_IDL)
    +    set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} idl)
    +    set(CPACK_COMPONENT_IDL_DISPLAY_NAME "IDL files")
    +    set(CPACK_COMPONENT_IDL_DESCRIPTION
         "IDL files for the component's services.")
    -set(CPACK_COMPONENT_IDL_DEPENDS component)
    +    set(CPACK_COMPONENT_IDL_DEPENDS component)
    +endif(INSTALL_IDL)
     set(INSTALL_EXAMPLES @BUILD_EXAMPLES@)
     if(INSTALL_EXAMPLES)
         set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} examples)
    @@ -36,8 +42,32 @@
             "Component documentation")
         set(CPACK_COMPONENT_DOCUMENTATION_DEPENDS component)
     endif(INSTALL_DOCUMENTATION)
    +if(INSTALL_SOURCES)
    +    set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} sources)
    +    set(CPACK_COMPONENT_SOURCES_DISPLAY_NAME "Source files")
    +    set(CPACK_COMPONENT_SOURCES_DESCRIPTION
    +        "Source files from the component.")
    +endif(INSTALL_SOURCES)
    
     IF (WIN32)
    +
    +    # Windows WiX package settings
    +
    +    set(CPACK_WIX_XSL "@CMAKE_CURRENT_BINARY_DIR@/wix.xsl")
    +    set(CPACK_WIX_LANG "ja-jp")
    +    set(CPACK_RESOURCE_FILE_LICENSE
    +        "@CMAKE_CURRENT_SOURCE_DIR@/cmake/License.rtf")
    +    configure_file(
    +        "@CMAKE_CURRENT_SOURCE_DIR@/cmake/wix.xsl.in" 
    +        "@CMAKE_CURRENT_BINARY_DIR@/wix.xsl" @ONLY)
    +
    +    set(CPACK_PACKAGE_FILE_NAME
    +        "@PROJECT_NAME@@PROJECT_VERSION_MAJOR@@PROJECT_VERSION_MINOR@@PROJECT_VERSION_REVISION@")
    +
    +
    +    #
    +    #
    +    #
         set(CPACK_NSIS_MUI_ICON "@PROJECT_SOURCE_DIR@/cmake\\rt_middleware_logo.ico")
         set(CPACK_NSIS_MUI_UNIICON "@PROJECT_SOURCE_DIR@/cmake\\rt_middleware_logo.ico")
         set(CPACK_PACKAGE_ICON "@PROJECT_SOURCE_DIR@/cmake\\rt_middleware_logo.bmp")
    
    
  • ./doc/CMakeLists.txt
    @@ -29,8 +29,8 @@
             ${CMAKE_CURRENT_SOURCE_DIR}/content ${CMAKE_CURRENT_BINARY_DIR}/html
             DEPENDS doxygen_doc)
         install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html" DESTINATION
    -        "share/doc/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}" 
    -        COMPONENT doc)
    +        "components/share/doc/${PROJECT_NAME_LOWER}-${PROJECT_VERSION_MAJOR}" 
    +        COMPONENT documentation)
     else(DOXYGEN_FOUND)
         message(FATAL_ERROR
             "Doxygen was not found. Cannot build documentation. Disable BUILD_DOCUMENTATION to continue")
    
  • ./idl/CMakeLists.txt
    @@ -3,7 +3,7 @@
     install(FILES ${idls} DESTINATION ${INC_INSTALL_DIR}/idl
         COMPONENT idl)
    
    -OPENRTM_COMPILE_IDL_FILES(${idls})
    +#OPENRTM_COMPILE_IDL_FILES(${idls})
     set(ALL_IDL_SRCS ${ALL_IDL_SRCS} PARENT_SCOPE)
     FILTER_LIST("${ALL_IDL_SRCS}" "hh$" idl_headers)
     install(FILES ${idl_headers}
    
  • ./src/CMakeLists.txt
    @@ -1,12 +1,16 @@
    -set(comp_srcs rtc<component>.cpp
    -              <interface>_impl.cpp)
    -set(standalone_srcs standalone.cpp)
    +set(comp_srcs ModuleName.cpp)
    +set(standalone_srcs ModuleNameComp.cpp)
    
     include_directories(${PROJECT_SOURCE_DIR}/include)
    +include_directories(${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME})
     include_directories(${PROJECT_BINARY_DIR})
     include_directories(${OPENRTM_INCLUDE_DIRS})
    +include_directories(${OMNIORB_INCLUDE_DIRS})
     add_definitions(${OPENRTM_CFLAGS})
    
    +link_directories(${OPENRTM_LIBRARY_DIRS})
    +link_directories(${OMNIORB_LIBRARY_DIRS})
    +
     add_library(${PROJECT_NAME_LOWER} ${LIB_TYPE} ${comp_srcs} ${ALL_IDL_SRCS})
     set_source_files_properties(${ALL_IDL_SRCS} PROPERTIES GENERATED 1)
     add_dependencies(${PROJECT_NAME_LOWER} ALL_IDL_TGT)
    
  • ./cmake/wix.xsl.in
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" 
       xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
       xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
      <xsl:output indent="yes" method="xml"/>
    
      <xsl:template match="/wix:Wix">
        <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
          <Product xmlns="http://schemas.microsoft.com/wix/2006/wi" Id="A4D2F9D7-BF2F-47B4-8E8D-2DBD798CBE17" Name="@CPACK_PACKAGE_NAME@ @CPACK_PACKAGE_VERSION@" Language="1041" Codepage="932" Version="@CPACK_PACKAGE_VERSION@" Manufacturer="@CPACK_PACKAGE_VENDOR@" UpgradeCode="F4C1C989-8CC9-4A4C-888D-541570BCFBF5">
            <Package InstallerVersion="300" Compressed="yes" Languages='1041' SummaryCodepage='932' />
            <Media Id="1" Cabinet="@CPACK_PACKAGE_NAME@.cab" EmbedCab="yes" />
            <Directory Id="TARGETDIR" Name="SourceDir" >
                <Directory Id="ProgramFilesFolder" Name="PFILE" >
                    <Directory Id="OPENRTM_DIR" Name="OpenRTM-aist" >
                        <Directory Id="INSTALLLOCATION" Name="1.1" />
                    </Directory>
                </Directory>
            </Directory>
        <Feature Id="APPLICATIONS" Title="@CPACK_COMPONENT_COMPONENT_DISPLAY_NAME@" Level="1" Description="@CPACK_COMPONENT_COMPONENT_DESCRIPTION@" >
            <!-- Start Ripping through the xml -->
          <xsl:apply-templates select="wix:Fragment/wix:DirectoryRef/wix:Component[contains(wix:File/@Source, translate('\bin\@CPACK_PACKAGE_NAME@.dll','ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'))]" />
              <xsl:apply-templates select="wix:Fragment/wix:DirectoryRef/wix:Component[contains(wix:File/@Source, translate('\lib\@CPACK_PACKAGE_NAME@.lib','ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'))]" />
          <xsl:apply-templates select="wix:Fragment/wix:DirectoryRef/wix:Component[contains(wix:File/@Source, translate('\bin\@CPACK_PACKAGE_NAME@_standalone.exe','ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'))]" />
          <xsl:apply-templates select="wix:Fragment/wix:DirectoryRef/wix:Component[contains(wix:File/@Source, 'RTC.xml')]" />
      </Feature>
    
            <Feature Id="DOCUMENTS" Title="@CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME@" Level="1" Absent="allow" Description="@CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION@" >
              <!-- Start Ripping through the xml -->
              <xsl:apply-templates select="wix:Fragment/wix:DirectoryRef/wix:Component[contains(wix:File/@Source, '@CPACK_PACKAGE_INSTALL_DIRECTORY@\doc')]" />
            </Feature>
    
            <!--Tack on your specific wix options-->
            <UIRef Id="WixUI_FeatureTree" />
        <UIRef Id="WixUI_ErrorProgressText" />
            <!-- TODO: Add Wix Specific Dialogs and features. -->
            <!-- TODO: Add artwork  -->
            <!-- TODO: Add ... -->
    
          </Product>
    
          <!--Output the fragment info which heat generates-->
          <xsl:copy-of select="wix:Fragment[wix:DirectoryRef/wix:Component]" />
          <xsl:apply-templates select="wix:Fragment[wix:DirectoryRef/@Id!='TARGETDIR' and wix:DirectoryRef/wix:Directory]" />
    
        </Wix>
      </xsl:template>
    
      <xsl:template match="wix:Fragment[wix:DirectoryRef/wix:Directory]" >
        <xsl:copy>
          <xsl:apply-templates select="wix:DirectoryRef" />
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="wix:DirectoryRef" >
        <xsl:copy>
          <xsl:choose>
            <xsl:when test="wix:Directory[@Name='components']" >
              <xsl:attribute name="Id">INSTALLLOCATION</xsl:attribute>
            </xsl:when>
            <xsl:otherwise>
              <xsl:attribute name="Id"><xsl:value-of select="@Id" /></xsl:attribute>
            </xsl:otherwise>
          </xsl:choose>
          <xsl:apply-templates />
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="wix:Directory" >
        <xsl:copy>
          <xsl:attribute name="Id"><xsl:value-of select="@Id" /></xsl:attribute>
          <xsl:attribute name="Name"><xsl:value-of select="@Name" /></xsl:attribute>
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="wix:Component">
        <xsl:element name="ComponentRef" xmlns="http://schemas.microsoft.com/wix/2006/wi" >
          <xsl:attribute name="Id">
            <xsl:value-of select="@Id" />
          </xsl:attribute>
        </xsl:element>
      </xsl:template>
    
    </xsl:stylesheet>
    

RTCB Ver1.1.0-RC2 について(参考)

RTCB で生成されるディレクトリ構成

RTCB で生成される内容を記載。

 +--<RTC>
    +--cmake_modules
    +--cpack_resources

ディレクトリ名 内容
./ .project
CMakeLists.txt
Doxyfile.in
rtc.conf
RTC.xml
RTC.xmlxxxxxxxxxxxxxxx
ModuleName.conf
ModuleName.cpp
ModuleName.h
ModuleNameComp.cpp
./cmake_modules/ cmake_uninstall.cmake.in
CPackWIX.cmake
./cpack_resources/ Description.txt
License.rtf
License.txt
wix.xsl.in

RTCB の基本プロファイル入力ページの項目

RTCB 基本プロファイル入力ページで設定する項目を記載。
項目 説明 必須
モジュール名 RT コンポーネントを識別する名前です。必須入力項目。
この名前は、生成されるソースコード中で、コンポーネントの名前に使用されます。英数字でなければなりません。
モジュール概要 RT コンポーネントの簡単な概要説明です。 -
バージョン RT コンポーネントのバージョンです。原則 x.y.z のような形式でバージョン番号を入力します。省略可能項目 -
ベンダ名 RT コンポーネントを開発したベンダ名です。
モジュールカテゴリ RT コンポーネントのカテゴリです。
コンポーネント型 RTコンポーネントの型です。以下の選択肢の中から指定可能です。
・STATIC:静的に存在するタイプのRTCです。動的な生成、削除は行われません。
・UNIQUE:動的に生成・削除はできるが、各コンポーネントが内部に固有状態を保持しており、必ずしも交換可能ではないタイプのRTCです。
・COMMUTATIVE:動的に生成・削除が可能で、内部の状態を持たないため、生成されたコンポーネントが交換可能なタイプのRTCです。
アクティビティ型 RTコンポーネントのアクティビティタイプです。以下の選択肢の中から指定可能です。
・PERIODIC :一定周期でRTCのアクションを実行するアクティビティタイプ
・SPORADIC :RTCのアクションを不定期に実行するアクティビティタイプ
・EVENT_DRIVEN :RTCのアクションがイベントドリブンであるアクティビティタイプ
コンポーネント種類 RTコンポーネントの実行形態の種類です。以下の選択肢から選択可能です。(複数選択肢の組み合わせ可)
・DataFlow : 周期的にアクションを実行する実行形態
・FSM : 外部イベントによってアクションを実行する形態
・MultiMode : 複数の動作モードを持つ実行形態
最大インスタンス数 RT コンポーネント インスタンスの最大数です。自然数を入力してください。 -
実行型 ExecutionContextの型です。 以下から選択可能です。
・PeriodicExecutionContext : 周期実行を行うExecutionContext
・ExtTrigExecutionContext : 外部トリガによって実行を行うExecutionContex
実行周期 ExecutionContextの実行周期です。正のdouble型の数値が入力可能です(単位Hz)。 -
概要 RTコンポーネントに関する説明です。
RTC Type 特定機能を実現するRTコンポーネントを区別する必要がある場合に指定します。
Output Project 生成コードの出力対象プロジェクト名です。
設定したプロジェクトが存在する場合には、そのプロジェクト内に、設定したプロジェクトが存在しない場合には、新規プロジェクトを生成します。