diff --git a/CMakeLists.txt b/CMakeLists.txt index 18063b94d2..67fa7b06ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,15 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules") option(BUILD_IDLC "Build IDL preprocessor" ${not_crosscompiling}) option(BUILD_DDSPERF "Build ddsperf tool" ${not_crosscompiling}) +option(BUILD_IDLC_ONLY "Only build the IDLC preprocessor" OFF) + +if(BUILD_IDLC_ONLY) + set(BUILD_DDSPERF NO) + set(ENABLE_SECURITY NO) + set(BUILD_EXAMPLES NO) + set(BUILD_IDLC_XTESTS NO) + set(BUILD_TESTING OFF) +endif() set(CMAKE_C_STANDARD 99) if(CMAKE_SYSTEM_NAME STREQUAL "VxWorks") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 98f0c409ed..f783392205 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -93,10 +93,17 @@ if(NOT ENABLE_SECURITY) message(STATUS "Building without OMG DDS Security support") endif() -add_subdirectory(tools) add_subdirectory(ddsrt) -if(BUILD_IDLC) + +if(BUILD_IDLC_ONLY) add_subdirectory(idl) + add_subdirectory(tools/_confgen) +else() + add_subdirectory(tools) + if(BUILD_IDLC) + add_subdirectory(idl) + endif() + add_subdirectory(security) endif() -add_subdirectory(security) + add_subdirectory(core) diff --git a/src/idl/CMakeLists.txt b/src/idl/CMakeLists.txt index 1cf75ed482..24c9064f94 100644 --- a/src/idl/CMakeLists.txt +++ b/src/idl/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright(c) 2021 to 2022 ZettaScale Technology and others +# Copyright(c) 2006 to 2022 ZettaScale Technology and others # # This program and the accompanying materials are made available under the # terms of the Eclipse Public License v. 2.0 which is available at @@ -9,189 +9,11 @@ # # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause # -include(GenerateExportHeader) -include(HashUtilities) -find_package(Threads QUIET REQUIRED) +set(CMAKE_INSTALL_TOOLSDIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idl") -set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}") -set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}") - -configure_file(include/idl/version.h.in include/idl/version.h @ONLY) - -check_hashes( - _bison_hash_correct - HASH_FILES - src/parser.y - APPEND_FILES - ${CMAKE_CURRENT_LIST_DIR}/src/parser.c - ${CMAKE_CURRENT_LIST_DIR}/src/parser.h -) - -if(NOT ${_bison_hash_correct}) - find_package(BISON 3.0.4) - - if(BISON_FOUND) - message(STATUS "Running Bison, parser.y was updated.") - message(STATUS "${source_dir}") - - file(REMOVE src/parser.c) - file(REMOVE src/parser.h) - - # Run bison targetting an intermediate file - bison_target(bison_t src/parser.y ${binary_dir}/parser.c DEFINES_FILE ${binary_dir}/parser.h) - - # Run postprocessing (copying/hashing) - add_custom_command( - OUTPUT - ${binary_dir}/src/parser.c - ${binary_dir}/src/parser.h - COMMAND ${CMAKE_COMMAND} ARGS - "-Dsource_dir=${source_dir}" - "-Dbinary_dir=${binary_dir}" - "-DMAIN_PROJECT_DIR=${CMAKE_SOURCE_DIR}" - -P ${CMAKE_CURRENT_LIST_DIR}/postprocess-parser.cmake - DEPENDS ${binary_dir}/parser.c ${binary_dir}/parser.h - ) - else() - message(FATAL_ERROR "parser.y was updated but parser.c not regenerated, and no bison available!") - endif() -else() - file(COPY ${source_dir}/src/parser.c DESTINATION ${binary_dir}/src) - file(COPY ${source_dir}/src/parser.h DESTINATION ${binary_dir}/src) -endif() - -set_source_files_properties(${binary_dir}/src/parser.c ${binary_dir}/src/parser.h PROPERTIES GENERATED TRUE) - -set(headers - include/idl/expression.h - include/idl/file.h - include/idl/print.h - include/idl/processor.h - include/idl/retcode.h - include/idl/scope.h - include/idl/stream.h - include/idl/string.h - include/idl/symbol.h - include/idl/tree.h - include/idl/vector.h - include/idl/visit.h - include/idl/heap.h - ${binary_dir}/include/idl/version.h) - -set(sources - src/symbol.c - src/directive.c - src/expression.c - src/file.c - src/processor.c - src/scanner.c - src/string.c - src/annotation.c - src/scope.c - src/string.c - src/tree.c - src/vector.c - src/visit.c - src/print.c - src/keylist.c - src/hashid.c - src/parser.c - src/heap.c - src/annotation.h - src/directive.h - src/expression.h - src/file.h - src/hashid.h - src/parser.h - src/scanner.h - src/scope.h - src/symbol.h - src/tree.h - src/keylist.h) - -# import generic utility sources from ddsrt to avoid duplication -# NOTE: an additional INTERFACE library defined in ddsrt would be ideal, but -# the GENERATED property is not propagated before 3.20. using an OBJECT -# library and propagating the object files through an INTERFACE library -# can be done, but a proper export header can only be generated from the -# final library. -# see: https://gitlab.kitware.com/cmake/cmake/-/issues/18399 -set(script "${PROJECT_SOURCE_DIR}/src/ddsrt/rename.cmake") -set(templates - include/dds/ddsrt/misc.h - include/dds/ddsrt/attributes.h - include/dds/ddsrt/endian.h - include/dds/ddsrt/md5.h - src/md5.c) -# FIXME: move general functionality to ddsrt - -foreach(source ${templates}) - set(input "${PROJECT_SOURCE_DIR}/src/ddsrt/${source}") - # map include path. i.e. map include/dds/ddsrt to include/idl - string(REGEX REPLACE "(/dds(rt)?)+" "/idl" source "${source}") - set(output "${binary_dir}/${source}") - # process source file. i.e. replace dds and ddsrt with idl - add_custom_command( - OUTPUT ${output} - COMMAND "${CMAKE_COMMAND}" -DNAMESPACE=idl - -DINPUT_FILE=${input} - -DOUTPUT_DIRECTORY=${binary_dir} - -DOUTPUT_FILE=${output} - -P ${script} - DEPENDS ${input} ${script}) - if(source MATCHES "^include/.*\\.h") - list(APPEND headers ${output}) - else() - list(APPEND sources ${output}) - endif() -endforeach() - -add_library(idl SHARED ${headers} ${sources}) - -set_target_properties( - idl PROPERTIES - OUTPUT_NAME "cycloneddsidl" - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR}) - -generate_export_header(idl EXPORT_FILE_NAME include/idl/export.h) - - -target_include_directories( - idl - PUBLIC - "$" - "$" - "$" - "$" - INTERFACE - "$") - -target_link_libraries(idl PRIVATE Threads::Threads) - -install( - DIRECTORY - "${source_dir}/include/idl" - "${binary_dir}/include/idl" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - COMPONENT dev - FILES_MATCHING PATTERN "*.h") - -install( - TARGETS idl - EXPORT "${CMAKE_PROJECT_NAME}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib) - -if (INSTALL_PDB) - install(FILES $ - DESTINATION "${CMAKE_INSTALL_BINDIR}" - COMPONENT dev - OPTIONAL) -endif() - -if(BUILD_TESTING) - add_subdirectory(tests) +add_subdirectory(idlparser) +if(BUILD_IDLC) + add_subdirectory(idlpp) + add_subdirectory(idlc) endif() diff --git a/src/tools/idlc/CMakeLists.txt b/src/idl/idlc/CMakeLists.txt similarity index 100% rename from src/tools/idlc/CMakeLists.txt rename to src/idl/idlc/CMakeLists.txt diff --git a/src/tools/idlc/include/idlc/generator.h b/src/idl/idlc/include/idlc/generator.h similarity index 100% rename from src/tools/idlc/include/idlc/generator.h rename to src/idl/idlc/include/idlc/generator.h diff --git a/src/tools/idlc/include/idlc/options.h b/src/idl/idlc/include/idlc/options.h similarity index 100% rename from src/tools/idlc/include/idlc/options.h rename to src/idl/idlc/include/idlc/options.h diff --git a/src/tools/idlc/src/config.h.in b/src/idl/idlc/src/config.h.in similarity index 100% rename from src/tools/idlc/src/config.h.in rename to src/idl/idlc/src/config.h.in diff --git a/src/tools/idlc/src/descriptor.c b/src/idl/idlc/src/descriptor.c similarity index 100% rename from src/tools/idlc/src/descriptor.c rename to src/idl/idlc/src/descriptor.c diff --git a/src/tools/idlc/src/descriptor.h b/src/idl/idlc/src/descriptor.h similarity index 100% rename from src/tools/idlc/src/descriptor.h rename to src/idl/idlc/src/descriptor.h diff --git a/src/tools/idlc/src/descriptor_type_meta.c b/src/idl/idlc/src/descriptor_type_meta.c similarity index 100% rename from src/tools/idlc/src/descriptor_type_meta.c rename to src/idl/idlc/src/descriptor_type_meta.c diff --git a/src/tools/idlc/src/descriptor_type_meta.h b/src/idl/idlc/src/descriptor_type_meta.h similarity index 100% rename from src/tools/idlc/src/descriptor_type_meta.h rename to src/idl/idlc/src/descriptor_type_meta.h diff --git a/src/tools/idlc/src/generator.c b/src/idl/idlc/src/generator.c similarity index 100% rename from src/tools/idlc/src/generator.c rename to src/idl/idlc/src/generator.c diff --git a/src/tools/idlc/src/generator.h b/src/idl/idlc/src/generator.h similarity index 100% rename from src/tools/idlc/src/generator.h rename to src/idl/idlc/src/generator.h diff --git a/src/tools/idlc/src/idlc.c b/src/idl/idlc/src/idlc.c similarity index 100% rename from src/tools/idlc/src/idlc.c rename to src/idl/idlc/src/idlc.c diff --git a/src/tools/idlc/src/options.c b/src/idl/idlc/src/options.c similarity index 100% rename from src/tools/idlc/src/options.c rename to src/idl/idlc/src/options.c diff --git a/src/tools/idlc/src/options.h b/src/idl/idlc/src/options.h similarity index 100% rename from src/tools/idlc/src/options.h rename to src/idl/idlc/src/options.h diff --git a/src/tools/idlc/src/plugin.c b/src/idl/idlc/src/plugin.c similarity index 100% rename from src/tools/idlc/src/plugin.c rename to src/idl/idlc/src/plugin.c diff --git a/src/tools/idlc/src/plugin.h b/src/idl/idlc/src/plugin.h similarity index 100% rename from src/tools/idlc/src/plugin.h rename to src/idl/idlc/src/plugin.h diff --git a/src/tools/idlc/src/types.c b/src/idl/idlc/src/types.c similarity index 100% rename from src/tools/idlc/src/types.c rename to src/idl/idlc/src/types.c diff --git a/src/tools/idlc/tests/CMakeLists.txt b/src/idl/idlc/tests/CMakeLists.txt similarity index 100% rename from src/tools/idlc/tests/CMakeLists.txt rename to src/idl/idlc/tests/CMakeLists.txt diff --git a/src/tools/idlc/tests/descriptor.c b/src/idl/idlc/tests/descriptor.c similarity index 100% rename from src/tools/idlc/tests/descriptor.c rename to src/idl/idlc/tests/descriptor.c diff --git a/src/tools/idlc/tests/test_common.c b/src/idl/idlc/tests/test_common.c similarity index 100% rename from src/tools/idlc/tests/test_common.c rename to src/idl/idlc/tests/test_common.c diff --git a/src/tools/idlc/tests/test_common.h b/src/idl/idlc/tests/test_common.h similarity index 100% rename from src/tools/idlc/tests/test_common.h rename to src/idl/idlc/tests/test_common.h diff --git a/src/tools/idlc/tests/type_meta.c b/src/idl/idlc/tests/type_meta.c similarity index 100% rename from src/tools/idlc/tests/type_meta.c rename to src/idl/idlc/tests/type_meta.c diff --git a/src/tools/idlc/xtests/CMakeLists.txt b/src/idl/idlc/xtests/CMakeLists.txt similarity index 100% rename from src/tools/idlc/xtests/CMakeLists.txt rename to src/idl/idlc/xtests/CMakeLists.txt diff --git a/src/tools/idlc/xtests/Compile.cmake b/src/idl/idlc/xtests/Compile.cmake similarity index 100% rename from src/tools/idlc/xtests/Compile.cmake rename to src/idl/idlc/xtests/Compile.cmake diff --git a/src/tools/idlc/xtests/common.h b/src/idl/idlc/xtests/common.h similarity index 100% rename from src/tools/idlc/xtests/common.h rename to src/idl/idlc/xtests/common.h diff --git a/src/tools/idlc/xtests/main.c b/src/idl/idlc/xtests/main.c similarity index 100% rename from src/tools/idlc/xtests/main.c rename to src/idl/idlc/xtests/main.c diff --git a/src/tools/idlc/xtests/test_alias.idl b/src/idl/idlc/xtests/test_alias.idl similarity index 100% rename from src/tools/idlc/xtests/test_alias.idl rename to src/idl/idlc/xtests/test_alias.idl diff --git a/src/tools/idlc/xtests/test_basic.idl b/src/idl/idlc/xtests/test_basic.idl similarity index 100% rename from src/tools/idlc/xtests/test_basic.idl rename to src/idl/idlc/xtests/test_basic.idl diff --git a/src/tools/idlc/xtests/test_bitmask.idl b/src/idl/idlc/xtests/test_bitmask.idl similarity index 100% rename from src/tools/idlc/xtests/test_bitmask.idl rename to src/idl/idlc/xtests/test_bitmask.idl diff --git a/src/tools/idlc/xtests/test_bool.idl b/src/idl/idlc/xtests/test_bool.idl similarity index 100% rename from src/tools/idlc/xtests/test_bool.idl rename to src/idl/idlc/xtests/test_bool.idl diff --git a/src/tools/idlc/xtests/test_bounded_seq.idl b/src/idl/idlc/xtests/test_bounded_seq.idl similarity index 100% rename from src/tools/idlc/xtests/test_bounded_seq.idl rename to src/idl/idlc/xtests/test_bounded_seq.idl diff --git a/src/tools/idlc/xtests/test_enum.idl b/src/idl/idlc/xtests/test_enum.idl similarity index 100% rename from src/tools/idlc/xtests/test_enum.idl rename to src/idl/idlc/xtests/test_enum.idl diff --git a/src/tools/idlc/xtests/test_optional.idl b/src/idl/idlc/xtests/test_optional.idl similarity index 100% rename from src/tools/idlc/xtests/test_optional.idl rename to src/idl/idlc/xtests/test_optional.idl diff --git a/src/tools/idlc/xtests/test_optional_mutable.idl b/src/idl/idlc/xtests/test_optional_mutable.idl similarity index 100% rename from src/tools/idlc/xtests/test_optional_mutable.idl rename to src/idl/idlc/xtests/test_optional_mutable.idl diff --git a/src/tools/idlc/xtests/test_struct_alignment.idl b/src/idl/idlc/xtests/test_struct_alignment.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_alignment.idl rename to src/idl/idlc/xtests/test_struct_alignment.idl diff --git a/src/tools/idlc/xtests/test_struct_external.idl b/src/idl/idlc/xtests/test_struct_external.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_external.idl rename to src/idl/idlc/xtests/test_struct_external.idl diff --git a/src/tools/idlc/xtests/test_struct_inherit.idl b/src/idl/idlc/xtests/test_struct_inherit.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_inherit.idl rename to src/idl/idlc/xtests/test_struct_inherit.idl diff --git a/src/tools/idlc/xtests/test_struct_inherit_appendable.idl b/src/idl/idlc/xtests/test_struct_inherit_appendable.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_inherit_appendable.idl rename to src/idl/idlc/xtests/test_struct_inherit_appendable.idl diff --git a/src/tools/idlc/xtests/test_struct_inherit_mutable.idl b/src/idl/idlc/xtests/test_struct_inherit_mutable.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_inherit_mutable.idl rename to src/idl/idlc/xtests/test_struct_inherit_mutable.idl diff --git a/src/tools/idlc/xtests/test_struct_inherit_mutable_keys.idl b/src/idl/idlc/xtests/test_struct_inherit_mutable_keys.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_inherit_mutable_keys.idl rename to src/idl/idlc/xtests/test_struct_inherit_mutable_keys.idl diff --git a/src/tools/idlc/xtests/test_struct_keys.idl b/src/idl/idlc/xtests/test_struct_keys.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_keys.idl rename to src/idl/idlc/xtests/test_struct_keys.idl diff --git a/src/tools/idlc/xtests/test_struct_r.idl b/src/idl/idlc/xtests/test_struct_r.idl similarity index 100% rename from src/tools/idlc/xtests/test_struct_r.idl rename to src/idl/idlc/xtests/test_struct_r.idl diff --git a/src/tools/idlc/xtests/test_typedef_member.idl b/src/idl/idlc/xtests/test_typedef_member.idl similarity index 100% rename from src/tools/idlc/xtests/test_typedef_member.idl rename to src/idl/idlc/xtests/test_typedef_member.idl diff --git a/src/tools/idlc/xtests/test_union.idl b/src/idl/idlc/xtests/test_union.idl similarity index 100% rename from src/tools/idlc/xtests/test_union.idl rename to src/idl/idlc/xtests/test_union.idl diff --git a/src/tools/idlc/xtests/test_union_external.idl b/src/idl/idlc/xtests/test_union_external.idl similarity index 100% rename from src/tools/idlc/xtests/test_union_external.idl rename to src/idl/idlc/xtests/test_union_external.idl diff --git a/src/tools/idlc/xtests/test_union_member_types_r.idl b/src/idl/idlc/xtests/test_union_member_types_r.idl similarity index 100% rename from src/tools/idlc/xtests/test_union_member_types_r.idl rename to src/idl/idlc/xtests/test_union_member_types_r.idl diff --git a/src/tools/idlc/xtests/test_union_r.idl b/src/idl/idlc/xtests/test_union_r.idl similarity index 100% rename from src/tools/idlc/xtests/test_union_r.idl rename to src/idl/idlc/xtests/test_union_r.idl diff --git a/src/idl/idlparser/CMakeLists.txt b/src/idl/idlparser/CMakeLists.txt new file mode 100644 index 0000000000..1cf75ed482 --- /dev/null +++ b/src/idl/idlparser/CMakeLists.txt @@ -0,0 +1,197 @@ +# +# Copyright(c) 2021 to 2022 ZettaScale Technology and others +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0 which is available at +# http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License +# v. 1.0 which is available at +# http://www.eclipse.org/org/documents/edl-v10.php. +# +# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause +# +include(GenerateExportHeader) +include(HashUtilities) + +find_package(Threads QUIET REQUIRED) + +set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}") +set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}") + +configure_file(include/idl/version.h.in include/idl/version.h @ONLY) + +check_hashes( + _bison_hash_correct + HASH_FILES + src/parser.y + APPEND_FILES + ${CMAKE_CURRENT_LIST_DIR}/src/parser.c + ${CMAKE_CURRENT_LIST_DIR}/src/parser.h +) + +if(NOT ${_bison_hash_correct}) + find_package(BISON 3.0.4) + + if(BISON_FOUND) + message(STATUS "Running Bison, parser.y was updated.") + message(STATUS "${source_dir}") + + file(REMOVE src/parser.c) + file(REMOVE src/parser.h) + + # Run bison targetting an intermediate file + bison_target(bison_t src/parser.y ${binary_dir}/parser.c DEFINES_FILE ${binary_dir}/parser.h) + + # Run postprocessing (copying/hashing) + add_custom_command( + OUTPUT + ${binary_dir}/src/parser.c + ${binary_dir}/src/parser.h + COMMAND ${CMAKE_COMMAND} ARGS + "-Dsource_dir=${source_dir}" + "-Dbinary_dir=${binary_dir}" + "-DMAIN_PROJECT_DIR=${CMAKE_SOURCE_DIR}" + -P ${CMAKE_CURRENT_LIST_DIR}/postprocess-parser.cmake + DEPENDS ${binary_dir}/parser.c ${binary_dir}/parser.h + ) + else() + message(FATAL_ERROR "parser.y was updated but parser.c not regenerated, and no bison available!") + endif() +else() + file(COPY ${source_dir}/src/parser.c DESTINATION ${binary_dir}/src) + file(COPY ${source_dir}/src/parser.h DESTINATION ${binary_dir}/src) +endif() + +set_source_files_properties(${binary_dir}/src/parser.c ${binary_dir}/src/parser.h PROPERTIES GENERATED TRUE) + +set(headers + include/idl/expression.h + include/idl/file.h + include/idl/print.h + include/idl/processor.h + include/idl/retcode.h + include/idl/scope.h + include/idl/stream.h + include/idl/string.h + include/idl/symbol.h + include/idl/tree.h + include/idl/vector.h + include/idl/visit.h + include/idl/heap.h + ${binary_dir}/include/idl/version.h) + +set(sources + src/symbol.c + src/directive.c + src/expression.c + src/file.c + src/processor.c + src/scanner.c + src/string.c + src/annotation.c + src/scope.c + src/string.c + src/tree.c + src/vector.c + src/visit.c + src/print.c + src/keylist.c + src/hashid.c + src/parser.c + src/heap.c + src/annotation.h + src/directive.h + src/expression.h + src/file.h + src/hashid.h + src/parser.h + src/scanner.h + src/scope.h + src/symbol.h + src/tree.h + src/keylist.h) + +# import generic utility sources from ddsrt to avoid duplication +# NOTE: an additional INTERFACE library defined in ddsrt would be ideal, but +# the GENERATED property is not propagated before 3.20. using an OBJECT +# library and propagating the object files through an INTERFACE library +# can be done, but a proper export header can only be generated from the +# final library. +# see: https://gitlab.kitware.com/cmake/cmake/-/issues/18399 +set(script "${PROJECT_SOURCE_DIR}/src/ddsrt/rename.cmake") +set(templates + include/dds/ddsrt/misc.h + include/dds/ddsrt/attributes.h + include/dds/ddsrt/endian.h + include/dds/ddsrt/md5.h + src/md5.c) +# FIXME: move general functionality to ddsrt + +foreach(source ${templates}) + set(input "${PROJECT_SOURCE_DIR}/src/ddsrt/${source}") + # map include path. i.e. map include/dds/ddsrt to include/idl + string(REGEX REPLACE "(/dds(rt)?)+" "/idl" source "${source}") + set(output "${binary_dir}/${source}") + # process source file. i.e. replace dds and ddsrt with idl + add_custom_command( + OUTPUT ${output} + COMMAND "${CMAKE_COMMAND}" -DNAMESPACE=idl + -DINPUT_FILE=${input} + -DOUTPUT_DIRECTORY=${binary_dir} + -DOUTPUT_FILE=${output} + -P ${script} + DEPENDS ${input} ${script}) + if(source MATCHES "^include/.*\\.h") + list(APPEND headers ${output}) + else() + list(APPEND sources ${output}) + endif() +endforeach() + +add_library(idl SHARED ${headers} ${sources}) + +set_target_properties( + idl PROPERTIES + OUTPUT_NAME "cycloneddsidl" + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}) + +generate_export_header(idl EXPORT_FILE_NAME include/idl/export.h) + + +target_include_directories( + idl + PUBLIC + "$" + "$" + "$" + "$" + INTERFACE + "$") + +target_link_libraries(idl PRIVATE Threads::Threads) + +install( + DIRECTORY + "${source_dir}/include/idl" + "${binary_dir}/include/idl" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + COMPONENT dev + FILES_MATCHING PATTERN "*.h") + +install( + TARGETS idl + EXPORT "${CMAKE_PROJECT_NAME}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib) + +if (INSTALL_PDB) + install(FILES $ + DESTINATION "${CMAKE_INSTALL_BINDIR}" + COMPONENT dev + OPTIONAL) +endif() + +if(BUILD_TESTING) + add_subdirectory(tests) +endif() diff --git a/src/idl/include/idl/expression.h b/src/idl/idlparser/include/idl/expression.h similarity index 100% rename from src/idl/include/idl/expression.h rename to src/idl/idlparser/include/idl/expression.h diff --git a/src/idl/include/idl/file.h b/src/idl/idlparser/include/idl/file.h similarity index 100% rename from src/idl/include/idl/file.h rename to src/idl/idlparser/include/idl/file.h diff --git a/src/idl/include/idl/heap.h b/src/idl/idlparser/include/idl/heap.h similarity index 100% rename from src/idl/include/idl/heap.h rename to src/idl/idlparser/include/idl/heap.h diff --git a/src/idl/include/idl/print.h b/src/idl/idlparser/include/idl/print.h similarity index 100% rename from src/idl/include/idl/print.h rename to src/idl/idlparser/include/idl/print.h diff --git a/src/idl/include/idl/processor.h b/src/idl/idlparser/include/idl/processor.h similarity index 100% rename from src/idl/include/idl/processor.h rename to src/idl/idlparser/include/idl/processor.h diff --git a/src/idl/include/idl/retcode.h b/src/idl/idlparser/include/idl/retcode.h similarity index 100% rename from src/idl/include/idl/retcode.h rename to src/idl/idlparser/include/idl/retcode.h diff --git a/src/idl/include/idl/scope.h b/src/idl/idlparser/include/idl/scope.h similarity index 100% rename from src/idl/include/idl/scope.h rename to src/idl/idlparser/include/idl/scope.h diff --git a/src/idl/include/idl/stream.h b/src/idl/idlparser/include/idl/stream.h similarity index 100% rename from src/idl/include/idl/stream.h rename to src/idl/idlparser/include/idl/stream.h diff --git a/src/idl/include/idl/string.h b/src/idl/idlparser/include/idl/string.h similarity index 100% rename from src/idl/include/idl/string.h rename to src/idl/idlparser/include/idl/string.h diff --git a/src/idl/include/idl/symbol.h b/src/idl/idlparser/include/idl/symbol.h similarity index 100% rename from src/idl/include/idl/symbol.h rename to src/idl/idlparser/include/idl/symbol.h diff --git a/src/idl/include/idl/tree.h b/src/idl/idlparser/include/idl/tree.h similarity index 100% rename from src/idl/include/idl/tree.h rename to src/idl/idlparser/include/idl/tree.h diff --git a/src/idl/include/idl/vector.h b/src/idl/idlparser/include/idl/vector.h similarity index 100% rename from src/idl/include/idl/vector.h rename to src/idl/idlparser/include/idl/vector.h diff --git a/src/idl/include/idl/version.h.in b/src/idl/idlparser/include/idl/version.h.in similarity index 100% rename from src/idl/include/idl/version.h.in rename to src/idl/idlparser/include/idl/version.h.in diff --git a/src/idl/include/idl/visit.h b/src/idl/idlparser/include/idl/visit.h similarity index 100% rename from src/idl/include/idl/visit.h rename to src/idl/idlparser/include/idl/visit.h diff --git a/src/idl/postprocess-parser.cmake b/src/idl/idlparser/postprocess-parser.cmake similarity index 100% rename from src/idl/postprocess-parser.cmake rename to src/idl/idlparser/postprocess-parser.cmake diff --git a/src/idl/src/annotation.c b/src/idl/idlparser/src/annotation.c similarity index 100% rename from src/idl/src/annotation.c rename to src/idl/idlparser/src/annotation.c diff --git a/src/idl/src/annotation.h b/src/idl/idlparser/src/annotation.h similarity index 100% rename from src/idl/src/annotation.h rename to src/idl/idlparser/src/annotation.h diff --git a/src/idl/src/directive.c b/src/idl/idlparser/src/directive.c similarity index 100% rename from src/idl/src/directive.c rename to src/idl/idlparser/src/directive.c diff --git a/src/idl/src/directive.h b/src/idl/idlparser/src/directive.h similarity index 100% rename from src/idl/src/directive.h rename to src/idl/idlparser/src/directive.h diff --git a/src/idl/src/expression.c b/src/idl/idlparser/src/expression.c similarity index 100% rename from src/idl/src/expression.c rename to src/idl/idlparser/src/expression.c diff --git a/src/idl/src/expression.h b/src/idl/idlparser/src/expression.h similarity index 100% rename from src/idl/src/expression.h rename to src/idl/idlparser/src/expression.h diff --git a/src/idl/src/fieldid.h b/src/idl/idlparser/src/fieldid.h similarity index 100% rename from src/idl/src/fieldid.h rename to src/idl/idlparser/src/fieldid.h diff --git a/src/idl/src/file.c b/src/idl/idlparser/src/file.c similarity index 100% rename from src/idl/src/file.c rename to src/idl/idlparser/src/file.c diff --git a/src/idl/src/file.h b/src/idl/idlparser/src/file.h similarity index 100% rename from src/idl/src/file.h rename to src/idl/idlparser/src/file.h diff --git a/src/idl/src/hashid.c b/src/idl/idlparser/src/hashid.c similarity index 100% rename from src/idl/src/hashid.c rename to src/idl/idlparser/src/hashid.c diff --git a/src/idl/src/hashid.h b/src/idl/idlparser/src/hashid.h similarity index 100% rename from src/idl/src/hashid.h rename to src/idl/idlparser/src/hashid.h diff --git a/src/idl/src/heap.c b/src/idl/idlparser/src/heap.c similarity index 100% rename from src/idl/src/heap.c rename to src/idl/idlparser/src/heap.c diff --git a/src/idl/src/keylist.c b/src/idl/idlparser/src/keylist.c similarity index 100% rename from src/idl/src/keylist.c rename to src/idl/idlparser/src/keylist.c diff --git a/src/idl/src/keylist.h b/src/idl/idlparser/src/keylist.h similarity index 100% rename from src/idl/src/keylist.h rename to src/idl/idlparser/src/keylist.h diff --git a/src/idl/src/parser.c b/src/idl/idlparser/src/parser.c similarity index 100% rename from src/idl/src/parser.c rename to src/idl/idlparser/src/parser.c diff --git a/src/idl/src/parser.h b/src/idl/idlparser/src/parser.h similarity index 100% rename from src/idl/src/parser.h rename to src/idl/idlparser/src/parser.h diff --git a/src/idl/src/parser.y b/src/idl/idlparser/src/parser.y similarity index 100% rename from src/idl/src/parser.y rename to src/idl/idlparser/src/parser.y diff --git a/src/idl/src/print.c b/src/idl/idlparser/src/print.c similarity index 100% rename from src/idl/src/print.c rename to src/idl/idlparser/src/print.c diff --git a/src/idl/src/processor.c b/src/idl/idlparser/src/processor.c similarity index 100% rename from src/idl/src/processor.c rename to src/idl/idlparser/src/processor.c diff --git a/src/idl/src/scanner.c b/src/idl/idlparser/src/scanner.c similarity index 100% rename from src/idl/src/scanner.c rename to src/idl/idlparser/src/scanner.c diff --git a/src/idl/src/scanner.h b/src/idl/idlparser/src/scanner.h similarity index 100% rename from src/idl/src/scanner.h rename to src/idl/idlparser/src/scanner.h diff --git a/src/idl/src/scope.c b/src/idl/idlparser/src/scope.c similarity index 100% rename from src/idl/src/scope.c rename to src/idl/idlparser/src/scope.c diff --git a/src/idl/src/scope.h b/src/idl/idlparser/src/scope.h similarity index 100% rename from src/idl/src/scope.h rename to src/idl/idlparser/src/scope.h diff --git a/src/idl/src/string.c b/src/idl/idlparser/src/string.c similarity index 100% rename from src/idl/src/string.c rename to src/idl/idlparser/src/string.c diff --git a/src/idl/src/symbol.c b/src/idl/idlparser/src/symbol.c similarity index 100% rename from src/idl/src/symbol.c rename to src/idl/idlparser/src/symbol.c diff --git a/src/idl/src/symbol.h b/src/idl/idlparser/src/symbol.h similarity index 100% rename from src/idl/src/symbol.h rename to src/idl/idlparser/src/symbol.h diff --git a/src/idl/src/tree.c b/src/idl/idlparser/src/tree.c similarity index 100% rename from src/idl/src/tree.c rename to src/idl/idlparser/src/tree.c diff --git a/src/idl/src/tree.h b/src/idl/idlparser/src/tree.h similarity index 100% rename from src/idl/src/tree.h rename to src/idl/idlparser/src/tree.h diff --git a/src/idl/src/vector.c b/src/idl/idlparser/src/vector.c similarity index 100% rename from src/idl/src/vector.c rename to src/idl/idlparser/src/vector.c diff --git a/src/idl/src/visit.c b/src/idl/idlparser/src/visit.c similarity index 100% rename from src/idl/src/visit.c rename to src/idl/idlparser/src/visit.c diff --git a/src/idl/tests/CMakeLists.txt b/src/idl/idlparser/tests/CMakeLists.txt similarity index 100% rename from src/idl/tests/CMakeLists.txt rename to src/idl/idlparser/tests/CMakeLists.txt diff --git a/src/idl/tests/annotation.c b/src/idl/idlparser/tests/annotation.c similarity index 100% rename from src/idl/tests/annotation.c rename to src/idl/idlparser/tests/annotation.c diff --git a/src/idl/tests/enum.c b/src/idl/idlparser/tests/enum.c similarity index 100% rename from src/idl/tests/enum.c rename to src/idl/idlparser/tests/enum.c diff --git a/src/idl/tests/expression.c b/src/idl/idlparser/tests/expression.c similarity index 100% rename from src/idl/tests/expression.c rename to src/idl/idlparser/tests/expression.c diff --git a/src/idl/tests/file.c b/src/idl/idlparser/tests/file.c similarity index 100% rename from src/idl/tests/file.c rename to src/idl/idlparser/tests/file.c diff --git a/src/idl/tests/forward.c b/src/idl/idlparser/tests/forward.c similarity index 100% rename from src/idl/tests/forward.c rename to src/idl/idlparser/tests/forward.c diff --git a/src/idl/tests/inheritance.c b/src/idl/idlparser/tests/inheritance.c similarity index 100% rename from src/idl/tests/inheritance.c rename to src/idl/idlparser/tests/inheritance.c diff --git a/src/idl/tests/module.c b/src/idl/idlparser/tests/module.c similarity index 100% rename from src/idl/tests/module.c rename to src/idl/idlparser/tests/module.c diff --git a/src/idl/tests/parser.c b/src/idl/idlparser/tests/parser.c similarity index 100% rename from src/idl/tests/parser.c rename to src/idl/idlparser/tests/parser.c diff --git a/src/idl/tests/pragma.c b/src/idl/idlparser/tests/pragma.c similarity index 100% rename from src/idl/tests/pragma.c rename to src/idl/idlparser/tests/pragma.c diff --git a/src/idl/tests/scanner.c b/src/idl/idlparser/tests/scanner.c similarity index 100% rename from src/idl/tests/scanner.c rename to src/idl/idlparser/tests/scanner.c diff --git a/src/idl/tests/typedef.c b/src/idl/idlparser/tests/typedef.c similarity index 100% rename from src/idl/tests/typedef.c rename to src/idl/idlparser/tests/typedef.c diff --git a/src/idl/tests/union.c b/src/idl/idlparser/tests/union.c similarity index 100% rename from src/idl/tests/union.c rename to src/idl/idlparser/tests/union.c diff --git a/src/tools/idlpp/CMakeLists.txt b/src/idl/idlpp/CMakeLists.txt similarity index 100% rename from src/tools/idlpp/CMakeLists.txt rename to src/idl/idlpp/CMakeLists.txt diff --git a/src/tools/idlpp/src/configed.H.in b/src/idl/idlpp/src/configed.H.in similarity index 100% rename from src/tools/idlpp/src/configed.H.in rename to src/idl/idlpp/src/configed.H.in diff --git a/src/tools/idlpp/src/directive.c b/src/idl/idlpp/src/directive.c similarity index 100% rename from src/tools/idlpp/src/directive.c rename to src/idl/idlpp/src/directive.c diff --git a/src/tools/idlpp/src/eval.c b/src/idl/idlpp/src/eval.c similarity index 100% rename from src/tools/idlpp/src/eval.c rename to src/idl/idlpp/src/eval.c diff --git a/src/tools/idlpp/src/expand.c b/src/idl/idlpp/src/expand.c similarity index 100% rename from src/tools/idlpp/src/expand.c rename to src/idl/idlpp/src/expand.c diff --git a/src/tools/idlpp/src/internal.H b/src/idl/idlpp/src/internal.H similarity index 100% rename from src/tools/idlpp/src/internal.H rename to src/idl/idlpp/src/internal.H diff --git a/src/tools/idlpp/src/main.c b/src/idl/idlpp/src/main.c similarity index 100% rename from src/tools/idlpp/src/main.c rename to src/idl/idlpp/src/main.c diff --git a/src/tools/idlpp/src/mbchar.c b/src/idl/idlpp/src/mbchar.c similarity index 100% rename from src/tools/idlpp/src/mbchar.c rename to src/idl/idlpp/src/mbchar.c diff --git a/src/tools/idlpp/src/mcpp_lib.h b/src/idl/idlpp/src/mcpp_lib.h similarity index 100% rename from src/tools/idlpp/src/mcpp_lib.h rename to src/idl/idlpp/src/mcpp_lib.h diff --git a/src/tools/idlpp/src/mcpp_out.h b/src/idl/idlpp/src/mcpp_out.h similarity index 100% rename from src/tools/idlpp/src/mcpp_out.h rename to src/idl/idlpp/src/mcpp_out.h diff --git a/src/tools/idlpp/src/support.c b/src/idl/idlpp/src/support.c similarity index 100% rename from src/tools/idlpp/src/support.c rename to src/idl/idlpp/src/support.c diff --git a/src/tools/idlpp/src/system.H b/src/idl/idlpp/src/system.H similarity index 100% rename from src/tools/idlpp/src/system.H rename to src/idl/idlpp/src/system.H diff --git a/src/tools/idlpp/src/system.c b/src/idl/idlpp/src/system.c similarity index 100% rename from src/tools/idlpp/src/system.c rename to src/idl/idlpp/src/system.c diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 547515e0fa..266e66a612 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -13,8 +13,4 @@ set(CMAKE_INSTALL_TOOLSDIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/tools") add_subdirectory(_confgen) -if(BUILD_IDLC) - add_subdirectory(idlpp) - add_subdirectory(idlc) -endif() add_subdirectory(ddsperf)