mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
CMake: don't define killer options on FreeBSD
This commit is contained in:
parent
355021de56
commit
16c086b41a
@ -203,18 +203,21 @@ target_link_directories(notcurses PRIVATE ${OIIO_LIBRARY_DIRS})
|
||||
target_link_directories(notcurses-static PRIVATE ${OIIO_STATIC_LIBRARY_DIRS})
|
||||
endif()
|
||||
|
||||
# don't want these on freebsd
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
target_compile_definitions(notcurses
|
||||
PUBLIC
|
||||
_POSIX_C_SOURCE=200809L _XOPEN_SOURCE=500 # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
|
||||
_XOPEN_SOURCE=700 # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
|
||||
PRIVATE
|
||||
_GNU_SOURCE _DEFAULT_SOURCE
|
||||
_GNU_SOURCE _DEFAULT_SOURCE
|
||||
)
|
||||
target_compile_definitions(notcurses-static
|
||||
PUBLIC
|
||||
_POSIX_C_SOURCE=200809L _XOPEN_SOURCE=500 # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
|
||||
_XOPEN_SOURCE=700 # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
|
||||
PRIVATE
|
||||
_GNU_SOURCE _DEFAULT_SOURCE
|
||||
_GNU_SOURCE _DEFAULT_SOURCE
|
||||
)
|
||||
endif()
|
||||
|
||||
# libnotcurses++
|
||||
set(NCPP_SOURCES
|
||||
|
@ -3,7 +3,9 @@
|
||||
#include <unistd.h>
|
||||
#include <locale.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef __linux__
|
||||
#include <sys/sysinfo.h>
|
||||
#endif
|
||||
#include <sys/utsname.h>
|
||||
#include <notcurses/notcurses.h>
|
||||
|
||||
@ -14,7 +16,7 @@ typedef struct distro_info {
|
||||
|
||||
typedef struct fetched_info {
|
||||
char* username; // we borrow a reference
|
||||
char hostname[HOST_NAME_MAX];
|
||||
char hostname[_POSIX_HOST_NAME_MAX];
|
||||
const distro_info* distro;
|
||||
char* distro_release;
|
||||
char* kernel; // strdup(uname(2)->name)
|
||||
@ -257,12 +259,14 @@ infoplane(struct notcurses* nc, const fetched_info* fi){
|
||||
ncplane_printf_aligned(infop, 1, NCALIGN_RIGHT, "%s %s ",
|
||||
fi->distro->name, fi->distro_release);
|
||||
ncplane_set_attr(infop, NCSTYLE_NONE);
|
||||
#ifdef __linux__
|
||||
struct sysinfo sinfo;
|
||||
sysinfo(&sinfo);
|
||||
unsigned long totalmib = sinfo.totalram / (1024 * 1024);
|
||||
unsigned long usedmib = totalmib - (sinfo.freeram / 1024 / 1024);
|
||||
ncplane_printf_aligned(infop, 2, NCALIGN_LEFT, " RAM: %lu/%lu\n", usedmib, totalmib);
|
||||
ncplane_printf_aligned(infop, 2, NCALIGN_RIGHT, "Processes: %hu ", sinfo.procs);
|
||||
#endif
|
||||
cell ul = CELL_TRIVIAL_INITIALIZER; cell ur = CELL_TRIVIAL_INITIALIZER;
|
||||
cell ll = CELL_TRIVIAL_INITIALIZER; cell lr = CELL_TRIVIAL_INITIALIZER;
|
||||
cell hl = CELL_TRIVIAL_INITIALIZER; cell vl = CELL_TRIVIAL_INITIALIZER;
|
||||
|
@ -1,3 +1,5 @@
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include "internal.h"
|
||||
|
||||
typedef struct ncfadectx {
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <pthread.h>
|
||||
#include <sys/poll.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/fcntl.h>
|
||||
#ifdef __linux__
|
||||
#include <linux/wait.h>
|
||||
#include <asm/unistd.h>
|
||||
|
@ -29,6 +29,7 @@ const char* oiio_version(void);
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <wctype.h>
|
||||
#include <pthread.h>
|
||||
#include <termios.h>
|
||||
#include <stdbool.h>
|
||||
#include <langinfo.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user