|
| 1 | +set_project("cpp-ipc") |
| 2 | +set_version("2.0.0", {build = "%Y%m%d%H%M"}) |
| 3 | + |
| 4 | +-- Build all of libipc's own tests. |
| 5 | +option("build_tests") set_default(false) |
| 6 | +-- Build all of libipc's own demos. |
| 7 | +option("build_demos") set_default(false) |
| 8 | +-- Build all of libipc's own benchmark tests. |
| 9 | +option("build_benchmarks") set_default(false) |
| 10 | +-- Build shared libraries (DLLs). |
| 11 | +option("build_shared_lib") set_default(false) |
| 12 | +-- Set to ON to build with static CRT on Windows (/MT). |
| 13 | +option("use_static_crt") set_default(false) |
| 14 | +-- Build with unit test coverage. |
| 15 | +option("use_codecov") set_default(false) |
| 16 | +option_end() |
| 17 | + |
| 18 | +add_rules("mode.debug", "mode.release") |
| 19 | +set_languages("cxx17") |
| 20 | +if is_mode("debug") then |
| 21 | + if has_config("use_static_crt") then |
| 22 | + set_runtimes("MTd") |
| 23 | + else |
| 24 | + set_runtimes("MDd") |
| 25 | + end |
| 26 | +else |
| 27 | + if has_config("use_static_crt") then |
| 28 | + set_runtimes("MT") |
| 29 | + else |
| 30 | + set_runtimes("MD") |
| 31 | + end |
| 32 | +end |
| 33 | + |
| 34 | +function config_target_compilation(target) |
| 35 | + if target:has_tool("cxx", "cl") then |
| 36 | + target:add("defines", "UNICODE", "_UNICODE") |
| 37 | + if is_mode("debug") then |
| 38 | + target:add("cxflags", "/Zi") |
| 39 | + end |
| 40 | + else |
| 41 | + target:add("cxflags", "-fPIC", "-Wno-attributes") |
| 42 | + if has_config("use_codecov") then |
| 43 | + target:add("cxflags", "--coverage") |
| 44 | + target:add("ldflags", "--coverage") |
| 45 | + target:add("syslinks", "gcov") |
| 46 | + end |
| 47 | + if is_mode("debug") then |
| 48 | + target:add("cxflags", "-rdynamic -fsanitize=address") |
| 49 | + target:add("ldflags", "-fsanitize=address") |
| 50 | + end |
| 51 | + end |
| 52 | +end |
| 53 | + |
| 54 | +includes("src") |
| 55 | +if has_config("build_tests") then |
| 56 | + includes("test") |
| 57 | +end |
| 58 | +if has_config("build_demos") then |
| 59 | + includes("demo") |
| 60 | +end |
| 61 | +if has_config("build_benchmarks") then |
| 62 | + includes("benchmark") |
| 63 | +end |
0 commit comments