Skip to content

Commit a14c789

Browse files
committed
Release v3.0.4
2 parents 2d573b2 + 1f709bb commit a14c789

File tree

20 files changed

+861
-371
lines changed

20 files changed

+861
-371
lines changed

.github/workflows/actions_build.yml

Lines changed: 95 additions & 117 deletions
Large diffs are not rendered by default.

CMakeLists.txt

Lines changed: 132 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,35 @@ option (DEMO1_GEN_SWIG "Use commsdsl2swig to generate swig bindings project." OF
1414
option (DEMO1_BUILD_SWIG "Build and install project generated by the commsdsl2swig." ${DEMO1_GEN_SWIG})
1515
option (DEMO1_GEN_EMSCRIPTEN "Use commsdsl2emscripten to generate emscripten bindings project." OFF)
1616
option (DEMO1_BUILD_EMSCRIPTEN "Build and install project generated by the commsdsl2emscripten." ${DEMO1_GEN_EMSCRIPTEN})
17+
option (DEMO1_GEN_C "Use commsdsl2c to generate \"C\" wrappers project." OFF)
18+
option (DEMO1_BUILD_C "Build and install project generated by the commsdsl2c." ${DEMO1_GEN_C})
19+
option (DEMO1_GEN_LATEX "Use commsdsl2latex to generate protocol specification." OFF)
20+
option (DEMO1_BUILD_LATEX "Build and install project generated by the commsdsl2latex." ${DEMO1_GEN_C})
1721
option (DEMO1_BUILD_EXAMPLES "Build examples." ON)
1822

1923
# Additional variables to be used if needed
2024
# ---------------------------
2125
# DEMO1_PROT_OUTPUT_DIR - Path to protocol output directory. If not provided <build_dir>/output one is used.
22-
# DEMO1_TEST_OUTPUT_DIR - Path to test output directory. If not provided <build_dir>/output_tools one is used.
26+
# DEMO1_TEST_OUTPUT_DIR - Path to test output directory. If not provided <build_dir>/output_test one is used.
2327
# DEMO1_TOOLS_OUTPUT_DIR - Path to tools output directory. If not provided <build_dir>/output_tools one is used.
2428
# DEMO1_TOOLS_QT_VER - Major Qt version to be used when building tools output. Defaults to 5
2529
# DEMO1_SWIG_OUTPUT_DIR - Path to swig output directory. If not provided <build_dir>/output_swig one is used.
2630
# DEMO1_SWIG_SRC_DIR - Path to the commsdsl2swig sources. If not provided local "src/swig" dir is used.
2731
# DEMO1_SWIG_LANGUAGES - Languages list to support by swig. If not provided "python java csharp" are chosen
2832
# DEMO1_EMSCRIPTEN_OUTPUT_DIR - Path to emscripten output directory. If not provided <build_dir>/output_emscripten one is used.
33+
# DEMO1_C_OUTPUT_DIR - Path to "c" output directory. If not provided <build_dir>/output_c one is used.
34+
# DEMO1_LATEX_OUTPUT_DIR - Path to latex output directory. If not provided <build_dir>/output_latex one is used.
2935
# DEMO1_CCACHE_EXECUTABLE - Custom ccache executable
3036
# COMMSDSL2COMMS_EXTRA_ARGS - Extra arguments to pass to "commsdsl2comms"
3137
# COMMSDSL2TEST_EXTRA_ARGS - Extra arguments to pass to "commsdsl2test"
3238
# COMMSDSL2TOOLS_QT_EXTRA_ARGS - Extra arguments to pass to "commsdsl2tools_qt"
3339
# COMMSDSL2SWIG_EXTRA_ARGS - Extra arguments to pass to "commsdsl2swig"
3440
# COMMSDSL2EMSCRIPTEN_EXTRA_ARGS - Extra arguments to pass to "commsdsl2emscripten"
41+
# COMMSDSL2C_EXTRA_ARGS - Extra arguments to pass to "commsdsl2c"
42+
# COMMSDSL2LATEX_EXTRA_ARGS - Extra arguments to pass to "commsdsl2latex"
3543

36-
set (DEMO1_VERSION "3.0.3")
37-
set (DEMO1_MIN_COMMSDSL_VERSION "7.1")
44+
set (DEMO1_VERSION "3.0.4")
45+
set (DEMO1_MIN_COMMSDSL_VERSION "7.3")
3846

3947
if (("${CMAKE_VERSION}" VERSION_GREATER_EQUAL "3.30") AND
4048
(NOT DEFINED CMAKE_POLICY_DEFAULT_CMP0167))
@@ -80,6 +88,14 @@ if ("${DEMO1_EMSCRIPTEN_OUTPUT_DIR}" STREQUAL "")
8088
set (DEMO1_EMSCRIPTEN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/output_emscripten")
8189
endif ()
8290

91+
if ("${DEMO1_C_OUTPUT_DIR}" STREQUAL "")
92+
set (DEMO1_C_OUTPUT_DIR "${CMAKE_BINARY_DIR}/output_c")
93+
endif ()
94+
95+
if ("${DEMO1_LATEX_OUTPUT_DIR}" STREQUAL "")
96+
set (DEMO1_LATEX_OUTPUT_DIR "${CMAKE_BINARY_DIR}/output_latex")
97+
endif ()
98+
8399
if ("${DEMO1_TOOLS_QT_VER}" STREQUAL "")
84100
set (DEMO1_TOOLS_QT_VER 5)
85101
endif ()
@@ -162,7 +178,7 @@ if (DEMO1_GEN_TEST)
162178

163179
add_custom_target("test_output_tgt" ALL
164180
COMMAND ${CMAKE_COMMAND} -E remove_directory ${test_tmp_dir}
165-
COMMAND ${COMMSDSL2TEST} ${warn_as_error} ${COMMSDSL2TEST_EXTRA_ARGS}
181+
COMMAND ${COMMSDSL2TEST} ${warn_as_error} -V ${DEMO1_VERSION} ${COMMSDSL2TEST_EXTRA_ARGS}
166182
-o ${test_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/test ${schema_file}
167183
COMMAND ${CMAKE_COMMAND}
168184
-DGENERATED="${test_tmp_dir}" -DOUTPUT="${DEMO1_TEST_OUTPUT_DIR}"
@@ -214,7 +230,7 @@ if (DEMO1_GEN_TOOLS)
214230

215231
add_custom_target("tools_output_tgt" ALL
216232
COMMAND ${CMAKE_COMMAND} -E remove_directory ${tools_tmp_dir}
217-
COMMAND ${COMMSDSL2TOOLS_QT} ${warn_as_error} ${COMMSDSL2TOOLS_QT_EXTRA_ARGS}
233+
COMMAND ${COMMSDSL2TOOLS_QT} ${warn_as_error} -V ${DEMO1_VERSION} ${COMMSDSL2TOOLS_QT_EXTRA_ARGS}
218234
--protocol "::CC Demo1:Synthenic demo protocol to demonstrate definition of various fields as well as simple protocol framing.:cc.Demo1ProtocolPlugin"
219235
-o ${tools_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/tools ${schema_file}
220236
COMMAND ${CMAKE_COMMAND}
@@ -267,7 +283,7 @@ if (DEMO1_GEN_SWIG)
267283

268284
add_custom_target("swig_output_tgt" ALL
269285
COMMAND ${CMAKE_COMMAND} -E remove_directory ${swig_tmp_dir}
270-
COMMAND ${COMMSDSL2SWIG} ${warn_as_error} ${COMMSDSL2SWIG_EXTRA_ARGS}
286+
COMMAND ${COMMSDSL2SWIG} ${warn_as_error} -V ${DEMO1_VERSION} ${COMMSDSL2SWIG_EXTRA_ARGS}
271287
-c ${DEMO1_SWIG_SRC_DIR} -o ${swig_tmp_dir} ${schema_file}
272288
COMMAND ${CMAKE_COMMAND}
273289
-DGENERATED="${swig_tmp_dir}" -DOUTPUT="${DEMO1_SWIG_OUTPUT_DIR}"
@@ -325,7 +341,7 @@ if (DEMO1_GEN_EMSCRIPTEN)
325341

326342
add_custom_target("emscripten_output_tgt" ALL
327343
COMMAND ${CMAKE_COMMAND} -E remove_directory ${emscripten_tmp_dir}
328-
COMMAND ${COMMSDSL2EMSCRIPTEN} ${warn_as_error} ${COMMSDSL2EMSCRIPTEN_EXTRA_ARGS}
344+
COMMAND ${COMMSDSL2EMSCRIPTEN} ${warn_as_error} -V ${DEMO1_VERSION} ${COMMSDSL2EMSCRIPTEN_EXTRA_ARGS}
329345
-o ${emscripten_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/emscripten ${schema_file}
330346
COMMAND ${CMAKE_COMMAND}
331347
-DGENERATED="${emscripten_tmp_dir}" -DOUTPUT="${DEMO1_EMSCRIPTEN_OUTPUT_DIR}"
@@ -373,6 +389,115 @@ if (DEMO1_GEN_EMSCRIPTEN)
373389
endif ()
374390
endif ()
375391

392+
if (DEMO1_GEN_C)
393+
find_program(COMMSDSL2C commsdsl2c PATH_SUFFIXES bin REQUIRED)
394+
execute_process(COMMAND "${COMMSDSL2C}" --version OUTPUT_VARIABLE commsdsl2c_version)
395+
if ("${commsdsl2c_version}" VERSION_LESS "${DEMO1_MIN_COMMSDSL_VERSION}")
396+
message (FATAL_ERROR "Version of commsdsl2c is too old, required minimum is v${DEMO1_MIN_COMMSDSL_VERSION}.")
397+
endif ()
398+
399+
set (c_tmp_dir "${CMAKE_BINARY_DIR}/output_c.tmp")
400+
401+
add_custom_target("c_output_tgt" ALL
402+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${c_tmp_dir}
403+
COMMAND ${COMMSDSL2C} ${warn_as_error} -V ${DEMO1_VERSION} ${COMMSDSL2C_EXTRA_ARGS}
404+
-o ${c_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/c ${schema_file}
405+
COMMAND ${CMAKE_COMMAND}
406+
-DGENERATED="${c_tmp_dir}" -DOUTPUT="${DEMO1_C_OUTPUT_DIR}"
407+
-P "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake"
408+
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})
409+
410+
if (DEMO1_BUILD_C)
411+
if ((NOT DEMO1_GEN_PROTOCOL) OR (NOT DEMO1_BUILD_PROTOCOL))
412+
message (FATAL_ERROR "DEMO1_GEN_PROTOCOL and DEMO1_BUILD_PROTOCOL are required for DEMO1_BUILD_C")
413+
endif ()
414+
415+
execute_process(
416+
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEMO1_C_OUTPUT_DIR}
417+
)
418+
419+
execute_process(
420+
COMMAND ${CMAKE_COMMAND} -E touch ${DEMO1_C_OUTPUT_DIR}/dummy.txt
421+
)
422+
423+
set (c_build_dir ${CMAKE_CURRENT_BINARY_DIR}/c_tgt_build)
424+
ExternalProject_Add(
425+
"c_tgt"
426+
BUILD_ALWAYS TRUE
427+
DEPENDS "prot_tgt" "c_output_tgt"
428+
SOURCE_DIR ${DEMO1_C_OUTPUT_DIR}
429+
BINARY_DIR ${c_build_dir}
430+
LIST_SEPARATOR |
431+
CMAKE_ARGS
432+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
433+
-DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_GENERATOR_PLATFORM=${CMAKE_GENERATOR_PLATFORM}
434+
-DCMAKE_GENERATOR_TOOLSET=${CMAKE_GENERATOR_TOOLSET} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
435+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}
436+
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${combined_prefix_path_str}
437+
-DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
438+
-DOPT_USE_CCACHE=${DEMO1_USE_CCACHE}
439+
-DOPT_CCACHE_EXECUTABLE=${DEMO1_CCACHE_EXECUTABLE}
440+
)
441+
442+
find_package(Doxygen)
443+
if (DEMO1_BUILD_PROT_DOC AND DOXYGEN_FOUND)
444+
ExternalProject_Add_Step(
445+
"c_tgt"
446+
"doc"
447+
COMMAND ${CMAKE_COMMAND} --build ${c_build_dir} --target doc_cc_demo1_c
448+
DEPENDEES "build"
449+
DEPENDERS "install"
450+
)
451+
endif ()
452+
endif ()
453+
endif ()
454+
455+
if (DEMO1_GEN_LATEX)
456+
find_program(COMMSDSL2LATEX commsdsl2latex PATH_SUFFIXES bin REQUIRED)
457+
execute_process(COMMAND "${COMMSDSL2LATEX}" --version OUTPUT_VARIABLE commsdsl2latex_version)
458+
if ("${commsdsl2latex_version}" VERSION_LESS "${DEMO1_MIN_COMMSDSL_VERSION}")
459+
message (FATAL_ERROR "Version of commsdsl2latex is too old, required minimum is v${DEMO1_MIN_COMMSDSL_VERSION}.")
460+
endif ()
461+
462+
set (latex_tmp_dir "${CMAKE_BINARY_DIR}/output_latex.tmp")
463+
464+
add_custom_target("latext_output_tgt" ALL
465+
COMMAND ${CMAKE_COMMAND} -E remove_directory ${latex_tmp_dir}
466+
COMMAND ${COMMSDSL2LATEX} ${warn_as_error} ${COMMSDSL2LATEX_EXTRA_ARGS}
467+
-o ${latex_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/latex ${schema_file}
468+
COMMAND ${CMAKE_COMMAND}
469+
-DGENERATED="${latex_tmp_dir}" -DOUTPUT="${DEMO1_LATEX_OUTPUT_DIR}"
470+
-P "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake"
471+
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})
472+
473+
if (DEMO1_BUILD_LATEX)
474+
execute_process(
475+
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEMO1_LATEX_OUTPUT_DIR}
476+
)
477+
478+
execute_process(
479+
COMMAND ${CMAKE_COMMAND} -E touch ${DEMO1_LATEX_OUTPUT_DIR}/dummy.txt
480+
)
481+
482+
set (latex_build_dir ${CMAKE_CURRENT_BINARY_DIR}/latex_tgt_build)
483+
ExternalProject_Add(
484+
"latex_tgt"
485+
BUILD_ALWAYS TRUE
486+
DEPENDS "latext_output_tgt"
487+
SOURCE_DIR ${DEMO1_LATEX_OUTPUT_DIR}
488+
BINARY_DIR ${latex_build_dir}
489+
LIST_SEPARATOR |
490+
CMAKE_ARGS
491+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
492+
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${combined_prefix_path_str}
493+
BUILD_COMMAND
494+
${CMAKE_COMMAND} --build ${latex_build_dir} --config ${CMAKE_BUILD_TYPE} --target all_artifacts
495+
INSTALL_COMMAND
496+
${CMAKE_COMMAND} -E echo "No install for documentation build"
497+
)
498+
endif ()
499+
endif ()
500+
376501
if (NOT DEMO1_BUILD_EXAMPLES)
377502
return()
378503
endif()

dsl/schema.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<validValue name="Variants" val="11" />
1717
</enum>
1818
</fields>
19-
19+
2020
<frame name="Frame">
2121
<sync name="Sync">
2222
<int name="Sync" type="uint16" defaultValue="0xabcd" validValue="0xabcd" failOnInvalid="true"/>
@@ -29,24 +29,24 @@
2929
<checksum name="Checksum" alg="crc-ccitt" from="Size">
3030
<int name="Checksum" type="uint16" />
3131
</checksum>
32-
</frame>
33-
32+
</frame>
33+
3434
<message name="Ack" id="MsgId.Ack" sender="Server">
3535
<ref field="MsgId" />
3636
</message>
37-
37+
3838
<message name="SimpleInts" id="MsgId.SimpleInts" displayName="Simple Ints" sender="client">
3939
<int name="F1" type="int8" defaultValue="S1">
4040
<special name="S1" val="1" />
41-
</int>
41+
</int>
4242
<int name="F2" type="uint8" defaultValue="2" />
43-
<int name="F3" type="int16" defaultValue="3" />
43+
<int name="F3" type="int16" defaultValue="3" />
4444
<int name="F4" type="uint16" defaultValue="4" />
45-
<int name="F5" type="int32" defaultValue="5"/>
45+
<int name="F5" type="int32" defaultValue="5"/>
4646
<int name="F6" type="uint32" defaultValue="6">
4747
<special name="S1" val="0xffffffff" />
4848
</int>
49-
<int name="F7" type="int64" defaultValue="7"/>
49+
<int name="F7" type="int64" defaultValue="7"/>
5050
<int name="F8" type="uint64" defaultValue="8"/>
5151
<int name="F9" type="intvar" length="4" defaultValue="9" />
5252
<int name="F10" type="uintvar" length="4" defaultValue="10" endian="little">
@@ -83,11 +83,11 @@
8383
<float name="Timeout" type="float" units="sec">
8484
<special name="Infinite" val="0.0" />
8585
<special name="Invalid" val="nan" />
86-
</float>
86+
</float>
8787
<float name="Distance" type="float" units="m" defaultValue="Invalid" displayDecimals="3">
8888
<special name="Infinite" val="inf" />
8989
<special name="Invalid" val="nan" />
90-
</float>
90+
</float>
9191
</message>
9292

9393
<message name="Enums" id="MsgId.Enums" sender="client">
@@ -339,5 +339,5 @@
339339
</lengthPrefix>
340340
</list>
341341
</fields>
342-
</message>
342+
</message>
343343
</schema>

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ if (DEMO1_USE_CCACHE)
3333

3434
if (NOT "${DEMO1_CCACHE_EXECUTABLE}" STREQUAL "")
3535
list (APPEND extra_opts CCACHE_EXECTUABLE "${DEMO1_CCACHE_EXECUTABLE}")
36-
endif ()
36+
endif ()
3737
endif()
3838

3939
cc_compile(${extra_opts})

examples/client/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ if (WIN32)
2121
${name} Setupapi.lib Ws2_32.lib imm32.lib winmm.lib)
2222
endif ()
2323

24-
2524
add_dependencies(${name} ${PROT_OUTPUT_TGT})
2625

2726
install(TARGETS ${name}

0 commit comments

Comments
 (0)