Skip to content

Commit

Permalink
Release v2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arobenko committed Jan 27, 2023
2 parents 0ed18c8 + a8f816e commit b49803f
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/actions_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ jobs:
- name: Install Packages
run: |
sudo apt install libqt5gui5 qtbase5-dev libboost-all-dev libxml2-dev gcc-${{matrix.cc_ver}} g++-${{matrix.cc_ver}} \
python3 libpython3-dev swig default-jdk default-jre
python3 libpython3-dev swig default-jdk default-jre emscripten
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
Expand All @@ -220,7 +220,7 @@ jobs:
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DDEMO1_GEN_PROTOCOL=ON -DDEMO1_GEN_TEST=ON -DDEMO1_GEN_TOOLS=ON \
-DDEMO1_GEN_SWIG=ON
-DDEMO1_GEN_SWIG=ON -DDEMO1_GEN_EMSCRIPTEN=ON
env:
CC: gcc-${{matrix.cc_ver}}
CXX: g++-${{matrix.cc_ver}}
Expand Down Expand Up @@ -370,7 +370,7 @@ jobs:
- name: Install Packages
run: |
sudo apt install libqt5gui5 qtbase5-dev libboost-all-dev libxml2-dev clang-${{matrix.cc_ver}} \
python3 libpython3-dev swig default-jdk default-jre
python3 libpython3-dev swig default-jdk default-jre emscripten
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
Expand All @@ -397,7 +397,7 @@ jobs:
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{matrix.type}} -DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_PREFIX_PATH=${{runner.workspace}}/build/install -DCMAKE_CXX_STANDARD=${{matrix.cpp}} \
-DDEMO1_GEN_PROTOCOL=ON -DDEMO1_GEN_TEST=ON -DDEMO1_GEN_TOOLS=ON \
-DDEMO1_GEN_SWIG=ON
-DDEMO1_GEN_SWIG=ON -DDEMO1_GEN_EMSCRIPTEN=ON
env:
CC: clang-${{matrix.cc_ver}}
CXX: clang++-${{matrix.cc_ver}}
Expand Down
72 changes: 71 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ option (DEMO1_GEN_TOOLS "Use commsdsl2tools_qt to generate cc_tools_qt plugin pr
option (DEMO1_BUILD_TOOLS "Build and install project generated by the commsdsl2tools_qt." ${DEMO1_GEN_TOOLS})
option (DEMO1_GEN_SWIG "Use commsdsl2swig to generate swig bindings project." OFF)
option (DEMO1_BUILD_SWIG "Build and install project generated by the commsdsl2swig." ${DEMO1_GEN_SWIG})
option (DEMO1_GEN_EMSCRIPTEN "Use commsdsl2emscripten to generate emscripten bindings project." OFF)
option (DEMO1_BUILD_EMSCRIPTEN "Build and install project generated by the commsdsl2emscripten." ${DEMO1_GEN_EMSCRIPTEN})
option (DEMO1_BUILD_EXAMPLES "Build examples." ON)

# Additional variables to be used if needed
Expand All @@ -22,12 +24,14 @@ option (DEMO1_BUILD_EXAMPLES "Build examples." ON)
# DEMO1_SWIG_OUTPUT_DIR - Path to swig output directory. If not provided <build_dir>/output_swig one is used.
# DEMO1_SWIG_SRC_DIR - Path to the commsdsl2swig sources. If not provided local "swig_src" dir is used.
# DEMO1_SWIG_LANGUAGES - Languages list to support by swig. If not provided "python java csharp" are chosen
# DEMO1_EMSCRIPTEN_OUTPUT_DIR - Path to emscripten output directory. If not provided <build_dir>/output_emscripten one is used.
# COMMSDSL2COMMS_EXTRA_ARGS - Extra arguments to pass to "commsdsl2comms"
# COMMSDSL2TEST_EXTRA_ARGS - Extra arguments to pass to "commsdsl2test"
# COMMSDSL2TOOLS_QT_EXTRA_ARGS - Extra arguments to pass to "commsdsl2tools_qt"
# COMMSDSL2SWIG_EXTRA_ARGS - Extra arguments to pass to "commsdsl2swig"
# COMMSDSL2EMSCRIPTEN_EXTRA_ARGS - Extra arguments to pass to "commsdsl2emscripten"

set (VERSION "2.0.1")
set (VERSION "2.1")

set (EXTERNALS_DIR "${PROJECT_SOURCE_DIR}/externals")

Expand Down Expand Up @@ -59,6 +63,10 @@ if ("${DEMO1_SWIG_LANGUAGES}" STREQUAL "")
set (DEMO1_SWIG_LANGUAGES python java csharp)
endif ()

if ("${DEMO1_EMSCRIPTEN_OUTPUT_DIR}" STREQUAL "")
set (DEMO1_EMSCRIPTEN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/output_emscripten")
endif ()

set (warn_as_error "--warn-as-err")
if (NOT DEMO1_WARN_AS_ERR)
set (warn_as_error)
Expand Down Expand Up @@ -304,6 +312,68 @@ if (DEMO1_GEN_SWIG)
endif ()
endif ()

if (DEMO1_GEN_EMSCRIPTEN)
find_program(COMMSDSL2EMSCRIPTEN commsdsl2emscripten PATH_SUFFIXES bin REQUIRED)
find_program(EMCMAKE_EXECUTABLE emcmake REQUIRED)

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

add_custom_target(rm_emscripten_tmp_tgt
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} ${schema_file}
)

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

if (DEMO1_BUILD_EMSCRIPTEN)
if ((NOT DEMO1_GEN_PROTOCOL) OR (NOT DEMO1_BUILD_PROTOCOL))
message (FATAL_ERROR "DEMO1_GEN_PROTOCOL and DEMO1_BUILD_PROTOCOL are required for DEMO1_BUILD_EMSCRIPTEN")
endif ()

execute_process(
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEMO1_EMSCRIPTEN_OUTPUT_DIR}
)

