Commit 3c467194 authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Add fail on warnings to examples and tests

parent 267bc2af
function(addSystemHeadersToTarget target header_dirs)
if (MSVC AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
foreach (include_dir ${header_dirs})
if (NOT (include_dir STREQUAL "$<INSTALL_INTERFACE:include>"))
target_compile_options(${target} PRIVATE "SHELL:/imsvc\ \"${include_dir}\"")
endif()
endforeach()
else()
target_include_directories(${target} SYSTEM PRIVATE ${header_dirs})
endif()
endfunction()
......@@ -28,8 +28,8 @@ macro(build3rdparty)
BuildAzure()
endif()
if (Python3_FOUND)
include(CMake/FindPythonLibsNew.cmake)
add_subdirectory(${pybind11_SOURCE_DIR} ${PROJECT_BINARY_DIR}/pybind11_${pybind11_VERSION} EXCLUDE_FROM_ALL)
include(CMake/FindPythonLibsNew.cmake) # This is a hack on Windows to fix case sensitivity for finding the python library when building with the clang toolchain in visual studio
endif()
if (NOT DISABLE_CURL_IOMANAGER)
BuildCurl()
......
......@@ -39,7 +39,10 @@ else()
find_package(Python3 ${PYTHON_REQUIRED} COMPONENTS Interpreter Development ${PYTHON_ROOT_DIR_HINT})
endif()
if (NOT Python3_FOUND)
if (Python3_FOUND)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
set(PYTHONINTERP_FOUND ON)
else()
message("Failed to find Python3 interpreter. Disabling Python build")
set(BUILD_PYTHON_DEFAULT OFF)
endif()
......@@ -139,6 +142,7 @@ include(CMake/Build3rdParty.cmake)
build3rdparty()
include(CMake/CopyDllForTarget.cmake)
include(CMake/AddSystemHeadersToTarget.cmake)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
......
......@@ -6,4 +6,5 @@ target_compile_definitions(getting-started PRIVATE -DTEST_URL="${TEST_URL}")
string(REPLACE ";" "\\\\;" TEST_CONNECTION_ESCAPED "${TEST_CONNECTION}")
target_compile_definitions(getting-started PRIVATE -DTEST_CONNECTION="${TEST_CONNECTION_ESCAPED}")
setWarningFlagsForTarget(getting-started)
copyDllForTarget(getting-started)
......@@ -41,4 +41,5 @@ int main(int argc, char *argv[])
int64_t iRequestID = accessManager->RequestVolumeSubset(buffer.data(), layout, OpenVDS::Dimensions_012, 0, 0, voxelMin, voxelMax, OpenVDS::VolumeDataChannelDescriptor::Format_R32);
bool success = accessManager->WaitForCompletion(iRequestID);
(void)success;
}
......@@ -2,4 +2,5 @@ add_executable(slicedump main.cpp)
target_link_libraries(slicedump openvds fmt::fmt)
set_target_properties(slicedump PROPERTIES FOLDER examples)
setWarningFlagsForTarget(slicedump)
copyDllForTarget(slicedump)
......@@ -10,7 +10,7 @@
#include <random>
static void getScaleOffsetForFormat(float min, float max, bool novalue, OpenVDS::VolumeDataChannelDescriptor::Format format, float &scale, float &offset)
inline void getScaleOffsetForFormat(float min, float max, bool novalue, OpenVDS::VolumeDataChannelDescriptor::Format format, float &scale, float &offset)
{
switch (format)
{
......@@ -33,7 +33,7 @@ static void getScaleOffsetForFormat(float min, float max, bool novalue, OpenVDS:
}
}
static OpenVDS::VDS *generateSimpleInMemory3DVDS(int32_t samplesX = 100, int32_t samplesY = 100, int32_t samplesZ = 100, OpenVDS::VolumeDataChannelDescriptor::Format format = OpenVDS::VolumeDataChannelDescriptor::Format_R32)
inline OpenVDS::VDS *generateSimpleInMemory3DVDS(int32_t samplesX = 100, int32_t samplesY = 100, int32_t samplesZ = 100, OpenVDS::VolumeDataChannelDescriptor::Format format = OpenVDS::VolumeDataChannelDescriptor::Format_R32)
{
auto brickSize = OpenVDS::VolumeDataLayoutDescriptor::BrickSize_32;
int negativeMargin = 4;
......@@ -51,8 +51,8 @@ static OpenVDS::VDS *generateSimpleInMemory3DVDS(int32_t samplesX = 100, int32_t
std::vector<OpenVDS::VolumeDataChannelDescriptor> channelDescriptors;
float rangeMin = -0.1234f;
float rangeMax = 0.1234f;
float intScale;
float intOffset;
float intScale = 1.f;
float intOffset = 0.f;
getScaleOffsetForFormat(rangeMin, rangeMax, true, format, intScale, intOffset);
channelDescriptors.emplace_back(format, OpenVDS::VolumeDataChannelDescriptor::Components_1, AMPLITUDE_ATTRIBUTE_NAME, "", rangeMin, rangeMax, OpenVDS::VolumeDataMapping::Direct, 1, OpenVDS::VolumeDataChannelDescriptor::Default, 0.f, intScale, intOffset);
......@@ -62,7 +62,7 @@ static OpenVDS::VDS *generateSimpleInMemory3DVDS(int32_t samplesX = 100, int32_t
return OpenVDS::Create(options, layoutDescriptor, axisDescriptors, channelDescriptors, metadataContainer, error);
}
static void fill3DVDSWithNoise(OpenVDS::VDS *vds, int32_t channel = 0, const OpenVDS::FloatVector3 &frequency = OpenVDS::FloatVector3(0.6f, 2.f, 4.f))
inline void fill3DVDSWithNoise(OpenVDS::VDS *vds, int32_t channel = 0, const OpenVDS::FloatVector3 &frequency = OpenVDS::FloatVector3(0.6f, 2.f, 4.f))
{
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(vds);
//ASSERT_TRUE(layout);
......@@ -93,7 +93,7 @@ static void fill3DVDSWithNoise(OpenVDS::VDS *vds, int32_t channel = 0, const Ope
}
static void fill3DVDSWithBitNoise(OpenVDS::VDS *vds, int32_t channel = 0)
inline void fill3DVDSWithBitNoise(OpenVDS::VDS *vds, int32_t channel = 0)
{
OpenVDS::VolumeDataLayout *layout = OpenVDS::GetLayout(vds);
//ASSERT_TRUE(layout);
......
......@@ -15,6 +15,8 @@
** limitations under the License.
****************************************************************************/
#define _CRT_SECURE_NO_WARNINGS 1
#include "cxxopts.hpp"
#include <fmt/printf.h>
......@@ -105,9 +107,9 @@ int main(int argc, char **argv)
{
options.parse(argc, argv);
}
catch(cxxopts::OptionParseException e)
catch(cxxopts::OptionParseException *e)
{
fmt::print(stderr, "{}\n", e.what());
fmt::print(stderr, "{}\n", e->what());
return EXIT_FAILURE;
}
......@@ -138,7 +140,7 @@ int main(int argc, char **argv)
fmt::print(stdout, "Using axis mapping [{}, {}, {}]\n", axis_mapper[0], axis_mapper[1], axis_mapper[2]);
OpenVDS::Error error;
OpenVDS::VDSHandle handle;
OpenVDS::VDSHandle handle = nullptr;
if (generate_noise)
{
......
......@@ -1071,7 +1071,7 @@ HueBulkDataStoreImpl::UpdateFileTable(DataStoreFileDescriptor const &fileDescrip
size_t
fileTableEntrySize = sizeof(FileHeader) + GetDataStoreHeader().m_fileNameLength;
assert((m_fileTable ? m_fileTable->Size() : 0) == fileTableEntrySize * fileTableEntryCount);
assert(size_t(m_fileTable ? m_fileTable->Size() : 0) == fileTableEntrySize * fileTableEntryCount);
int32_t
fileNameLength = std::max(int32_t(fileDescriptor.m_fileName.length()), GetDataStoreHeader().m_fileNameLength);
......
......@@ -139,15 +139,7 @@ function(compileInTarget to_target source_target)
target_sources(${to_target} PRIVATE ${complete_file})
set_source_files_properties(${complete_file} PROPERTES COMPILE_FLAGS ${DISABLE_WARNING_FLAG})
endforeach()
if (MSVC AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
foreach (dir ${src_include})
if (NOT (dir STREQUAL "$<INSTALL_INTERFACE:include>"))
target_compile_options(${to_target} PRIVATE "SHELL:/imsvc\ \"${dir}\"")
endif()
endforeach()
else()
target_include_directories(${to_target} SYSTEM PRIVATE ${src_include})
endif()
addSystemHeadersToTarget(${to_target} "${src_include}")
endfunction()
compileInTarget(openvds_objects fmt::fmt)
......@@ -173,15 +165,7 @@ target_include_directories(openvds_objects PRIVATE "VDS")
target_compile_definitions(openvds_objects PRIVATE openvds_EXPORTS)
target_compile_definitions(openvds_objects PRIVATE -DHUEBDS_EXPORTS= ) # We're not building HueBulkDataStore as a shared library
if (MSVC AND (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))
foreach (dir ${include_3rdparty})
if (NOT (dir STREQUAL "$<INSTALL_INTERFACE:include>"))
target_compile_options(openvds_objects PRIVATE "SHELL:/imsvc\ ${dir}")
endif()
endforeach()
else()
target_include_directories(openvds_objects SYSTEM PRIVATE ${include_3rdparty})
endif()
addSystemHeadersToTarget(openvds_objects "${include_3rdparty}")
if (WIN32)
target_compile_definitions(openvds_objects PRIVATE _CRT_SECURE_NO_WARNINGS)
......
......@@ -145,7 +145,7 @@ struct NoiseKernel
};
template<int dimension, bool useNoValue, typename ... Args>
static void GenericDispatcher_1(VolumeDataChannelDescriptor::Format format, Args ... args)
inline void GenericDispatcher_1(VolumeDataChannelDescriptor::Format format, Args ... args)
{
switch(format)
{
......@@ -161,13 +161,13 @@ static void GenericDispatcher_1(VolumeDataChannelDescriptor::Format format, Args
}
template<int dimension, typename ... Args>
static void GenericDispatcher(bool useNoValue, VolumeDataChannelDescriptor::Format format, Args ... args)
inline void GenericDispatcher(bool useNoValue, VolumeDataChannelDescriptor::Format format, Args ... args)
{
if (useNoValue)
GenericDispatcher_1<dimension, true, Args...>(format, args...);
else
GenericDispatcher_1<dimension, false, Args...>(format, args...);
};
}
template <typename T, bool useNoValue>
struct NoiseKernel<2, T, useNoValue>
......@@ -210,7 +210,7 @@ static void Do(void * outputVoid, VolumeIndexer2D const &outputIndexer2D, FloatV
}
};
static void CalculateNoise2D(void* output, VolumeDataChannelDescriptor::Format format, VolumeIndexer2D *outputIndexer, FloatVector2 frequency, float threshold, float noValue, bool useNoValue, unsigned int random)
inline void CalculateNoise2D(void* output, VolumeDataChannelDescriptor::Format format, VolumeIndexer2D *outputIndexer, FloatVector2 frequency, float threshold, float noValue, bool useNoValue, unsigned int random)
{
GenericDispatcher<2>(useNoValue, format, output, *outputIndexer, frequency, threshold, noValue, random);
}
......@@ -259,7 +259,7 @@ static void Do(void* outputVoid, VolumeIndexer3D const &outputIndexer3D, FloatVe
}
};
static void CalculateNoise3D(void* output, VolumeDataChannelDescriptor::Format format, VolumeIndexer3D *outputIndexer, FloatVector3 frequency, float threshold, float noValue, bool useNoValue, unsigned int random)
inline void CalculateNoise3D(void* output, VolumeDataChannelDescriptor::Format format, VolumeIndexer3D *outputIndexer, FloatVector3 frequency, float threshold, float noValue, bool useNoValue, unsigned int random)
{
GenericDispatcher<3>(useNoValue, format, output, *outputIndexer, frequency, threshold, noValue, random);
}
......@@ -308,7 +308,7 @@ static void Do(void* outputVoid, VolumeIndexer4D const &outputIndexer4D, FloatVe
}
};
static void CalculateNoise4D(void* output, VolumeDataChannelDescriptor::Format format, VolumeIndexer4D *outputIndexer, FloatVector4 frequency, float threshold, float noValue, bool useNoValue, unsigned int random)
inline void CalculateNoise4D(void* output, VolumeDataChannelDescriptor::Format format, VolumeIndexer4D *outputIndexer, FloatVector4 frequency, float threshold, float noValue, bool useNoValue, unsigned int random)
{
GenericDispatcher<4>(useNoValue, format, output, *outputIndexer, frequency, threshold, noValue, random);
}
......
......@@ -22,14 +22,18 @@ string(REPLACE ";" "\\\\;" TEST_CONNECTION_ESCAPED "${TEST_CONNECTION}")
function(add_test_executable name)
add_executable(${name} ${ARGN})
target_link_libraries(${name} PRIVATE openvds_objects gtest gtest_main)
target_include_directories(${name} SYSTEM PRIVATE ${include_3rdparty})
addSystemHeadersToTarget(${name} "${include_3rdparty}")
target_compile_definitions(${name} PRIVATE openvds_EXPORTS)
add_dependencies(${name} TestRootTarget)
gtest_discover_tests(${name})
setWarningFlagsForTarget(${name})
set_target_properties(${name} PROPERTIES FOLDER tests)
get_target_property(fmt_INCLUDE fmt::fmt INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(json_INCLUDE jsoncpp_lib_static INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(${name} PRIVATE ${fmt_INCLUDE} ${json_INCLUDE} ${PROJECT_SOURCE_DIR}/src/OpenVDS)
target_include_directories(${name} SYSTEM PRIVATE ${fmt_INCLUDE} ${json_INCLUDE})
addSystemHeadersToTarget(${name} "${fmt_INCLUDE}")
addSystemHeadersToTarget(${name} "${json_INCLUDE}")
target_include_directories(${name} PRIVATE ${PROJECT_SOURCE_DIR}/src/OpenVDS)
target_compile_definitions(${name} PRIVATE -DTEST_DATA_PATH="${PROJECT_SOURCE_DIR}/tests/VDS")
target_compile_definitions(${name} PRIVATE -DTEST_URL="${TEST_URL}")
target_compile_definitions(${name} PRIVATE -DTEST_CONNECTION="${TEST_CONNECTION_ESCAPED}")
......
......@@ -132,8 +132,6 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeSubset)
int loopDimension = 4;
int groupSize = 100;
int loopDimensionSize = layout->GetDimensionNumSamples(loopDimension);
int traceDimension = (loopDimension == 0) ? 1 : 0;
int traceDimensionSize = layout->GetDimensionNumSamples(traceDimension);
......@@ -145,8 +143,6 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeSubset)
groupSize = groupDimensionSize;
}
int groupCount = (groupDimensionSize + (groupSize - 1)) / groupSize;
std::array<int, OpenVDS::Dimensionality_Max> voxelMin = { 0, 0, 0, 0, 0, 0};
std::array<int, OpenVDS::Dimensionality_Max> voxelMax = { 1, 1, 1, 1, 1, 1};
......
......@@ -50,10 +50,10 @@ TEST(Multithreading, requests)
struct ThreadRequestData
{
int64_t requestId;
int32_t minPos[OpenVDS::Dimensionality_Max];
int32_t maxPos[OpenVDS::Dimensionality_Max];
int32_t voxelCount;
int64_t requestId;
std::vector<float> bufferFloat;
};
std::vector<std::vector<ThreadRequestData>> m_dataRequests;
......
......@@ -47,9 +47,9 @@ class SyncTransfer : public OpenVDS::TransferDownloadHandler
public:
void HandleObjectSize(int64_t size) override { }
void HandleObjectLastWriteTime(const std::string& lastWriteTimeISO8601) override {}
void HandleMetadata(const std::string& key, const std::string& header) { headers.emplace_back(key, header); }
void HandleData(std::vector<uint8_t>&& data) { this->data = std::move(data); }
void Completed(const OpenVDS::Request& request, const OpenVDS::Error& error) {}
void HandleMetadata(const std::string& key, const std::string& header) override { headers.emplace_back(key, header); }
void HandleData(std::vector<uint8_t>&& data) override { this->data = std::move(data); }
void Completed(const OpenVDS::Request& request, const OpenVDS::Error& error) override {}
std::vector<uint8_t> data;
std::vector<std::pair<std::string, std::string>> headers;
......@@ -115,8 +115,8 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeError)
int steps[3];
int size[3];
steps[0] = samples[0] / (boundingBoxes.size() * 2);
size[0] = samples[0] / boundingBoxes.size();
steps[0] = samples[0] / int(boundingBoxes.size() * 2);
size[0] = samples[0] / int(boundingBoxes.size());
steps[1] = 0;
size[1] = 10;
steps[2] = 0;
......@@ -133,20 +133,21 @@ GTEST_TEST(OpenVDS_integration, SimpleRequestVolumeError)
}
std::array<std::vector<float>, boundingBoxes.size()> buffers;
for (int i = 0; i < boundingBoxes.size(); i++)
for (int i = 0; i < int(boundingBoxes.size()); i++)
{
auto size = accessManager->GetVolumeSubsetBufferSize(layout, PODArrayReference(boundingBoxes[i].voxelMin), PODArrayReference(boundingBoxes[i].voxelMax), OpenVDS::VolumeDataChannelDescriptor::Format_R32, 0, 0);
buffers[i].resize(size);
}
std::array<int64_t, boundingBoxes.size()> requestIds;
for (int i = 0; i < boundingBoxes.size(); i++)
for (int i = 0; i < int(boundingBoxes.size()); i++)
{
requestIds[i] = accessManager->RequestVolumeSubset(buffers[i].data(), layout, OpenVDS::Dimensions_012, 0, 0, PODArrayReference(boundingBoxes[i].voxelMin), PODArrayReference(boundingBoxes[i].voxelMax), OpenVDS::VolumeDataChannelDescriptor::Format_R32);
}
for (int i = 0; i < boundingBoxes.size(); i++)
for (int i = 0; i < int(boundingBoxes.size()); i++)
{
bool returned = accessManager->WaitForCompletion(requestIds[i]);
(void)returned;
}
//we don't need to assert anything as we are just loking for that the system does not segfault or deadlock.
}
......
......@@ -36,6 +36,7 @@ TEST(OpenVDS, MixedRequests)
ASSERT_TRUE(pageAccessor);
auto dataAccessor = accessManager->Create3DVolumeDataAccessorR32(pageAccessor, -1000);
float value = dataAccessor->GetValue({ 100, 100, 100 });
(void)value;
accessManager->WaitForCompletion(request);
}
......
......@@ -123,7 +123,7 @@ TEST_F(RequestVolumeSubsetFormat, test1Bit)
int64_t request= shared_data->accessManager->RequestVolumeSubset(buffer.data(), shared_data->layout, OpenVDS::Dimensions_012, 0, 0, shared_data->minPos, shared_data->maxPos, OpenVDS::VolumeDataChannelDescriptor::Format_1Bit);
shared_data->accessManager->WaitForCompletion(request);
for (size_t i = 0; i < shared_data->voxelCount; i++)
for (int32_t i = 0; i < shared_data->voxelCount; i++)
{
uint8_t data = (buffer[i/8] & (1 << (i % 8))) >> (i % 8);
uint8_t value = shared_data->bufferFloat[i] != shared_data->layout->GetChannelNoValue(0);
......
......@@ -10,7 +10,9 @@ GTEST_TEST(OpenVDS_volumeIndexer, checkSymbolsInVolumeIndexer)
OpenVDS::VolumeIndexer3D vi = OpenVDS::VolumeIndexerBase<3>::CreateTempBufferIndexer(voxelMin, voxelMax, 1);
OpenVDS::VolumeIndexer3D vi2 = OpenVDS::VolumeIndexerBase<3>::CreateTempBufferIndexer(vi);
(void)vi2;
OpenVDS::VolumeIndexer3D vi3 = OpenVDS::VolumeIndexerBase<3>::CreateTempBufferIndexer(vi, voxelMax, voxelMin);
(void)vi3;
ASSERT_TRUE(true);
}
......@@ -51,7 +51,7 @@ TEST(SEGYScanTest, scan)
EXPECT_TRUE(fileInfo.m_segmentInfo.front().m_traceStart == 0);
// check that the segments cover all traces of the file (with no overlap)
for(int i = 1; i < fileInfo.m_segmentInfo.size(); i++)
for(int i = 1; i < int(fileInfo.m_segmentInfo.size()); i++)
{
if(fileInfo.m_segmentInfo[i].m_traceStart != fileInfo.m_segmentInfo[i - 1].m_traceStop + 1)
{
......
......@@ -170,8 +170,8 @@ GTEST_TEST(VDS_integration, DeSerializeVolumeData)
double samples = 0;
Stats(dataBlockNone, dataNone, dataBlockWavelet, dataWavelet, diff, maxError, deviation, samples);
double variance = deviation / samples;
double std_dev = sqrt(variance);
//double variance = deviation / samples;
//double std_dev = sqrt(variance);
double avg_diff = diff / samples;
double one_procent_range = (0.07883811742067337 + 0.07883811742067337) / 100;
EXPECT_TRUE(avg_diff < one_procent_range * 2);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment