Skip to content

Commit 2d91e52

Browse files
committed
fix more issues
1 parent b483ad2 commit 2d91e52

File tree

6 files changed

+48
-25
lines changed

6 files changed

+48
-25
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ jobs:
2626
2727
- name: Configure and build
2828
run: |
29-
cmake . -B build -G Ninja -D VISP_FMT_LIB=ON
30-
cmake --build build --config Release
29+
cmake . -B build -G Ninja \
30+
-D CMAKE_BUILD_TYPE=Release \
31+
-D VISP_CI=ON \
32+
-D VISP_FMT_LIB=ON
33+
cmake --build build
3134
3235
- name: Run tests
33-
run: ctest build -C Release
36+
run: ctest build
3437

3538
build-test-ubuntu-vulkan:
3639
name: Build & Test on Ubuntu 22.04 with Vulkan
@@ -51,11 +54,15 @@ jobs:
5154
5255
- name: Configure and build with Vulkan
5356
run: |
54-
cmake . -B build -G Ninja -D VISP_VULKAN=ON -D VISP_FMT_LIB=ON
55-
cmake --build build --config Release
57+
cmake . -B build -G Ninja \
58+
-D CMAKE_BUILD_TYPE=Release \
59+
-D VISP_CI=ON \
60+
-D VISP_VULKAN=ON \
61+
-D VISP_FMT_LIB=ON
62+
cmake --build build
5663
5764
- name: Run tests
58-
run: ctest build -C Release
65+
run: ctest build
5966

6067
build-test-windows:
6168
name: Build & Test on Windows (CPU only)
@@ -72,11 +79,13 @@ jobs:
7279

7380
- name: Configure and build
7481
run: |
75-
cmake . -B build -G Ninja
76-
cmake --build build --config Release
82+
cmake . -B build -G Ninja \
83+
-D CMAKE_BUILD_TYPE=Release \
84+
-D VISP_CI=ON
85+
cmake --build build
7786
7887
- name: Run tests
79-
run: ctest build -C Release
88+
run: ctest build
8089

8190
build-test-macos:
8291
name: Build & Test on macOS (CPU only)
@@ -93,8 +102,13 @@ jobs:
93102

94103
- name: Configure and build
95104
run: |
96-
cmake -G Ninja . -B build -D GGML_METAL=OFF -D GGML_RPC=ON -D CMAKE_BUILD_RPATH="@loader_path"
97-
cmake --build build --config Release
105+
cmake -G Ninja . -B build \
106+
-D CMAKE_BUILD_TYPE=Release \
107+
-D VISP_CI=ON \
108+
-D GGML_METAL=OFF \
109+
-D GGML_RPC=ON \
110+
-D CMAKE_BUILD_RPATH="@loader_path"
111+
cmake --build build
98112
99113
- name: Run tests
100-
run: ctest build -C Release
114+
run: ctest build

CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ endif()
1818

1919
if(VISP_DEV)
2020
set(VISP_ASSERT "VISP_ASSERT_BREAK")
21+
elseif(VISP_CI)
22+
set(VISP_ASSERT "VISP_ASSERT_THROW")
2123
elseif(CMAKE_BUILD_TYPE)
2224
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
2325
set(VISP_ASSERT "VISP_ASSERT_BREAK")
@@ -63,11 +65,15 @@ endif()
6365
set(GGML_VULKAN ${VISP_VULKAN})
6466
set(GGML_LLAMAFILE ON)
6567
if(VISP_CI)
66-
set(GGML_NATIVE OFF)
6768
set(GGML_BACKEND_DL ON)
68-
foreach (feat SSE42 AVX AVX2 F16C BMI2 FMA) # ~haswell and newer
69-
set(GGML_${feat} ON)
70-
endforeach()
69+
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "^(aarch64|arm.*|ARM64)$")
70+
# set default for ARM
71+
else()
72+
set(GGML_NATIVE OFF)
73+
foreach (feat SSE42 AVX AVX2 F16C BMI2 FMA) # ~haswell and newer
74+
set(GGML_${feat} ON)
75+
endforeach()
76+
endif()
7177
endif()
7278
add_subdirectory(depend/ggml)
7379

