Skip to content

Commit

Permalink
Fixing mac build
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Johnson <[email protected]>
  • Loading branch information
matajoh committed Nov 1, 2024
1 parent ed61d96 commit 4a07715
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 42 deletions.
41 changes: 1 addition & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,46 +26,7 @@ option( LIBNPY_BUILD_DOCUMENTATION "Specifies whether to build the documentation
option( LIBNPY_INCLUDE_CSHARP "Specifies whether to build libnpy with C# bindings" OFF )
set( LIBNPY_SANITIZE "" CACHE STRING "Argument to pass to sanitize (disabled by default)")

# ------------------- Detect the system -----------------------

if( APPLE )
set( SYSTEM_NAME "Mac" )
set( LIBNPY_NUGET_LIB "libnpy.a")
set( SYSTEM_TOOLKIT "${CMAKE_CXX_COMPILER_VERSION}")
elseif( UNIX )
set( SYSTEM_NAME "Linux" )
set( LIBNPY_NUGET_LIB "libnpy.a")
execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE LSB_ID)
execute_process(COMMAND lsb_release -rs OUTPUT_VARIABLE LSB_RELEASE)
if( LSB_ID AND LSB_RELEASE )
string(STRIP "${LSB_ID}" LSB_ID)
string(STRIP "${LSB_RELEASE}" LSB_RELEASE)
set( SYSTEM_NAME "${SYSTEM_NAME}-${LSB_ID}-${LSB_RELEASE}")
elseif( EXISTS "/etc/debian_version")
file( READ /etc/debian_version DEBIAN_VERSION )
set( SYSTEM_NAME "${SYSTEM_NAME}-${DEBIAN_VERSION}")
elseif( EXISTS "/etc/os-release")
execute_process(COMMAND "sed" "-ne" "s/^ID=\"\\?\\([a-z]\\+\\)\"\\?$/\\1/p" "/etc/os-release" OUTPUT_VARIABLE OS_RELEASE_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND "sed" "-ne" "s/^VERSION_ID=\"\\?\\([0-9\\.]\\+\\)\"\\?$/\\1/p" "/etc/os-release" OUTPUT_VARIABLE OS_RELEASE_VERSION_ID OUTPUT_STRIP_TRAILING_WHITESPACE)
set( SYSTEM_NAME "${SYSTEM_NAME}-${OS_RELEASE_ID}-${OS_RELEASE_VERSION_ID}")
elseif( EXISTS "/etc/redhat-release")
set( SYSTEM_NAME "${SYSTEM_NAME}-Redhat")
endif()
set( SYSTEM_TOOLKIT "gcc${CMAKE_CXX_COMPILER_VERSION}")
elseif( WIN32 )
set( LIBNPY_NUGET_LIB "npy.lib")
set( SYSTEM_NAME "Windows" )
set( SYSTEM_TOOLKIT "v${MSVC_TOOLSET_VERSION}")
endif()

if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( SYSTEM_NAME "${SYSTEM_NAME}-64bit" )
set( SYSTEM_BITS "x64" )
else()
set( SYSTEM_NAME "${SYSTEM_NAME}-32bit" )
set( SYSTEM_BITS "x86" )
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# -------------------- Find packages --------------------------
Expand Down
4 changes: 2 additions & 2 deletions include/npy/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ class membuf : public std::basic_streambuf<std::uint8_t> {
std::streamsize showmanyc() override;
std::streamsize xsgetn(std::uint8_t *s, std::streamsize n) override;
int_type underflow() override;
int_type pbackfail(int_type c = traits_type::eof()) override;
int_type pbackfail(int_type c = std::char_traits<char>::eof()) override;
std::streamsize xsputn(const std::uint8_t *s, std::streamsize n) override;
int_type overflow(int_type c = traits_type::eof()) override;
int_type overflow(int_type c = std::char_traits<char>::eof()) override;

private:
std::vector<std::uint8_t> m_buffer;
Expand Down

0 comments on commit 4a07715

Please sign in to comment.