From f40608e4909bbe78cc1c9954b305bbc7513dd63e Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Wed, 29 Apr 2026 18:36:39 -0400 Subject: [PATCH] Add testing export macros --- Code/max/Testing/TestingExport.hpp | 27 +++++++++++++++++++ Projects/VisualStudio/max/max.vcxproj | 1 + Projects/VisualStudio/max/max.vcxproj.filters | 3 +++ 3 files changed, 31 insertions(+) create mode 100644 Code/max/Testing/TestingExport.hpp diff --git a/Code/max/Testing/TestingExport.hpp b/Code/max/Testing/TestingExport.hpp new file mode 100644 index 0000000..02ff012 --- /dev/null +++ b/Code/max/Testing/TestingExport.hpp @@ -0,0 +1,27 @@ +// Copyright 2026, The max Contributors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MAX_TESTING_EXPORT_HPP +#define MAX_TESTING_EXPORT_HPP + +// There are functions which are only used within a given translation unit. +// They should not be exported to the linker. + +// However, you will want to test those functions. And since the test code +// likely lives in a different file, you *will* want the functions to be +// exported to the linker. + +// If a project has the definition MAX_TEST, these macros will export the +// functions marked with them. +// A normal project won't define MAX_TEST and so the functions remain hidden. + +#ifdef MAX_TEST + #define MAX_TESTING_EXPORT_DECLARATION( Declaration ) Declaration + #define MAX_TESTING_EXPORT_DEFINITION( Definition ) Definition +#else + #define MAX_TESTING_EXPORT_DECLARATION( Declaration ) + #define MAX_TESTING_EXPORT_DEFINITION( Definition ) static Definition +#endif + +#endif // #ifndef MAX_TESTING_EXPORT_HPP diff --git a/Projects/VisualStudio/max/max.vcxproj b/Projects/VisualStudio/max/max.vcxproj index 54ee0a8..526ad8b 100644 --- a/Projects/VisualStudio/max/max.vcxproj +++ b/Projects/VisualStudio/max/max.vcxproj @@ -289,6 +289,7 @@ + diff --git a/Projects/VisualStudio/max/max.vcxproj.filters b/Projects/VisualStudio/max/max.vcxproj.filters index 4f8f626..a6ddfe4 100644 --- a/Projects/VisualStudio/max/max.vcxproj.filters +++ b/Projects/VisualStudio/max/max.vcxproj.filters @@ -492,6 +492,9 @@ Code\max\Algorithms + + Code\max\Testing +