Skip to content

Commit

Permalink
Use batch mode for mcc due to licensing constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanpo committed May 8, 2024
1 parent 54129d5 commit 116448e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Build OpenTelemetry-Matlab
working-directory: opentelemetry-matlab
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DUSE_BATCH_FOR_MCC=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Run tests
env:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake -S . -B build -G Ninja -DCMAKE_CXX_COMPILER="cl.exe" -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DUSE_BATCH_FOR_MCC=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Run tests
env:
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Build OpenTelemetry-Matlab
working-directory: opentelemetry-matlab
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON -DUSE_BATCH_FOR_MCC=ON -DCMAKE_INSTALL_PREFIX=${{ env.OPENTELEMETRY_MATLAB_INSTALL }}
cmake --build build --config Release --target install
- name: Run tests
env:
Expand Down
13 changes: 11 additions & 2 deletions examples/context_propagation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Set this option to ON if running in GitHub Actions workflows
option(USE_BATCH_FOR_MCC "Running on GitHub Actions workflows requires calling mcc using matlab-batch due to licensing constraints." OFF)

# C++ target
set(CONTEXTPROP_EXAMPLE_CPP_TARGET contextprop_example_client)
Expand Down Expand Up @@ -38,9 +40,16 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${LIBMEXCLASS_PROXY_INSTAL
DEPENDS ${OPENTELEMETRY_MEX_GATEWAY_NAME})

# Call mcc to create .ctf file for deployment with MATLAB Production Server
if(USE_BATCH_FOR_MCC)
set(MCC_START "matlab-batch \"mcc")
set(MCC_END "\"")
else()
set(MCC_START ${Matlab_MCC_COMPILER})
set(MCC_END "")
endif()
add_custom_target(${CONTEXTPROP_EXAMPLE_MATLAB_TARGET} ALL
matlab-batch \"mcc -W CTF:${CONTEXTPROP_EXAMPLE_DEPLOYNAME}${ARCHIVE_ROUTES} -U ${CONTEXTPROP_EXAMPLE_MATLAB_SOURCE}
${MCC_START} -W CTF:${CONTEXTPROP_EXAMPLE_DEPLOYNAME}${ARCHIVE_ROUTES} -U ${CONTEXTPROP_EXAMPLE_MATLAB_SOURCE}
-a ${CMAKE_SOURCE_DIR}/api/trace -a ${CMAKE_SOURCE_DIR}/api/context -a ${CMAKE_SOURCE_DIR}/api/common -a ${CMAKE_SOURCE_DIR}/sdk/trace
-a ${CMAKE_SOURCE_DIR}/sdk/common -a ${CMAKE_SOURCE_DIR}/exporters/otlp -a ${${LIBMEXCLASS_FETCH_CONTENT_NAME}_SOURCE_DIR}/libmexclass/matlab
-a ${CMAKE_CURRENT_BINARY_DIR}/${LIBMEXCLASS_PROXY_INSTALLED_DIR}\"
-a ${CMAKE_CURRENT_BINARY_DIR}/${LIBMEXCLASS_PROXY_INSTALLED_DIR}${MCC_END}
DEPENDS ${CONTEXTPROP_EXAMPLE_MATLAB_SOURCE} ${CMAKE_CURRENT_BINARY_DIR}/${LIBMEXCLASS_PROXY_INSTALLED_DIR})

0 comments on commit 116448e

Please sign in to comment.