execute_process(
COMMAND ${CMAKE_COMMAND} -E touch ${DEMO1_EMSCRIPTEN_OUTPUT_DIR}/dummy.txt
)

find_package(LibComms REQUIRED)
get_target_property(comms_include_dirs cc::comms INTERFACE_INCLUDE_DIRECTORIES)
set (prot_include_dir "${CMAKE_INSTALL_PREFIX}/include")
set (extra_includes_path ${prot_include_dir} ${comms_include_dirs})
string (REPLACE ";" "|" extra_includes_path_str "${extra_includes_path}")


set (emscripten_build_dir ${CMAKE_CURRENT_BINARY_DIR}/emscripten_tgt_build)
ExternalProject_Add(
"emscripten_tgt"
BUILD_ALWAYS TRUE
DEPENDS "prot_tgt" "emscripten_output_tgt"
SOURCE_DIR ${DEMO1_EMSCRIPTEN_OUTPUT_DIR}
BINARY_DIR ${emscripten_build_dir}
CMAKE_COMMAND ${EMCMAKE_EXECUTABLE} ${CMAKE_COMMAND}
CMAKE_GENERATOR ${CMAKE_GENERATOR}
LIST_SEPARATOR |
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
-DOPT_MODULARIZE=ON
-DOPT_EXTRA_INCLUDE_DIRS=${extra_includes_path_str}
)
endif ()
endif ()

if (NOT DEMO1_BUILD_EXAMPLES)
return()
endif()
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ which can help in preparation of these dependencies. They are also used
in configuration of the [github actions](.github/workflows/actions_build.yml) and
[appveyor](.appveyor.yml).

The project's cmake configuration [options](CMakeLists.txt) allow building
bindings to other high level programming languages using [swig](https://www.swig.org/)
and [emscripten](https://emscripten.org/), see relevant commsdsl's
[documentation](https://github.com/commschamp/commsdsl/tree/master/doc) pages for details.

The [example](#examples) applications use [Boost](https://www.boost.org)
to parse their command line parameters as well as manage their asynchronous I/O.
In case Boost libraries are not installed in expected default location
Expand Down
4 changes: 2 additions & 2 deletions script/full_debug_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ ${SCRIPT_DIR}/prepare_externals.sh

cd ${BUILD_DIR}
cmake .. -DCMAKE_INSTALL_PREFIX=${COMMON_INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=Debug -DDEMO1_GEN_TEST=ON \
-DDEMO1_GEN_TOOLS=ON -DDEMO1_GEN_SWIG=ON "$@"
-DCMAKE_BUILD_TYPE=Debug -DDEMO1_BUILD_PROT_DOC=ON -DDEMO1_GEN_TEST=ON \
-DDEMO1_GEN_TOOLS=ON -DDEMO1_GEN_SWIG=ON -DDEMO1_GEN_EMSCRIPTEN=ON "$@"

procs=$(nproc)
if [ -n "${procs}" ]; then
Expand Down
5 changes: 4 additions & 1 deletion script/prepare_externals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ function build_commsdsl() {

echo "Building commsdsl ..."
mkdir -p ${COMMSDSL_BUILD_DIR}
CC=${CC_COMMSDSL} CXX=${CXX_COMMSDSL} cmake -S ${COMMSDSL_SRC_DIR} -B ${COMMSDSL_BUILD_DIR} -DCMAKE_INSTALL_PREFIX=${COMMSDSL_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} -DCOMMSDSL_INSTALL_LIBRARY=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON -DCOMMSDSL_BUILD_COMMSDSL2SWIG=ON
CC=${CC_COMMSDSL} CXX=${CXX_COMMSDSL} cmake -S ${COMMSDSL_SRC_DIR} -B ${COMMSDSL_BUILD_DIR} \
-DCMAKE_INSTALL_PREFIX=${COMMSDSL_INSTALL_DIR} -DCMAKE_BUILD_TYPE=${COMMON_BUILD_TYPE} \
-DCOMMSDSL_INSTALL_LIBRARY=OFF -DCOMMSDSL_BUILD_COMMSDSL2TEST=ON -DCOMMSDSL_BUILD_COMMSDSL2TOOLS_QT=ON \
-DCOMMSDSL_BUILD_COMMSDSL2SWIG=ON -DCOMMSDSL_BUILD_COMMSDSL2EMSCRIPTEN=ON
cmake --build ${COMMSDSL_BUILD_DIR} --config ${COMMON_BUILD_TYPE} --target install ${procs_param}
}

Expand Down

0 comments on commit b49803f

Please sign in to comment.