src/util/string.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,14 @@ inline void assertion_failure(char const* file, int line, char const* expr) {
8787
auto msg = format<fixed_string<256>>("Assertion failed at {}:{}: {}\n", file, line, expr);
8888
fwrite(msg.data, 1, msg.length, stderr);
8989

90-
#ifdef VISP_ASSERT_BREAK
90+
#if defined(VISP_ASSERT_BREAK)
9191
# ifdef _MSC_VER
9292
__debugbreak();
9393
# else
9494
__builtin_trap();
9595
# endif
96+
#elif defined(VISP_ASSERT_THROW)
97+
throw exception(msg.c_str());
9698
#else
9799
std::abort();
98100
#endif

tests/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ target_sources(test-vision PRIVATE
66
test-image.cpp
77
)
88
target_include_directories(test-vision PRIVATE . ../src)
9-
target_compile_options(visioncpp PRIVATE ${VISP_WARNINGS})
10-
target_compile_definitions(visioncpp PRIVATE ${VISP_ASSERT} ${VISP_FMT_DEFS})
9+
target_compile_options(test-vision PRIVATE ${VISP_WARNINGS})
10+
target_compile_definitions(test-vision PRIVATE ${VISP_ASSERT} ${VISP_FMT_DEFS})
1111
target_link_libraries(test-vision PRIVATE visioncpp ${VISP_FMT_LINK})
1212
add_test(NAME vision COMMAND test-vision -v)
1313

@@ -20,8 +20,8 @@ target_sources(test-models PRIVATE
2020
test-models.cpp
2121
)
2222
target_include_directories(test-models PRIVATE . ../src)
23-
target_compile_options(visioncpp PRIVATE ${VISP_WARNINGS})
24-
target_compile_definitions(visioncpp PRIVATE ${VISP_ASSERT} ${VISP_FMT_DEFS})
23+
target_compile_options(test-models PRIVATE ${VISP_WARNINGS})
24+
target_compile_definitions(test-models PRIVATE ${VISP_ASSERT} ${VISP_FMT_DEFS})
2525
target_link_libraries(test-models PRIVATE visioncpp ${VISP_FMT_LINK})
2626
if(VISP_VULKAN)
2727
add_test(NAME models COMMAND test-models -v)

tests/testing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ int main(int argc, char** argv) {
5252

5353
++passed;
5454
if (verbose) {
55-
printf(" \033[32mPASSED\033[0m\n", name);
55+
printf(" %s\n", "\033[32mPASSED\033[0m");
5656
}
5757
} catch (const visp::test_failure& e) {
5858
++failed;
59-
printf(" \033[31mFAILED\033[0m\n", name);
59+
printf(" %s\n", "\033[31mFAILED\033[0m");
6060
printf(" \033[90m%s:%d:\033[0m Assertion failed\n", e.file, e.line);
6161
printf(" \033[93m%s\033[0m\n", e.condition);
6262
if (e.eval) {
@@ -67,7 +67,7 @@ int main(int argc, char** argv) {
6767
}
6868
} catch (const std::exception& e) {
6969
++errors;
70-
printf(" \033[31mERROR\033[0m\n", name);
70+
printf(" %s\n", "\033[31mERROR\033[0m");
7171
printf(" \033[90m%s:%d:\033[0m Unhandled exception\n", test.file, test.line);
7272
printf(" \033[93m%s\033[0m\n", e.what());
7373
}

tests/testing.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ template <typename T>
7373
bool test_is_equal(T const& a, T const& b) {
7474
if constexpr (std::is_floating_point_v<T>) {
7575
return std::abs(a - b) <= test_tolerance_value();
76+
} else {
77+
return a == b;
7678
}
77-
return a == b;
7879
}
7980

8081
template <typename LHS, typename RHS>

0 commit comments

Comments
 (0)