Skip to content

Commit

Permalink
Add some support for NetBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
ghewgill committed Feb 22, 2024
1 parent 11c9640 commit 7fdbfb1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
lib/time_posix.cpp
lib/time_darwin.cpp
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
set(platform_executor
src/rtl_posix.cpp
lib/file_posix.cpp
Expand Down Expand Up @@ -488,7 +488,7 @@ endif (WIN32)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
target_link_libraries(executor dl)
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
target_link_libraries(executor pthread)
endif ()

Expand Down
2 changes: 1 addition & 1 deletion exec/cnex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
lib/random_posix.c
lib/runtime_posix.c
)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
# Not all flavors of Linx will have the function clock_gettime(), and some have it in a different include.
# See exec/cnex/lib/time_linux.c for more information.
include(CheckSymbolExists)
Expand Down
18 changes: 17 additions & 1 deletion external/libbid.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@ if (NOT EXISTS external/IntelRDFPMathLib20U2)
RESULT_VARIABLE retcode
)
if (NOT "${retcode}" STREQUAL "0")
message(FATAL_ERROR "Fatal error extracting archive")
message(FATAL_ERROR "Fatal error patching file")
endif ()
endif ()
if (${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
execute_process(
COMMAND perl -p -i -e "s/unsigned short int fexcept_t/unsigned int fexcept_t/" external/IntelRDFPMathLib20U2/LIBRARY/src/bid_functions.h
RESULT_VARIABLE retcode
)
if (NOT "${retcode}" STREQUAL "0")
message(FATAL_ERROR "Fatal error patching file")
endif ()
execute_process(
COMMAND sh -c "(echo '#include <unistd.h>' && cat external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h) >external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h.new && mv external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h.new external/IntelRDFPMathLib20U2/LIBRARY/float128/dpml_exception.h"
RESULT_VARIABLE retcode
)
if (NOT "${retcode}" STREQUAL "0")
message(FATAL_ERROR "Fatal error patching file")
endif ()
endif ()
endif ()
Expand Down
2 changes: 1 addition & 1 deletion external/minizip.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ add_library(minizip
minizip11/zip.c
${minizip_platform}
)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" OR ${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
set_source_files_properties(minizip11/ioapi.c PROPERTIES COMPILE_DEFINITIONS "fopen64=fopen;fseeko64=fseeko;ftello64=ftello")
endif ()
target_include_directories(minizip
Expand Down

0 comments on commit 7fdbfb1

Please sign in to comment.