Created by: gangliao
cc_library|nv_library(<target_name>
[STATIC SHARED OBJECT]
SRCS <file>...
OBJS <objs>...
DEPS <libs>...)
cc_library and nv_library can generate *.o, *.a, or *.so
if the corresponding keyword OBJECT, STATIC or SHARED is specified.
cc_binary|nv_binary(<target_name>
SRCS <file>...
OBJS <objs>...
DEPS <libs>...)
cc_binary and nv_binary can build source code and link the dependent
libraries to generate a binary.
cc_test|nv_test(<target_name>
SRCS <file>...
OBJS <objs>...
DEPS <libs>...)
cc_test and nv_test can build test code, link gtest and other dependents
libraries to generate the test suite.
For example, in one folder, it contains
ddim{.h, .cc, _test.cc, _test.cu}
place{.h, cc, _test.cc}
We can add build script as follows:
cc_library(place OBJECT
SRCS place.cc)
place.cc -> place.o
cc_library's OBJECT OPTION will generate place.o.
cc_test(place_test
SRCS place_test.cc
OBJS place
DEPS glog gflags)
place_test.cc, place.o, glog, gflags -> place_test
cc_test will combine place_test.cc, place.o with libglog.a
and libgflags.a to generate place_test.
cc_library(ddim OBJECT
SRCS ddim.cc)
ddim.cc -> ddim.o
cc_library's OBJECT OPTION will generate ddim.o.
cc_test(ddim_test
SRCS ddim_test.cc
OBJS ddim)
ddim_test.cc, ddim.o -> ddim_test
cc_test will build ddim_test.cc with ddim.o to generate ddim_test.
nv_test(dim_test
SRCS dim_test.cu
OBJS ddim)
dim_test.cu, ddim.o -> dim_test
nv_test will build dim_test.cu with ddim.o to generate dim_test.
cc_library(majel
OBJS place ddim)
place.o, ddim.o -> libmajel.a
cc_library's default OPTION is STATIC. It will archive place.o
and ddim.o to generate libmajel.a.