cc_project_template_gn

A gn, ninja, and googletest-based C++ project template
git clone https://git.bracken.jp/cc_project_template_gn.git
Log | Files | Refs | Submodules | README | LICENSE

BUILD.gn (544B)


      1 executable("main") {
      2   sources = [
      3     "main.cc",
      4   ]
      5   deps = [
      6     ":foo_srcs",
      7   ]
      8 }
      9 
     10 FOO_SOURCES = [
     11   "bar.cc",
     12   "bar.h",
     13   "foo.cc",
     14   "foo.h",
     15 ]
     16 
     17 source_set("foo_srcs") {
     18   sources = FOO_SOURCES
     19 }
     20 
     21 static_library("libfoo_static") {
     22   sources = FOO_SOURCES
     23 }
     24 
     25 shared_library("libfoo_shared") {
     26   sources = FOO_SOURCES
     27 }
     28 
     29 executable("foo_tests") {
     30   testonly = true
     31 
     32   sources = [
     33     "bar_test.cc",
     34     "foo_test.cc",
     35   ]
     36   deps = [
     37     ":foo_srcs",
     38     "//third_party/googletest:gtest",
     39     "//third_party/googletest:gtest_main",
     40   ]
     41 }