Skip to content

Commit

Permalink
Adding IDX2
Browse files Browse the repository at this point in the history
  • Loading branch information
scrgiorgio committed May 7, 2024
1 parent 7664f5c commit b0d7311
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
30 changes: 20 additions & 10 deletions Libs/Db/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ source_group("Samples\\cpp" FILES ${TutorialSources})
# NOTE: I am not using the IDX2 original CMakeList.txt so I have more "freedom" to change stuff
# but if anything is going to change in IDX, you MUST keep this up-to-date
if (VISUS_IDX2)

FILE(GLOB Idx2Sources ${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Core/*.h ${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Core/*.cpp
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/idx2.h ${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/idx2.cpp
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Applications/idx2App.cpp # IDX2 does not support dynamic libraries, so I am compiling here
)
FILE(GLOB Idx2Sources
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Core/*.h ${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Core/*.cpp
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/idx2.h
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/idx2.cpp
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Applications/idx2App.cpp # IDX2 does not support dynamic libraries, so I am compiling here
)
list(REMOVE_ITEM Idx2Sources ${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Core/Core.cpp)
source_group("Idx2" FILES ${Idx2Sources})
endif()
Expand All @@ -46,19 +47,28 @@ target_include_directories(VisusDb PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOUR
# NOTE: I am not using the IDX2 original CMakeList.txt so I have more "freedom" to change stuff
# but if anything is going to change in IDX, you MUST keep this up-to-date
if (VISUS_IDX2)
target_compile_features(VisusDb PUBLIC cxx_std_17) # PROBLEM here: do we really need C++17?
target_compile_definitions(VisusDb PUBLIC -DVISUS_IDX2=1)

# https://stackoverflow.com/questions/40515557/compilation-error-on-clock-gettime-and-clock-monotonic
target_compile_definitions(VisusDb PRIVATE -D_POSIX_C_SOURCE=199309L)
# some code needs C++17
target_compile_features(VisusDb PUBLIC cxx_std_17)

# enable idx2
target_compile_definitions(VisusDb PUBLIC -DVISUS_IDX2=1)

# enable AVX2 platform
target_compile_definitions(VisusDb PRIVATE -Didx2_Avx2)

# less precise but more portable clock functions
target_compile_definitions(VisusDb PRIVATE -Didx2_CTimer)

# enable assert in debug mode
target_compile_definitions(VisusDb PRIVATE "$<$<CONFIG:DEBUG>:idx2_Slow>")
target_include_directories(VisusDb PRIVATE ${CMAKE_SOURCE_DIR}/Libs/IDX2/Source ${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Core/stla)

# includes
target_include_directories(VisusDb PRIVATE
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source
${CMAKE_SOURCE_DIR}/Libs/IDX2/Source/Core/stla)

# enable AVX2
if (MSVC)
target_compile_definitions(VisusDb PRIVATE -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX)
target_compile_options(VisusDb PRIVATE /arch:AVX2 /Zc:preprocessor /Zc:__cplusplus /wd5105)
Expand Down
3 changes: 1 addition & 2 deletions Libs/IDX2/Source/Core/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ElapsedTime(timer* Timer)
{
auto End = clock();
auto Seconds = (double)(End - Timer->Start) / CLOCKS_PER_SEC;
return Seconds * 1e9;
return i64(Seconds * 1e9); //nanoseconds
}


Expand Down Expand Up @@ -102,7 +102,6 @@ ElapsedTime(timer* Timer)
} // namespace idx2

#elif defined(__CYGWIN__) || defined(__linux__) || defined(__APPLE__)
#define _POSIX_C_SOURCE 199309L
#include <time.h>

namespace idx2
Expand Down
3 changes: 3 additions & 0 deletions Libs/IDX2/Source/Core/idx2Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,9 @@ TraverseHierarchy(u64 TraverseOrder,
idx2_PropagateIfError(Callback(Top));
}
}

//scrgiorgio
return idx2_Error(idx2_err_code::NoError);
}


Expand Down

0 comments on commit b0d7311

Please sign in to comment.