bazel work
This commit is contained in:
1
BUILD
1
BUILD
@@ -5,6 +5,7 @@ cc_binary(
|
||||
"ncac.h",
|
||||
],
|
||||
deps = [
|
||||
"//asana",
|
||||
"//ui",
|
||||
"@system_include//:curses"
|
||||
],
|
||||
|
||||
14
WORKSPACE
14
WORKSPACE
@@ -7,5 +7,19 @@ cc_library(
|
||||
srcs = ["libcurses.dylib"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "curl",
|
||||
srcs = ["libcurl.dylib"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
new_http_archive(
|
||||
name = "gtest",
|
||||
url = "https://github.com/google/googletest/archive/release-1.8.0.tar.gz",
|
||||
sha256 = "58a6f4277ca2bc8565222b3bbd58a177609e9c488e8a72649359ba51450db7d8",
|
||||
build_file = "gtest.BUILD",
|
||||
strip_prefix = "googletest-release-1.8.0",
|
||||
)
|
||||
|
||||
13
gtest.BUILD
Normal file
13
gtest.BUILD
Normal file
@@ -0,0 +1,13 @@
|
||||
cc_library(
|
||||
name = "main",
|
||||
srcs = glob(
|
||||
["src/*.cc"],
|
||||
exclude = ["src/gtest-all.cc"]
|
||||
),
|
||||
hdrs = glob([
|
||||
"include/**/*.h",
|
||||
"src/*.h"
|
||||
]),
|
||||
copts = ["-Iexternal/gtest/include"],
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
26
ncac.cc
26
ncac.cc
@@ -4,7 +4,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <term.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "ui/base.h"
|
||||
#include "asana/fetch.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
@@ -23,7 +26,7 @@ int main(int argc, char **argv) {
|
||||
case 'b':
|
||||
ui::draw_text("Goodbye, world!", &curs_x, &curs_y);
|
||||
break;
|
||||
default:
|
||||
case 'q':
|
||||
finish(SIGTERM);
|
||||
break;
|
||||
}
|
||||
@@ -33,15 +36,28 @@ int main(int argc, char **argv) {
|
||||
|
||||
static void finish(int sig) {
|
||||
endwin();
|
||||
asana::deinit();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void setup() {
|
||||
// initialize ncurses
|
||||
initscr();
|
||||
cbreak();
|
||||
// initialize the asana client
|
||||
if (!asana::init()) {
|
||||
std::cerr << "Unable to initialize the Asana client\n" << EOF;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// don't echo input
|
||||
// initialize ncurses
|
||||
if (!initscr()) {
|
||||
std::cerr << "Unable to initialize the curses screen.\n" << EOF;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// don't buffer or echo input
|
||||
if (cbreak() == ERR) {
|
||||
std::cerr << "Unable to initialize.\n" << EOF;
|
||||
exit(1);
|
||||
}
|
||||
noecho();
|
||||
nonl();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user