Skip to content

Commit

Permalink
Fix build on some BSD systems
Browse files Browse the repository at this point in the history
  • Loading branch information
rikyoz committed Aug 3, 2024
1 parent 698778e commit f9fc635
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/bitnestedarchivereader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

#ifdef _WIN32
#include <windows.h>
#elif defined( __APPLE__ )
#elif defined( __APPLE__ ) || defined( BSD ) || \
defined( __FreeBSD__ ) || defined( __NetBSD__ ) || defined( __OpenBSD__ ) || defined( __DragonFly__ )
#include <sys/types.h>
#include <sys/sysctl.h>
#else
Expand Down Expand Up @@ -49,7 +50,8 @@ auto get_free_ram() -> std::uint64_t {
memStatus.dwLength = sizeof(MEMORYSTATUS);
::GlobalMemoryStatus(&memStatus);
return memStatus.dwAvailPhys;
#elif defined( __APPLE__ )
#elif defined( __APPLE__ ) || defined( BSD ) || \
defined( __FreeBSD__ ) || defined( __NetBSD__ ) || defined( __OpenBSD__ ) || defined( __DragonFly__ )
static int mib[] = { CTL_HW, HW_USERMEM };
std::uint64_t value = 0;
std::size_t length = sizeof( value );
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ set( CMAKE_CXX_STANDARD_LIBRARIES "" )

target_link_libraries( ${TESTS_BASE_TARGET} INTERFACE ${LIB_TARGET} 7-zip )

if( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
if( CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
target_link_libraries( ${TESTS_BASE_TARGET} INTERFACE pthread )
endif()

Expand Down

0 comments on commit f9fc635

Please sign in to comment.