Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/scripts/build-c-api-bindings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ echo "compiler: $(${CXX:-c++} --version | head -1)"

rm -rf "${BUILD_DIR}" "${INSTALL_DIR}"

cmake -B"${BUILD_DIR}" -S"${WORKSPACE}/bindings/c" \
cmake -B"${BUILD_DIR}" -S"${WORKSPACE}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_INSTALL_LIBDIR=lib \
-DSVS_BUILD_C_API=ON \
-DSVS_BUILD_C_API_TESTS=ON \
-DSVS_BUILD_EXAMPLES=ON \
-DSVS_RUNTIME_ENABLE_LVQ_LEANVEC="${ENABLE_LVQ_LEANVEC}" \
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/test-c-api-unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ ctest --test-dir "${BUILD_DIR}" --output-on-failure --no-tests=error
# exit once already, so they are part of the gate.
for sample in c_api_simple c_api_save_load c_api_dynamic; do
echo "::group::${sample}"
"${BUILD_DIR}/samples/${sample}"
"${BUILD_DIR}/examples/c/${sample}"
echo "::endgroup::"
done
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,22 @@ endif()
##### Build Objects
#####

if(SVS_BUILD_C_API)
add_subdirectory(bindings/c)
if(SVS_BUILD_C_API_TESTS)
include(CTest)
enable_testing()
endif()
endif()

if(SVS_BUILD_BINARIES)
add_subdirectory(utils)
endif()

if(SVS_BUILD_TESTS)
# Add test to CTest
include(CTest)
enable_testing()
add_subdirectory(tests)
endif()

Expand Down
4 changes: 0 additions & 4 deletions bindings/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,3 @@ if(SVS_BUILD_C_API_TESTS)
endif()
add_subdirectory(tests)
endif()

if(SVS_BUILD_EXAMPLES)
add_subdirectory(samples)
endif()
5 changes: 5 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ option(SVS_BUILD_BINARIES
OFF # enabled by default
)

option(SVS_BUILD_C_API
"Build C API bindings"
OFF # disabled by default
)

option(SVS_BUILD_TESTS
"Build the unit test suite."
OFF # disabled by default
Expand Down
4 changes: 4 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
# limitations under the License.

add_subdirectory(cpp)

if(SVS_BUILD_C_API)
add_subdirectory(c)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

project(svs_c_api_samples LANGUAGES C)
foreach(SAMPLE_NAME simple save_load dynamic)
set(SAMPLE_TARGET c_api_${SAMPLE_NAME})
list(APPEND SAMPLE_TARGETS ${SAMPLE_TARGET})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading