Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
7 changes: 6 additions & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ jobs:
sudo apt update
sudo apt install -y \
build-essential \
libfyaml-dev
libfyaml-dev \
libbz2-dev \
liblz4-dev \
zlib1g-dev

- name: MacOS dependencies
if: startsWith(matrix.os, 'macos')
Expand All @@ -77,6 +80,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} \
-DENABLE_TESTING_ALL=YES \
-DBUILD_EXAMPLES=YES \
${{ matrix.cmake_options }} \
${{ github.event.inputs.cmake_flags }}
make ${{ github.event.inputs.make_flags }}
Expand All @@ -98,6 +102,7 @@ jobs:
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_PREFIX }} \
-DENABLE_TESTING_ALL=YES \
-DBUILD_EXAMPLES=YES \
-DARGP_NO_PKGCONFIG=YES \
-DARGP_LIBDIR=${hbroot}/lib \
-DARGP_INCLUDEDIR=${hbroot}/include \
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ add_subdirectory(include)
if(ENABLE_DOCS)
add_subdirectory(docs)
endif()
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if(ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
Expand All @@ -50,5 +53,3 @@ install(
CHANGES.rst
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
)


14 changes: 14 additions & 0 deletions cmake/ASDFConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ check_source_runs(C "

check_function_exists(strptime HAVE_STRPTIME)

if(BZip2_FOUND OR BZIP2_FOUND OR NOT BZIP2_INCLUDE_DIR STREQUAL "")
set(HAVE_BZIP2 1)
add_compile_definitions(HAVE_BZIP2)
endif()

if(LZ4_FOUND OR NOT LZ4_INCLUDE_DIR STREQUAL "")
set(HAVE_LZ4 1)
add_compile_definitions(HAVE_LZ4)
endif()

if(ZLIB_FOUND OR NOT ZLIB_INCLUDE_DIR STREQUAL "")
set(HAVE_ZLIB 1)
add_compile_definitions(HAVE_ZLIB)
endif()

# Write out the header
include_directories(${CMAKE_SOURCE_DIR}/include)
Expand Down
55 changes: 55 additions & 0 deletions cmake/ASDFDependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,58 @@
option(BZIP2_NO_PKGCONFIG NO)
# Ubuntu decided not to provide a bzip2 pkg-config file
# Uses the find_package function instead.
if(BZIP2_NO_PKGCONFIG)
set(BZIP2_LIBRARIES "bz2")
set(BZIP2_LIBDIR "" CACHE STRING "Directory containing libbz2 library")
set(BZIP2_INCLUDEDIR "" CACHE STRING "Directory containing libbz2 headers")
set(BZIP2_CFLAGS "" CACHE STRING "Compiler options for libbz2")
set(BZIP2_LDFLAGS "" CACHE STRING "Linker options for libbz2")
link_directories(${BZIP2_LIBDIR})
include_directories(${BZIP2_INCLUDEDIR})
add_link_options(${BZIP2_LDFLAGS})
add_compile_options(${BZIP2_CFLAGS})
else()
find_package(BZip2)
endif()

option(LZ4_NO_PKGCONFIG NO)
if(LZ4_NO_PKGCONFIG)
set(LZ4_LIBRARIES "lz4")
set(LZ4_LIBDIR "" CACHE STRING "Directory containing lz4 library")
set(LZ4_INCLUDEDIR "" CACHE STRING "Directory containing lz4 headers")
set(LZ4_CFLAGS "" CACHE STRING "Compiler options for lz4")
set(LZ4_LDFLAGS "" CACHE STRING "Linker options for lz4")
link_directories(${LZ4_LIBDIR})
include_directories(${LZ4_INCLUDEDIR})
add_link_options(${LZ4_LDFLAGS})
add_compile_options(${LZ4_CFLAGS})
else()
if(PKG_CONFIG_FOUND)
pkg_check_modules(LZ4 liblz4)
else()
message("pkg-config not found. Install pkg-config, or use LZ4_NO_PKGCONFIG=YES.")
endif()
endif()

option(ZLIB_NO_PKGCONFIG NO)
if(ZLIB_NO_PKGCONFIG)
set(ZLIB_LIBRARIES "z")
set(ZLIB_LIBDIR "" CACHE STRING "Directory containing libz library")
set(ZLIB_INCLUDEDIR "" CACHE STRING "Directory containing libz headers")
set(ZLIB_CFLAGS "" CACHE STRING "Compiler options for libz")
set(ZLIB_LDFLAGS "" CACHE STRING "Linker options for libz")
link_directories(${ZLIB_LIBDIR})
include_directories(${ZLIB_INCLUDEDIR})
add_link_options(${ZLIB_LDFLAGS})
add_compile_options(${ZLIB_CFLAGS})
else()
if(PKG_CONFIG_FOUND)
pkg_check_modules(ZLIB zlib)
else()
message("pkg-config not found. Install pkg-config, or use ZLIB_NO_PKGCONFIG=YES.")
endif()
endif()

option(FYAML_NO_PKGCONFIG NO)
if(FYAML_NO_PKGCONFIG)
set(FYAML_LIBRARIES "fyaml")
Expand Down
3 changes: 3 additions & 0 deletions cmake/ASDFOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ if (ENABLE_DOCS)
set(SPHINX_FLAGS "-W" CACHE STRING "Flags to pass to sphinx-build")
endif ()

# Example binaries
option(BUILD_EXAMPLES OFF)

# Testing
option(ENABLE_TESTING "Enable unit tests" OFF)
option(ENABLE_TESTING_SHELL "Enable additional shell command tests" OFF)
Expand Down
1 change: 1 addition & 0 deletions config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
#cmakedefine HAVE_SYS_ENDIAN_H
#cmakedefine HAVE_STRPTIME
#cmakedefine01 HAVE_DECL_BE64TOH

#endif
14 changes: 14 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_executable(asdf_dump_ndarray asdf_dump_ndarray.c)
target_include_directories(asdf_dump_ndarray PRIVATE
${CMAKE_SOURCE_DIR}
${BZIP2_INCLUDEDIR}
${LZ4_INCLUDEDIR}
${ZLIB_INCLUDEDIR}
)
target_link_libraries(asdf_dump_ndarray
libasdf
${BZIP2_LIBRARIES}
${LZ4_LIBRARIES}
${ZLIB_LIBRARIES}
)

Loading
Loading