From 23ed5642fbd286e9853798754ce99a712a97625f Mon Sep 17 00:00:00 2001 From: lyken Date: Sun, 14 Jul 2024 01:46:54 +0800 Subject: [PATCH] core: -I irrt/ & #include absolute paths --- nac3core/build.rs | 4 ++++ nac3core/irrt/irrt.cpp | 2 +- nac3core/irrt/irrt/core.hpp | 4 ++-- nac3core/irrt/irrt/error_context.hpp | 4 ++-- nac3core/irrt/irrt/string_utils.hpp | 2 +- nac3core/irrt/irrt/utils.hpp | 2 +- nac3core/irrt/irrt_everything.hpp | 8 ++++---- nac3core/irrt/irrt_test.cpp | 8 ++++---- nac3core/irrt/test/core.hpp | 2 +- nac3core/irrt/test/test_core.hpp | 4 ++-- nac3core/irrt/test/test_utils.hpp | 4 ++-- 11 files changed, 24 insertions(+), 20 deletions(-) diff --git a/nac3core/build.rs b/nac3core/build.rs index 0c9d6407..33cf3da9 100644 --- a/nac3core/build.rs +++ b/nac3core/build.rs @@ -46,6 +46,8 @@ fn compile_irrt_cpp() { "-Wall", "-Wextra", "-Werror=return-type", + "-I", + irrt_dir.to_str().unwrap(), "-o", "-", irrt_cpp_path.to_str().unwrap(), @@ -133,6 +135,8 @@ fn compile_irrt_test_cpp() { "-Wextra", "-Werror=return-type", "-lm", // for `tgamma()`, `lgamma()` + "-I", + irrt_dir.to_str().unwrap(), "-o", exe_path.to_str().unwrap(), ]; diff --git a/nac3core/irrt/irrt.cpp b/nac3core/irrt/irrt.cpp index 489ce090..f6e41655 100644 --- a/nac3core/irrt/irrt.cpp +++ b/nac3core/irrt/irrt.cpp @@ -1,5 +1,5 @@ #define IRRT_DEFINE_TYPEDEF_INTS -#include "irrt_everything.hpp" +#include /* All IRRT implementations. diff --git a/nac3core/irrt/irrt/core.hpp b/nac3core/irrt/irrt/core.hpp index 31bec3fc..88a7e418 100644 --- a/nac3core/irrt/irrt/core.hpp +++ b/nac3core/irrt/irrt/core.hpp @@ -1,7 +1,7 @@ #pragma once -#include "utils.hpp" -#include "int_defs.hpp" +#include +#include // NDArray indices are always `uint32_t`. using NDIndex = uint32_t; diff --git a/nac3core/irrt/irrt/error_context.hpp b/nac3core/irrt/irrt/error_context.hpp index 824f6eb7..2e656531 100644 --- a/nac3core/irrt/irrt/error_context.hpp +++ b/nac3core/irrt/irrt/error_context.hpp @@ -1,7 +1,7 @@ #pragma once -#include "int_defs.hpp" -#include "utils.hpp" +#include +#include namespace { // nac3core's "str" struct type definition diff --git a/nac3core/irrt/irrt/string_utils.hpp b/nac3core/irrt/irrt/string_utils.hpp index c2750600..ec723dcb 100644 --- a/nac3core/irrt/irrt/string_utils.hpp +++ b/nac3core/irrt/irrt/string_utils.hpp @@ -1,6 +1,6 @@ #pragma once -#include "int_defs.hpp" +#include namespace { namespace string { diff --git a/nac3core/irrt/irrt/utils.hpp b/nac3core/irrt/irrt/utils.hpp index 27dcbb6e..d7fa13eb 100644 --- a/nac3core/irrt/irrt/utils.hpp +++ b/nac3core/irrt/irrt/utils.hpp @@ -1,6 +1,6 @@ #pragma once -#include "int_defs.hpp" +#include namespace { template diff --git a/nac3core/irrt/irrt_everything.hpp b/nac3core/irrt/irrt_everything.hpp index 5abbf61f..e7919124 100644 --- a/nac3core/irrt/irrt_everything.hpp +++ b/nac3core/irrt/irrt_everything.hpp @@ -1,6 +1,6 @@ #pragma once -#include "irrt/core.hpp" -#include "irrt/error_context.hpp" -#include "irrt/int_defs.hpp" -#include "irrt/utils.hpp" \ No newline at end of file +#include +#include +#include +#include \ No newline at end of file diff --git a/nac3core/irrt/irrt_test.cpp b/nac3core/irrt/irrt_test.cpp index 57cdd3e8..afc5be43 100644 --- a/nac3core/irrt/irrt_test.cpp +++ b/nac3core/irrt/irrt_test.cpp @@ -5,11 +5,11 @@ #include #include -#include "irrt_everything.hpp" +#include -#include "test/core.hpp" -#include "test/test_core.hpp" -#include "test/test_utils.hpp" +#include +#include +#include int main() { run_test_core(); diff --git a/nac3core/irrt/test/core.hpp b/nac3core/irrt/test/core.hpp index 34063aa4..8726b766 100644 --- a/nac3core/irrt/test/core.hpp +++ b/nac3core/irrt/test/core.hpp @@ -6,7 +6,7 @@ #include #include -#include "print.hpp" +#include // Some utils can be used here #include "../irrt/utils.hpp" diff --git a/nac3core/irrt/test/test_core.hpp b/nac3core/irrt/test/test_core.hpp index 1d5b7d93..94dd292d 100644 --- a/nac3core/irrt/test/test_core.hpp +++ b/nac3core/irrt/test/test_core.hpp @@ -1,7 +1,7 @@ #pragma once -#include "core.hpp" -#include "../irrt/core.hpp" +#include +#include void test_int_exp() { BEGIN_TEST(); diff --git a/nac3core/irrt/test/test_utils.hpp b/nac3core/irrt/test/test_utils.hpp index cad0da18..d8cc1f63 100644 --- a/nac3core/irrt/test/test_utils.hpp +++ b/nac3core/irrt/test/test_utils.hpp @@ -1,7 +1,7 @@ #pragma once -#include "core.hpp" -#include "../irrt/utils.hpp" +#include +#include void test_int_log_10() { BEGIN_TEST();