File tree Expand file tree Collapse file tree 10 files changed +17
-26
lines changed
Expand file tree Collapse file tree 10 files changed +17
-26
lines changed Original file line number Diff line number Diff line change 11.idea
2- cmake -build-*
2+ * -build- *
33build
44bin
55.DS_Store
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ include("${CMAKE_SOURCE_DIR}/cmake/generate_header_and_source_from_header_only.c
7373if (LIBACQUIRE_HEADER_ONLY)
7474 message (STATUS "LIBACQUIRE_HEADER_ONLY" )
7575 add_library ("${LIBRARY_NAME} " INTERFACE "${_Header_Files} " "${Header_Files} " )
76+ target_compile_definitions ("${LIBRARY_NAME} " PUBLIC "_${TARGET_ARCH} _" )
7677 set (lib_vis "INTERFACE" )
7778else ()
7879 set (gen_header_files "" )
@@ -245,6 +246,7 @@ else ()
245246
246247 # Implement the internal implementation library as STATIC
247248 add_library ("${LIBRARY_NAME} _impl" STATIC ${gen_header_files} ${gen_source_files} )
249+ target_compile_definitions ("${LIBRARY_NAME} _impl" PUBLIC "_${TARGET_ARCH} _" )
248250
249251 if (DEFINED CHECKSUM_LIBRARIES)
250252 message (STATUS "[libacquire] Using var ${CHECKSUM_LIBRARIES} for checksums" )
Original file line number Diff line number Diff line change @@ -26,21 +26,6 @@ extern "C" {
2626#endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || \
2727defined(__NT__) */
2828
29- /**
30- * @brief Verify the CRC32C checksum of a given file against an expected hash
31- * string.
32- *
33- * Opens the file, computes its CRC32C checksum, then compares it with the input
34- * hash string case-insensitively.
35- *
36- * @param filename Path to the file to be validated.
37- * @param hash Expected CRC32C checksum string in hexadecimal (8 characters).
38- *
39- * @return true if computed checksum matches input hash, false otherwise or on
40- * error.
41- */
42- extern bool crc32c (const char * filename , const char * hash );
43-
4429/*
4530 * Taken from FreeBSD implementation of CRC32C, specifically:
4631 * - usr.bin\cksum\crc32_algo.c @ d91d2b513eb30a226e87f0e52e2f9f232a2e1ca3
Original file line number Diff line number Diff line change @@ -26,8 +26,9 @@ extern "C" {
2626
2727#if defined(WIN32 ) || defined(_WIN32 ) || defined(__WIN32__ ) || defined(__NT__ )
2828
29- #include <Fileapi.h>
3029#include <acquire_common_defs.h>
30+
31+ #include <Fileapi.h>
3132#include <io.h>
3233#include <wchar.h>
3334
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ set(Source_Exec_Files "main.c")
4949source_group ("${EXEC_NAME} Source Files" FILES "${Source_Exec_Files} " )
5050
5151add_executable ("${EXEC_NAME} " "${Source_Exec_Files} " )
52+ target_compile_definitions ("${EXEC_NAME} " PUBLIC "_${TARGET_ARCH} _" )
5253target_link_libraries (
5354 "${EXEC_NAME} "
5455 PRIVATE
Original file line number Diff line number Diff line change 1616#include <acquire_crc32c.h>
1717#elif defined(USE_LIBRHASH ) && USE_LIBRHASH
1818#include <acquire_librhash.h>
19+ #else
20+ #warning "Checksum lib could be specified"
1921#endif /* defined(USE_CRC32C) && USE_CRC32C */
2022
2123#if defined(USE_LIBCURL ) && USE_LIBCURL
22-
2324#include <acquire_libcurl.h>
24-
2525#elif defined(USE_WININET ) && USE_WININET
26-
2726#include <acquire_wininet.h>
28-
2927#elif defined(USE_LIBFETCH ) && USE_LIBFETCH
30-
3128#include <acquire_libfetch.h>
32-
3329#elif defined(USE_OPENBSD_FTP ) && USE_OPENBSD_FTP
34-
3530#include <acquire_openbsd_ftp.h>
36-
31+ #else
32+ #error "Network lib must be specified"
3733#endif /* defined(USE_LIBCURL) && USE_LIBCURL */
3834
3935#if (defined(USE_OPENSSL ) && USE_OPENSSL ) || \
5046#include <acquire_miniz.h>
5147#elif defined(USE_LIBARCHIVE ) && USE_LIBARCHIVE
5248#include <acquire_libarchive.h>
53- #elif
49+ #else
5450#error "Extract library must be specified"
5551#endif /* defined(USE_MINIZ) && USE_MINIZ */
5652
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ endif (HAVE_VA_COPY)
3333###############################
3434
3535add_executable ("${EXEC_NAME} " "${Header_Files} " "${Source_Files} " )
36+ target_compile_definitions ("${EXEC_NAME} " PUBLIC "_${TARGET_ARCH} _" )
3637
3738target_link_libraries ("${EXEC_NAME} " INTERFACE "${PROJECT_NAME} _compiler_flags" )
3839
Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ foreach (EXEC_NAME ${_targets})
118118 PROPERTIES COMPILE_DEFINITIONS "LIBACQUIRE_IMPLEMENTATION;USE_MINIZ=1" )
119119
120120 add_executable ("${EXEC_NAME} " "${Header_Files} " "${Source_Files} " )
121+ target_compile_definitions ("${EXEC_NAME} " PUBLIC "_${TARGET_ARCH} _" )
121122
122123 set_backend_definitions(${EXEC_NAME} )
123124
@@ -163,6 +164,7 @@ foreach (ARCHIVE_LIB ${_archives})
163164 source_group ("${EXEC_NAME} Source Files" FILES "${Source_Files} " )
164165
165166 add_executable ("${EXEC_NAME} " "${Header_Files} " "${Source_Files} " )
167+ target_compile_definitions ("${EXEC_NAME} " PUBLIC "_${TARGET_ARCH} _" )
166168
167169 if (ARCHIVE_LIB STREQUAL "miniz" )
168170 target_compile_definitions ("${EXEC_NAME} " PRIVATE USE_MINIZ=1)
Original file line number Diff line number Diff line change 11#include <greatest.h>
22
3+ #include "acquire_common_defs.h"
4+
35#include "test_checksum.h"
46#include "test_download.h"
57#include "test_fileutils.h"
Original file line number Diff line number Diff line change @@ -98,6 +98,7 @@ function(create_amalgamation_target amalgamation_header)
9898 get_filename_component (dir_of_amalgamation_header "${amalgamation_header} " DIRECTORY )
9999
100100 add_library ("${LIBRARY_NAME} " INTERFACE )
101+ target_compile_definitions ("${LIBRARY_NAME} " PUBLIC "_${TARGET_ARCH} _" )
101102 include (GNUInstallDirs)
102103 target_include_directories (
103104 "${LIBRARY_NAME} "
You can’t perform that action at this time.
0 commit comments