Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try fix osx compilation #89

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:

- name: Build
working-directory: build
run: cmake --build . --config ${{matrix.config.name}} --target test_sparrow_lib --parallel 8
run: cmake --build . --config ${{matrix.config.name}} --target osx_compilation_fail_reproduce --parallel 8

- name: Run tests
working-directory: build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:

- name: Build
working-directory: build
run: cmake --build . --config ${{matrix.config.name}} --target test_sparrow_lib --parallel 8
run: cmake --build . --config ${{matrix.config.name}} --target osx_compilation_fail_reproduce --parallel 8

- name: Run tests
working-directory: build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Build
working-directory: build
run: cmake --build . --config ${{matrix.config.name}} --target test_sparrow_lib --parallel 8
run: cmake --build . --config ${{matrix.config.name}} --target osx_compilation_fail_reproduce --parallel 8

- name: Run tests
working-directory: build
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ set(SPARROW_HEADERS
${SPARROW_INCLUDE_DIR}/sparrow/details/3rdparty/float16_t.hpp
)


add_library(sparrow INTERFACE)

target_include_directories(sparrow INTERFACE
Expand Down
27 changes: 19 additions & 8 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,22 @@ set(SPARROW_TESTS_SOURCES
test_typed_array.cpp
test_variable_size_binary_layout.cpp
)
set(test_target "test_sparrow_lib")
add_executable(${test_target} ${SPARROW_TESTS_SOURCES})
target_link_libraries(${test_target} PRIVATE sparrow doctest::doctest)
add_test(NAME ${test_target} COMMAND ${test_target})

# We do not use non-standard C++
set_target_properties(${test_target} PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
target_compile_features(${test_target} PRIVATE cxx_std_20)
# set(test_target "test_sparrow_lib")
# add_executable(${test_target} ${SPARROW_TESTS_SOURCES})
# target_link_libraries(${test_target} PRIVATE sparrow doctest::doctest)
# add_test(NAME ${test_target} COMMAND ${test_target})

# # We do not use non-standard C++
# set_target_properties(${test_target} PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
# target_compile_features(${test_target} PRIVATE cxx_std_20)
# if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# target_compile_options(${test_target} PRIVATE -ftemplate-backtrace-limit=0)
# endif()

add_executable(osx_compilation_fail_reproduce osx_compilation_fail_reproduce.cpp)
target_link_libraries(osx_compilation_fail_reproduce PRIVATE sparrow)
set_target_properties(osx_compilation_fail_reproduce PROPERTIES CMAKE_CXX_EXTENSIONS OFF)
target_compile_features(osx_compilation_fail_reproduce PRIVATE cxx_std_20)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(osx_compilation_fail_reproduce PRIVATE -ftemplate-backtrace-limit=0)
endif()
43 changes: 43 additions & 0 deletions test/osx_compilation_fail_reproduce.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "sparrow/typed_array.hpp"

Check notice on line 1 in test/osx_compilation_fail_reproduce.cpp

View workflow job for this annotation

GitHub Actions / build

Run clang-format on test/osx_compilation_fail_reproduce.cpp

File test/osx_compilation_fail_reproduce.cpp does not conform to Custom style guidelines. (lines 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 31, 35)

template <typename T>
sparrow::array_data
make_test_array_data(size_t n = 10, size_t offset = 0, const std::vector<size_t>& false_bitmap = {})
{
sparrow::array_data ad;
ad.type = sparrow::data_descriptor(sparrow::arrow_traits<T>::type_id);
ad.bitmap = sparrow::dynamic_bitset<uint8_t>(n, true);
for (const auto i : false_bitmap)
{
if (i >= n)
{
throw std::invalid_argument("Index out of range");
}
ad.bitmap.set(i, false);
}
const size_t buffer_size = (n * sizeof(T)) / sizeof(uint8_t);
sparrow::buffer<uint8_t> b(buffer_size);
for (uint8_t i = 0; i < n; ++i)
{
b.data<T>()[i] = static_cast<T>(i);
}
ad.buffers.push_back(b);
ad.length = n;
ad.offset = offset;
ad.child_data.emplace_back();
return ad;
}

int main() {
const auto array_data = make_test_array_data<int>(10, 0);
const sparrow::typed_array<int> ta{array_data};
const sparrow::typed_array<int> ta_same{array_data};
if(ta == ta)
{
return 0;
}
else
{
return 1;
}
}
Loading