Skip to content

Commit ade41c2

Browse files
committed
Core (Build): Use a different flag to enable building of functions within Core for unit testing only.
1 parent 0478f1d commit ade41c2

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

libvisual/cmake/LVBuildTest.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ FUNCTION(LV_BUILD_TEST TEST_NAME)
1212

1313
ADD_EXECUTABLE(${TEST_NAME} ${PARSED_ARGS_SOURCES})
1414

15+
TARGET_COMPILE_DEFINITIONS(${TEST_NAME} PRIVATE _LV_BUILD_PRIVATE_TEST_FUNCS)
16+
1517
IF(${PARSED_ARGS_COMPILE_DEFS})
1618
TARGET_COMPILE_DEFINITIONS(${TEST_NAME} PRIVATE ${PARSED_ARGS_COMPILE_DEFS})
1719
ENDIF()

libvisual/libvisual/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ SET_TARGET_PROPERTIES(libvisual
150150
LINK_FLAGS -Wl,--no-undefined
151151
)
152152

153+
IF(ENABLE_TESTS)
154+
TARGET_COMPILE_DEFINITIONS(libvisual PRIVATE _LV_BUILD_PRIVATE_TEST_FUNCS)
155+
ENDIF()
156+
153157
TARGET_INCLUDE_DIRECTORIES(libvisual
154158
PRIVATE
155159
${PROJECT_SOURCE_DIR}

libvisual/libvisual/lv_video.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ namespace LV {
293293
return true;
294294
}
295295

296-
#ifdef LV_ENABLE_TESTS
296+
#ifdef _LV_BUILD_PRIVATE_TEST_FUNCS
297297
bool Video::validate() const
298298
{
299299
// Validate dimensions.
@@ -360,7 +360,7 @@ namespace LV {
360360

361361
return true;
362362
}
363-
#endif // defined(LV_ENABLE_TESTS)
363+
#endif // defined(_LV_BUILD_PRIVATE_TEST_FUNCS)
364364

365365
bool Video::has_same_content (VideoConstPtr const& video) const
366366
{

libvisual/libvisual/lv_video.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ namespace LV {
294294
*/
295295
bool compare_attrs_ignore_pitch (VideoConstPtr const& src) const;
296296

297-
#ifdef LV_ENABLE_TESTS
297+
#ifdef _LV_BUILD_PRIVATE_TEST_FUNCS
298298
/**
299299
* Validates the state of this Video.
300300
*
@@ -303,7 +303,7 @@ namespace LV {
303303
* @return true if video has consistent state, false otherwise.
304304
*/
305305
bool validate() const;
306-
#endif // defined(LV_ENABLE_TESTS)
306+
#endif // defined(_LV_BUILD_PRIVATE_TEST_FUNCS)
307307

308308
/**
309309
* Checks if this Video has the same (pixel) content as another Video.

0 commit comments

Comments
 (0)