Skip to content

Commit

Permalink
Simplifying cmake script.
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Dec 25, 2024
1 parent 14a4a4b commit cb925e1
Showing 1 changed file with 14 additions and 54 deletions.
68 changes: 14 additions & 54 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,15 @@ if (DEMO3_GEN_PROTOCOL)

set (prot_tmp_dir "${CMAKE_BINARY_DIR}/output.tmp")

add_custom_target(rm_prot_tmp_tgt
add_custom_target(${PROT_OUTPUT_TGT} ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${prot_tmp_dir}
)

add_custom_command(
OUTPUT ${prot_tmp_dir}
DEPENDS ${schema_file} ${src_files} rm_prot_tmp_tgt
COMMAND ${COMMSDSL2COMMS} ${warn_as_error} -V ${DEMO3_VERSION}
-o ${prot_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/protocol
${COMMSDSL2COMMS_EXTRA_ARGS} ${schema_file}
)

add_custom_target(${PROT_OUTPUT_TGT} ALL
${COMMSDSL2COMMS_EXTRA_ARGS} ${schema_file}
COMMAND ${CMAKE_COMMAND}
-DGENERATED="${prot_tmp_dir}" -DOUTPUT="${DEMO3_PROT_OUTPUT_DIR}"
-P "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake"
DEPENDS ${prot_tmp_dir} "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})

if (DEMO3_BUILD_PROTOCOL)
execute_process(
Expand Down Expand Up @@ -168,22 +160,14 @@ if (DEMO3_GEN_TEST)

set (test_tmp_dir "${CMAKE_BINARY_DIR}/output_test.tmp")

add_custom_target(rm_test_tmp_tgt
add_custom_target("test_output_tgt" ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${test_tmp_dir}
)

add_custom_command(
OUTPUT ${test_tmp_dir}
DEPENDS ${schema_file} ${src_files} rm_test_tmp_tgt
COMMAND ${COMMSDSL2TEST} ${warn_as_error} ${COMMSDSL2TEST_EXTRA_ARGS}
-o ${test_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/test ${schema_file}
)

add_custom_target("test_output_tgt" ALL
-o ${test_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/test ${schema_file}
COMMAND ${CMAKE_COMMAND}
-DGENERATED="${test_tmp_dir}" -DOUTPUT="${DEMO3_TEST_OUTPUT_DIR}"
-P "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake"
DEPENDS ${test_tmp_dir} "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})

if (DEMO3_BUILD_TEST)
if ((NOT DEMO3_GEN_PROTOCOL) OR (NOT DEMO3_BUILD_PROTOCOL))
Expand Down Expand Up @@ -228,23 +212,15 @@ if (DEMO3_GEN_TOOLS)

set (tools_tmp_dir "${CMAKE_BINARY_DIR}/output_tools.tmp")

add_custom_target(rm_tools_tmp_tgt
add_custom_target("tools_output_tgt" ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${tools_tmp_dir}
)

add_custom_command(
OUTPUT ${tools_tmp_dir}
DEPENDS ${schema_file} ${src_files} rm_tools_tmp_tgt
COMMAND ${COMMSDSL2TOOLS_QT} ${warn_as_error} ${COMMSDSL2TOOLS_QT_EXTRA_ARGS}
--protocol "::CC Demo3:Synthenic demo protocol to demonstrate protocol versioning where the version is reported in the first Connect message.:cc.Demo3ProtocolPlugin"
-o ${tools_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/tools ${schema_file}
)

add_custom_target("tools_output_tgt" ALL
-o ${tools_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/tools ${schema_file}
COMMAND ${CMAKE_COMMAND}
-DGENERATED="${tools_tmp_dir}" -DOUTPUT="${DEMO3_TOOLS_OUTPUT_DIR}"
-P "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake"
DEPENDS ${tools_tmp_dir} "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})

if (DEMO3_BUILD_TOOLS)
if ((NOT DEMO3_GEN_PROTOCOL) OR (NOT DEMO3_BUILD_PROTOCOL))
Expand Down Expand Up @@ -289,22 +265,14 @@ if (DEMO3_GEN_SWIG)

set (swig_tmp_dir "${CMAKE_BINARY_DIR}/output_swig.tmp")

add_custom_target(rm_swig_tmp_tgt
add_custom_target("swig_output_tgt" ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${swig_tmp_dir}
)

add_custom_command(
OUTPUT ${swig_tmp_dir}
DEPENDS ${schema_file} ${src_files} rm_swig_tmp_tgt
COMMAND ${COMMSDSL2SWIG} ${warn_as_error} ${COMMSDSL2SWIG_EXTRA_ARGS}
-c ${DEMO3_SWIG_SRC_DIR} -o ${swig_tmp_dir} ${schema_file}
)

add_custom_target("swig_output_tgt" ALL
-c ${DEMO3_SWIG_SRC_DIR} -o ${swig_tmp_dir} ${schema_file}
COMMAND ${CMAKE_COMMAND}
-DGENERATED="${swig_tmp_dir}" -DOUTPUT="${DEMO3_SWIG_OUTPUT_DIR}"
-P "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake"
DEPENDS ${swig_tmp_dir} "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})

if (DEMO3_BUILD_SWIG)
if ((NOT DEMO3_GEN_PROTOCOL) OR (NOT DEMO3_BUILD_PROTOCOL))
Expand Down Expand Up @@ -355,22 +323,14 @@ if (DEMO3_GEN_EMSCRIPTEN)

set (emscripten_tmp_dir "${CMAKE_BINARY_DIR}/output_emscripten.tmp")

add_custom_target(rm_emscripten_tmp_tgt
add_custom_target("emscripten_output_tgt" ALL
COMMAND ${CMAKE_COMMAND} -E remove_directory ${emscripten_tmp_dir}
)

add_custom_command(
OUTPUT ${emscripten_tmp_dir}
DEPENDS ${schema_file} ${src_files} rm_emscripten_tmp_tgt
COMMAND ${COMMSDSL2EMSCRIPTEN} ${warn_as_error} ${COMMSDSL2EMSCRIPTEN_EXTRA_ARGS}
-o ${emscripten_tmp_dir} -c ${PROJECT_SOURCE_DIR}/src/emscripten ${schema_file}
)

add_custom_target("emscripten_output_tgt" ALL
COMMAND ${CMAKE_COMMAND}
-DGENERATED="${emscripten_tmp_dir}" -DOUTPUT="${DEMO3_EMSCRIPTEN_OUTPUT_DIR}"
-P "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake"
DEPENDS ${emscripten_tmp_dir} "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})
DEPENDS "${CMAKE_CURRENT_LIST_DIR}/CopyGenerated.cmake" ${schema_file})

if (DEMO3_BUILD_EMSCRIPTEN)
if ((NOT DEMO3_GEN_PROTOCOL) OR (NOT DEMO3_BUILD_PROTOCOL))
Expand Down

0 comments on commit cb925e1

Please sign in to comment.