Skip to content

Commit

Permalink
CMake flag for enabling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RajivChitale committed Feb 22, 2024
1 parent 253f31a commit 40aec71
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/mlbridge_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ cmake \
-DCMAKE_BUILD_TYPE="$BUILD" \
-DCMAKE_INSTALL_PREFIX=$REPO_DIR/install \
-DPROTOS_DIRECTORY=$REPO_DIR/test/protos \
-DPYTHON_UTILITIES_DIRECTORY=$REPO_DIR/test
-DPYTHON_UTILITIES_DIRECTORY=$REPO_DIR/test \
-DMLBRIDGE_ENABLE_TEST=ON

make -j -C $REPO_DIR/build_${BUILD,,} install
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ endif()

add_subdirectory(MLModelRunner)
add_subdirectory(SerDes)
add_subdirectory(test)
if(MLBRIDGE_ENABLE_TEST)
add_subdirectory(test)
endif()

if(LLVM_MLBRIDGE)
include(AddLLVM)
Expand Down Expand Up @@ -78,12 +80,12 @@ else()
set_property(TARGET MLCompilerBridgeC PROPERTY POSITION_INDEPENDENT_CODE 1)
set_target_properties(MLCompilerBridgeC PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
install(TARGETS MLCompilerBridgeC DESTINATION lib)

add_executable(MLCompilerBridgeTest $<TARGET_OBJECTS:MLBridgeCPPTest>)
target_link_libraries(MLCompilerBridgeTest PUBLIC MLCompilerBridge)
set_target_properties(MLCompilerBridgeTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
install(TARGETS MLCompilerBridgeTest DESTINATION bin)

if(MLBRIDGE_ENABLE_TEST)
add_executable(MLCompilerBridgeTest $<TARGET_OBJECTS:MLBridgeCPPTest>)
target_link_libraries(MLCompilerBridgeTest PUBLIC MLCompilerBridge)
set_target_properties(MLCompilerBridgeTest PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
install(TARGETS MLCompilerBridgeTest DESTINATION bin)
endif()
endif(LLVM_MLBRIDGE)

install(DIRECTORY include/ DESTINATION include)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Please see [here](https://iith-compilers.github.io/ML-Compiler-Bridge/) for docu
## Setup
`ML-Compiler-Bridge` can be built as a stand-alone library to generate `.a` files that can in turn be linked with any compiler.
1. `mkdir build && cd build`
2. `cmake [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_INSTALL_PREFIX=<Install_path>] -DONNXRUNTIME_ROOTDIR=<Path to ONNX install dir> -DPROTOS_DIRECTORY=<Path to protobuf files> -DTENSORFLOW_AOT_PATH=<Path to TensorFlow pip install dir> ../`
2. `cmake [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_INSTALL_PREFIX=<Install_path>] [-DMLBRIDGE_ENABLE_TEST=ON|OFF] -DONNXRUNTIME_ROOTDIR=<Path to ONNX install dir> -DPROTOS_DIRECTORY=<Path to protobuf files> -DTENSORFLOW_AOT_PATH=<Path to TensorFlow pip install dir> ../`
3. `make -j [&& make install]`

This process would generate `libMLCompilerBridge.a` and `libMLCompilerBridgeC.a` libraries under `build/lib` directory, required headers under `build/include` directory. `libMLCompilerBridgeC.a` exposes C APIs for using with C-based compilers like Pluto, where as `libMLCompilerBridge.a` exposes C++ APIs that can be used with any compiler written in C++.
Expand Down

0 comments on commit 40aec71

Please sign in to comment.