diff --git a/.github/workflows/mlbridge_build.sh b/.github/workflows/mlbridge_build.sh index dd429da3..606ba82e 100644 --- a/.github/workflows/mlbridge_build.sh +++ b/.github/workflows/mlbridge_build.sh @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index 62e555be..b79be15a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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_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_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) diff --git a/README.md b/README.md index 30147f98..34a3ec9c 100644 --- a/README.md +++ b/README.md @@ -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=] -DONNXRUNTIME_ROOTDIR= -DPROTOS_DIRECTORY= -DTENSORFLOW_AOT_PATH= ../` +2. `cmake [-DCMAKE_BUILD_TYPE=Release|Debug] [-DCMAKE_INSTALL_PREFIX=] [-DMLBRIDGE_ENABLE_TEST=ON|OFF] -DONNXRUNTIME_ROOTDIR= -DPROTOS_DIRECTORY= -DTENSORFLOW_AOT_PATH= ../` 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++.