Add preliminary support for NetBSD

This commit is contained in:
Charlotte Koch 2024-10-24 15:42:26 -07:00
parent 15d116b7ea
commit 20c79e32f8
2 changed files with 10 additions and 0 deletions

View File

@ -80,6 +80,8 @@ if(NOT DEFINED STAR_SYSTEM)
set(STAR_SYSTEM "linux")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set(STAR_SYSTEM "freebsd")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD")
set(STAR_SYSTEM "netbsd")
elseif(UNIX)
set(STAR_SYSTEM "unix")
else()
@ -208,6 +210,8 @@ elseif(STAR_SYSTEM STREQUAL "linux")
set_flag(STAR_SYSTEM_LINUX)
elseif(STAR_SYSTEM STREQUAL "freebsd")
set_flag(STAR_SYSTEM_FREEBSD)
elseif(STAR_SYSTEM STREQUAL "netbsd")
set_flag(STAR_SYSTEM_NETBSD)
endif()
if(STAR_SYSTEM_FAMILY STREQUAL "windows")
@ -445,6 +449,10 @@ elseif(STAR_SYSTEM_FREEBSD)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt")
elseif(STAR_SYSTEM_NETBSD)
set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lpthread -lrt -lexecinfo")
set(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lpthread -lrt -lexecinfo")
endif()
# Find all required external libraries, based on build settings...

View File

@ -78,6 +78,8 @@ struct ThreadImpl {
#ifdef STAR_SYSTEM_FREEBSD
pthread_set_name_np(pthread, tname);
#elif defined(STAR_SYSTEM_NETBSD)
pthread_setname_np(pthread, "%s", tname);
#elif not defined STAR_SYSTEM_MACOS
pthread_setname_np(pthread, tname);
#endif