diff --git a/.github/workflows/cpp_examples.yml b/.github/workflows/cpp_examples.yml index fa3d5ae17..1f598435e 100644 --- a/.github/workflows/cpp_examples.yml +++ b/.github/workflows/cpp_examples.yml @@ -31,3 +31,28 @@ jobs: build-options: --parallel # Given we don't build too many resources we can leverage parallel - name: Run tests run: ./examples/array_multiplication/build/src/kompute_array_mult + + logistc-regression-example: + runs-on: ubuntu-latest + container: axsauze/kompute-builder:0.4 + env: + VK_ICD_FILENAMES: "/swiftshader/vk_swiftshader_icd.json" + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + - name: "[Release g++] Build & Test" + uses: KomputeProject/action-cmake-build@master + with: + build-dir: ${{github.workspace}}/examples/logistic_regression/build + source-dir: ${{github.workspace}}/examples/logistic_regression + cc: gcc + cxx: g++ + build-type: Debug + run-test: false + ctest-options: -V + configure-options: -DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=ON KOMPUTE_OPT_FROM_SOURCE=ON + build-options: --parallel # Given we don't build too many resources we can leverage parallel + - name: Run tests + run: ./examples/logistic_regression/build/src/kompute_array_mult diff --git a/examples/logistic_regression/CMakeLists.txt b/examples/logistic_regression/CMakeLists.txt index 475c0e01f..246e81338 100644 --- a/examples/logistic_regression/CMakeLists.txt +++ b/examples/logistic_regression/CMakeLists.txt @@ -3,6 +3,10 @@ project(kompute_logistic_regression) set(CMAKE_CXX_STANDARD 14) +# Options +option(KOMPUTE_OPT_GIT_TAG "The tag of the repo to use for the example" 1344ece4ac278f9b3be3b4555ffaace7a032b91f) +option(KOMPUTE_OPT_FROM_SOURCE "Whether to build example from source or from git fetch repo" 0) + # Set a default build type if none was specified # Based on: https://github.com/openchemistry/tomviz/blob/master/cmake/BuildType.cmake set(DEFAULT_BUILD_TYPE "Release") @@ -24,11 +28,15 @@ if(WIN32) # Install dlls in the same directory as the executable on Windows set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) endif() -include(FetchContent) -FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/KomputeProject/kompute.git - GIT_TAG 1344ece4ac278f9b3be3b4555ffaace7a032b91f) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases -FetchContent_MakeAvailable(kompute) -include_directories(${kompute_SOURCE_DIR}/src/include) +if(KOMPUTE_OPT_FROM_SOURCE) + add_subdirectory(../../ ${CMAKE_CURRENT_BINARY_DIR}/kompute_build) +else() + include(FetchContent) + FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/KomputeProject/kompute.git + GIT_TAG ${KOMPUTE_OPT_GIT_TAG}) + FetchContent_MakeAvailable(kompute) + include_directories(${kompute_SOURCE_DIR}/src/include) +endif() # Add to the list, so CMake can later find the code to compile shaders to header files list(APPEND CMAKE_PREFIX_PATH "${kompute_SOURCE_DIR}/cmake")