diff --git a/src/bindings/sail-c++/CMakeLists.txt b/src/bindings/sail-c++/CMakeLists.txt index 65927028..693a98f9 100644 --- a/src/bindings/sail-c++/CMakeLists.txt +++ b/src/bindings/sail-c++/CMakeLists.txt @@ -49,6 +49,8 @@ add_library(sail-c++ source_image.cpp source_image.h special_properties.h + suppress_c4251_begin.h + suppress_end.h tuning.h utils.cpp utils.h @@ -85,6 +87,8 @@ set(PUBLIC_HEADERS abstract_io.h save_options.h source_image.h special_properties.h + suppress_c4251_begin.h + suppress_end.h tuning.h utils.h variant.h) diff --git a/src/bindings/sail-c++/sail-c++.h b/src/bindings/sail-c++/sail-c++.h index 0b3c7694..eea0ba97 100644 --- a/src/bindings/sail-c++/sail-c++.h +++ b/src/bindings/sail-c++/sail-c++.h @@ -33,17 +33,7 @@ #include #ifdef SAIL_BUILD - #ifdef _MSC_VER - #pragma warning(push) - /* - * load_options.h: warning C4251: 'sail::load_options::d': class 'std::unique_ptr<...>' - * needs to have dll-interface to be used by clients of class 'sail::load_options'. - * - * To fix this warning we need to stop exporting whole classes and start exporting - * individual methods. Just silence this warning. - */ - #pragma warning(disable: 4251) - #endif + #include #include #include @@ -80,9 +70,7 @@ #include #ifdef SAIL_BUILD - #ifdef _MSC_VER - #pragma warning(pop) - #endif + #include #endif #endif diff --git a/src/bindings/sail-c++/suppress_c4251_begin.h b/src/bindings/sail-c++/suppress_c4251_begin.h new file mode 100644 index 00000000..5a7d090e --- /dev/null +++ b/src/bindings/sail-c++/suppress_c4251_begin.h @@ -0,0 +1,36 @@ +/* This file is part of SAIL (https://github.com/HappySeaFox/sail) + + Copyright (c) 2023 Dmitry Baryshev + + The MIT License + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifdef _MSC_VER +#pragma warning(push) +/* + * load_options.h: warning C4251: 'sail::load_options::d': class 'std::unique_ptr<...>' + * needs to have dll-interface to be used by clients of class 'sail::load_options'. + * + * To fix this warning we need to stop exporting whole classes and start exporting + * individual methods. Just silence this warning. + */ +#pragma warning(disable: 4251) +#endif diff --git a/src/bindings/sail-c++/suppress_end.h b/src/bindings/sail-c++/suppress_end.h new file mode 100644 index 00000000..52c1423d --- /dev/null +++ b/src/bindings/sail-c++/suppress_end.h @@ -0,0 +1,28 @@ +/* This file is part of SAIL (https://github.com/HappySeaFox/sail) + + Copyright (c) 2023 Dmitry Baryshev + + The MIT License + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ + +#ifdef _MSC_VER +#pragma warning(pop) +#endif diff --git a/tests/bindings/c++/can-load.cpp b/tests/bindings/c++/can-load.cpp index c6987a03..4d114c42 100644 --- a/tests/bindings/c++/can-load.cpp +++ b/tests/bindings/c++/can-load.cpp @@ -23,7 +23,19 @@ SOFTWARE. */ -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include #include "munit.h" diff --git a/tests/bindings/c++/iccp.cpp b/tests/bindings/c++/iccp.cpp index facaf329..3974399e 100644 --- a/tests/bindings/c++/iccp.cpp +++ b/tests/bindings/c++/iccp.cpp @@ -25,7 +25,12 @@ #include /* move */ -#include +#include + +#include +#include + +#include #include "munit.h" diff --git a/tests/bindings/c++/load_features.cpp b/tests/bindings/c++/load_features.cpp index bb19000c..f5df647e 100644 --- a/tests/bindings/c++/load_features.cpp +++ b/tests/bindings/c++/load_features.cpp @@ -25,7 +25,13 @@ #include -#include +#include + +#include +#include +#include + +#include #include "munit.h" diff --git a/tests/bindings/c++/load_options.cpp b/tests/bindings/c++/load_options.cpp index 90e83ec7..adf6b951 100644 --- a/tests/bindings/c++/load_options.cpp +++ b/tests/bindings/c++/load_options.cpp @@ -25,7 +25,13 @@ #include -#include +#include + +#include +#include +#include + +#include #include "munit.h" diff --git a/tests/bindings/c++/meta_data.cpp b/tests/bindings/c++/meta_data.cpp index b913199a..01551619 100644 --- a/tests/bindings/c++/meta_data.cpp +++ b/tests/bindings/c++/meta_data.cpp @@ -25,7 +25,12 @@ #include /* move */ -#include +#include + +#include +#include + +#include #include "munit.h"