Skip to content

Commit c43d453

Browse files
Move IDL components to a single folder
1 parent e9ff199 commit c43d453

File tree

121 files changed

+207
-194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+207
-194
lines changed

src/CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,17 @@ if(NOT ENABLE_SECURITY)
9292
message(STATUS "Building without OMG DDS Security support")
9393
endif()
9494

95+
add_subdirectory(ddsrt)
96+
9597
if(BUILD_IDLC_ONLY)
9698
add_subdirectory(idl)
97-
add_subdirectory(core)
98-
add_subdirectory(ddsrt)
99-
add_subdirectory(tools/idlc)
100-
add_subdirectory(tools/idlpp)
10199
add_subdirectory(tools/_confgen)
102100
else()
103101
add_subdirectory(tools)
104-
add_subdirectory(ddsrt)
105102
if(BUILD_IDLC)
106103
add_subdirectory(idl)
107104
endif()
108105
add_subdirectory(security)
109-
add_subdirectory(core)
110106
endif()
107+
108+
add_subdirectory(core)

src/idl/CMakeLists.txt

Lines changed: 6 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright(c) 2021 to 2022 ZettaScale Technology and others
2+
# Copyright(c) 2006 to 2022 ZettaScale Technology and others
33
#
44
# This program and the accompanying materials are made available under the
55
# terms of the Eclipse Public License v. 2.0 which is available at
@@ -9,189 +9,11 @@
99
#
1010
# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
1111
#
12-
include(GenerateExportHeader)
13-
include(HashUtilities)
1412

