changeset 1168:f2951ac074bd

allow compiling unit tests with sdl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 Nov 2019 11:08:29 +0100
parents f68da12e852b
children 5594d8d4a70f
files Applications/Samples/CMakeLists.txt Resources/CMake/OrthancStoneConfiguration.cmake UnitTestsSources/TestStructureSet.cpp
diffstat 3 files changed, 27 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/CMakeLists.txt	Wed Nov 20 10:47:42 2019 +0100
+++ b/Applications/Samples/CMakeLists.txt	Wed Nov 20 11:08:29 2019 +0100
@@ -88,6 +88,10 @@
   set(ENABLE_GOOGLE_TEST ON)
   set(ENABLE_WEB_CLIENT ON)
 
+else()
+  set(ENABLE_NATIVE ON)
+  set(ENABLE_OPENGL OFF)
+  
 endif()
 
 
@@ -182,16 +186,19 @@
   target_link_libraries(${Target} OrthancStone)
 endmacro()
 
-#BuildSingleFileSample(OrthancStoneEmpty EmptyApplication.h 1)
-#BuildSingleFileSample(OrthancStoneTestPattern TestPatternApplication.h 2)
-BuildSingleFileSample(OrthancStoneSingleFrame SingleFrameApplication.h 3)
-#BuildSingleFileSample(OrthancStoneSingleVolume SingleVolumeApplication.h 4)
-#BuildSingleFileSample(OrthancStoneBasicPetCtFusion 5)
-#BuildSingleFileSample(OrthancStoneSynchronizedSeries 6)
-#BuildSingleFileSample(OrthancStoneLayoutPetCtFusion 7)
-BuildSingleFileSample(OrthancStoneSimpleViewerSingleFile SimpleViewerApplicationSingleFile.h 8)  # we keep that one just as a sample before we convert another sample to this pattern
-BuildSingleFileSample(OrthancStoneSingleFrameEditor SingleFrameEditorApplication.h 9)
 
+if (ENABLE_SDL)
+  #BuildSingleFileSample(OrthancStoneEmpty EmptyApplication.h 1)
+  #BuildSingleFileSample(OrthancStoneTestPattern TestPatternApplication.h 2)
+  BuildSingleFileSample(OrthancStoneSingleFrame SingleFrameApplication.h 3)
+  #BuildSingleFileSample(OrthancStoneSingleVolume SingleVolumeApplication.h 4)
+  #BuildSingleFileSample(OrthancStoneBasicPetCtFusion 5)
+  #BuildSingleFileSample(OrthancStoneSynchronizedSeries 6)
+  #BuildSingleFileSample(OrthancStoneLayoutPetCtFusion 7)
+  BuildSingleFileSample(OrthancStoneSimpleViewerSingleFile SimpleViewerApplicationSingleFile.h 8)  # we keep that one just as a sample before we convert another sample to this pattern
+  BuildSingleFileSample(OrthancStoneSingleFrameEditor SingleFrameEditorApplication.h 9)
+endif()
+  
 ##### SimpleViewer sample (Qt and WASM only) #######
 
 if (ENABLE_QT OR ENABLE_WASM)
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Wed Nov 20 10:47:42 2019 +0100
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Wed Nov 20 11:08:29 2019 +0100
@@ -56,6 +56,12 @@
   endif()
 endif()
 
+if (ENABLE_OPENGL)
+  if (NOT ENABLE_QT AND NOT ENABLE_SDL AND NOT ENABLE_WASM)
+    message(FATAL_ERROR "Cannot enable OpenGL if WebAssembly, SDL and Qt are all disabled")
+  endif()
+endif()
+
 if (ENABLE_WASM)
   if (NOT ORTHANC_SANDBOXED)
     message(FATAL_ERROR "WebAssembly target must me configured as sandboxed")
--- a/UnitTestsSources/TestStructureSet.cpp	Wed Nov 20 10:47:42 2019 +0100
+++ b/UnitTestsSources/TestStructureSet.cpp	Wed Nov 20 11:08:29 2019 +0100
@@ -4729,8 +4729,8 @@
   }
 
   ds.Union(0, 4);
-  EXPECT_EQ(0, ds.Find(0));
-  EXPECT_EQ(0, ds.Find(4));
+  EXPECT_EQ(0u, ds.Find(0));
+  EXPECT_EQ(0u, ds.Find(4));
 
   ds.Union(4, 6);
   ds.Union(8, 9);
@@ -4875,7 +4875,7 @@
 
   boundaries.clear();
   EXPECT_NO_THROW(AddSlabBoundaries(boundaries, slabCuts, 0));
-  ASSERT_EQ(0, boundaries.size());
+  ASSERT_EQ(0u, boundaries.size());
 }
 
 TEST(StructureSet, ProcessBoundaryListTopRow)
@@ -4889,7 +4889,7 @@
 
   {
     size_t i = 0;
-    ASSERT_EQ(4, boundaries.size());
+    ASSERT_EQ(4u, boundaries.size());
 
     ASSERT_EQ(RectangleBoundaryKind_Start, boundaries[i].second);
     ASSERT_NEAR(5, boundaries[i].first, DELTA_MAX);
@@ -4919,7 +4919,7 @@
   AddSlabBoundaries(boundaries, slabCuts, 0);
   AddSlabBoundaries(boundaries, slabCuts, 1);
 
-  ASSERT_EQ(8, boundaries.size());
+  ASSERT_EQ(8u, boundaries.size());
 
   {
     size_t i = 0;