15-
find_package(Threads QUIET REQUIRED)
13+
set(CMAKE_INSTALL_TOOLSDIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/idl")
1614

17-
set(binary_dir "${CMAKE_CURRENT_BINARY_DIR}")
18-
set(source_dir "${CMAKE_CURRENT_SOURCE_DIR}")
19-
20-
configure_file(include/idl/version.h.in include/idl/version.h @ONLY)
21-
22-
check_hashes(
23-
_bison_hash_correct
24-
HASH_FILES
25-
src/parser.y
26-
APPEND_FILES
27-
${CMAKE_CURRENT_LIST_DIR}/src/parser.c
28-
${CMAKE_CURRENT_LIST_DIR}/src/parser.h
29-
)
30-
31-
if(NOT ${_bison_hash_correct})
32-
find_package(BISON 3.0.4)
33-
34-
if(BISON_FOUND)
35-
message(STATUS "Running Bison, parser.y was updated.")
36-
message(STATUS "${source_dir}")
37-
38-
file(REMOVE src/parser.c)
39-
file(REMOVE src/parser.h)
40-
41-
# Run bison targetting an intermediate file
42-
bison_target(bison_t src/parser.y ${binary_dir}/parser.c DEFINES_FILE ${binary_dir}/parser.h)
43-
44-
# Run postprocessing (copying/hashing)
45-
add_custom_command(
46-
OUTPUT
47-
${binary_dir}/src/parser.c
48-
${binary_dir}/src/parser.h
49-
COMMAND ${CMAKE_COMMAND} ARGS
50-
"-Dsource_dir=${source_dir}"
51-
"-Dbinary_dir=${binary_dir}"
52-
"-DMAIN_PROJECT_DIR=${CMAKE_SOURCE_DIR}"
53-
-P ${CMAKE_CURRENT_LIST_DIR}/postprocess-parser.cmake
54-
DEPENDS ${binary_dir}/parser.c ${binary_dir}/parser.h
55-
)
56-
else()
57-
message(FATAL_ERROR "parser.y was updated but parser.c not regenerated, and no bison available!")
58-
endif()
59-
else()
60-
file(COPY ${source_dir}/src/parser.c DESTINATION ${binary_dir}/src)
61-
file(COPY ${source_dir}/src/parser.h DESTINATION ${binary_dir}/src)
62-
endif()
63-
64-
set_source_files_properties(${binary_dir}/src/parser.c ${binary_dir}/src/parser.h PROPERTIES GENERATED TRUE)
65-
66-
set(headers
67-
include/idl/expression.h
68-
include/idl/file.h
69-
include/idl/print.h
70-
include/idl/processor.h
71-
include/idl/retcode.h
72-
include/idl/scope.h
73-
include/idl/stream.h
74-
include/idl/string.h
75-
include/idl/symbol.h
76-
include/idl/tree.h
77-
include/idl/vector.h
78-
include/idl/visit.h
79-
include/idl/heap.h
80-
${binary_dir}/include/idl/version.h)
81-
82-
set(sources
83-
src/symbol.c
84-
src/directive.c
85-
src/expression.c
86-
src/file.c
87-
src/processor.c
88-
src/scanner.c
89-
src/string.c
90-
src/annotation.c
91-
src/scope.c
92-
src/string.c
93-
src/tree.c
94-
src/vector.c
95-
src/visit.c
96-
src/print.c
97-
src/keylist.c
98-
src/hashid.c
99-
src/parser.c
100-
src/heap.c
101-
src/annotation.h
102-
src/directive.h
103-
src/expression.h
104-
src/file.h
105-
src/hashid.h
106-
src/parser.h
107-
src/scanner.h
108-
src/scope.h
109-
src/symbol.h
110-
src/tree.h
111-
src/keylist.h)
112-
113-
# import generic utility sources from ddsrt to avoid duplication
114-
# NOTE: an additional INTERFACE library defined in ddsrt would be ideal, but
115-
# the GENERATED property is not propagated before 3.20. using an OBJECT
116-
# library and propagating the object files through an INTERFACE library
117-
# can be done, but a proper export header can only be generated from the
118-
# final library.
119-
# see: https://gitlab.kitware.com/cmake/cmake/-/issues/18399
120-
set(script "${PROJECT_SOURCE_DIR}/src/ddsrt/rename.cmake")
121-
set(templates
122-
include/dds/ddsrt/misc.h
123-
include/dds/ddsrt/attributes.h
124-
include/dds/ddsrt/endian.h
125-
include/dds/ddsrt/md5.h
126-
src/md5.c)
127-
# FIXME: move general functionality to ddsrt
128-
129-
foreach(source ${templates})
130-
set(input "${PROJECT_SOURCE_DIR}/src/ddsrt/${source}")
131-
# map include path. i.e. map include/dds/ddsrt to include/idl
132-
string(REGEX REPLACE "(/dds(rt)?)+" "/idl" source "${source}")
133-
set(output "${binary_dir}/${source}")
134-
# process source file. i.e. replace dds and ddsrt with idl
135-
add_custom_command(
136-
OUTPUT ${output}
137-
COMMAND "${CMAKE_COMMAND}" -DNAMESPACE=idl
138-
-DINPUT_FILE=${input}
139-
-DOUTPUT_DIRECTORY=${binary_dir}
140-
-DOUTPUT_FILE=${output}
141-
-P ${script}
142-
DEPENDS ${input} ${script})
143-
if(source MATCHES "^include/.*\\.h")
144-
list(APPEND headers ${output})
145-
else()
146-
list(APPEND sources ${output})
147-
endif()
148-
endforeach()
149-
150-
add_library(idl SHARED ${headers} ${sources})
151-
152-
set_target_properties(
153-
idl PROPERTIES
154-
OUTPUT_NAME "cycloneddsidl"
155-
VERSION ${PROJECT_VERSION}
156-
SOVERSION ${PROJECT_VERSION_MAJOR})
157-
158-
generate_export_header(idl EXPORT_FILE_NAME include/idl/export.h)
159-
160-
161-
target_include_directories(
162-
idl
163-
PUBLIC
164-
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
165-
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
166-
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
167-
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
168-
INTERFACE
169-
"$<INSTALL_INTERFACE:include>")
170-
171-
target_link_libraries(idl PRIVATE Threads::Threads)
172-
173-
install(
174-
DIRECTORY
175-
"${source_dir}/include/idl"
176-
"${binary_dir}/include/idl"
177-
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
178-
COMPONENT dev
179-
FILES_MATCHING PATTERN "*.h")
180-
181-
install(
182-
TARGETS idl
183-
EXPORT "${CMAKE_PROJECT_NAME}"
184-
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT lib
185-
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib
186-
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT lib)
187-
188-
if (INSTALL_PDB)
189-
install(FILES $<TARGET_PDB_FILE:idl>
190-
DESTINATION "${CMAKE_INSTALL_BINDIR}"
191-
COMPONENT dev
192-
OPTIONAL)
193-
endif()
194-
195-
if(BUILD_TESTING)
196-
add_subdirectory(tests)
15+
add_subdirectory(idlparser)
16+
if(BUILD_IDLC)
17+
add_subdirectory(idlpp)
18+
add_subdirectory(idlc)
19719
endif()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)