xref: /haiku/headers/libs/zydis/Zydis/Defines.h (revision 1003e004e6c97eb60657a98928dd334e141c59ee)
1*1003e004SJérôme Duval /***************************************************************************************************
2*1003e004SJérôme Duval 
3*1003e004SJérôme Duval   Zyan Disassembler Library (Zydis)
4*1003e004SJérôme Duval 
5*1003e004SJérôme Duval   Original Author : Joel Hoener
6*1003e004SJérôme Duval 
7*1003e004SJérôme Duval  * Permission is hereby granted, free of charge, to any person obtaining a copy
8*1003e004SJérôme Duval  * of this software and associated documentation files (the "Software"), to deal
9*1003e004SJérôme Duval  * in the Software without restriction, including without limitation the rights
10*1003e004SJérôme Duval  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11*1003e004SJérôme Duval  * copies of the Software, and to permit persons to whom the Software is
12*1003e004SJérôme Duval  * furnished to do so, subject to the following conditions:
13*1003e004SJérôme Duval  *
14*1003e004SJérôme Duval  * The above copyright notice and this permission notice shall be included in all
15*1003e004SJérôme Duval  * copies or substantial portions of the Software.
16*1003e004SJérôme Duval  *
17*1003e004SJérôme Duval  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18*1003e004SJérôme Duval  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19*1003e004SJérôme Duval  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20*1003e004SJérôme Duval  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21*1003e004SJérôme Duval  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22*1003e004SJérôme Duval  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23*1003e004SJérôme Duval  * SOFTWARE.
24*1003e004SJérôme Duval 
25*1003e004SJérôme Duval ***************************************************************************************************/
26*1003e004SJérôme Duval 
27*1003e004SJérôme Duval /**
28*1003e004SJérôme Duval  * @file
29*1003e004SJérôme Duval  * Import/export defines for MSVC builds.
30*1003e004SJérôme Duval  */
31*1003e004SJérôme Duval 
32*1003e004SJérôme Duval #ifndef ZYDIS_DEFINES_H
33*1003e004SJérôme Duval #define ZYDIS_DEFINES_H
34*1003e004SJérôme Duval 
35*1003e004SJérôme Duval #include <Zycore/Defines.h>
36*1003e004SJérôme Duval 
37*1003e004SJérôme Duval // This is a cut-down version of what CMake's `GenerateExportHeader` would usually generate. To
38*1003e004SJérôme Duval // simplify builds without CMake, we define these things manually instead of relying on CMake
39*1003e004SJérôme Duval // to generate the header.
40*1003e004SJérôme Duval //
41*1003e004SJérôme Duval // For static builds, our CMakeList will define `ZYDIS_STATIC_BUILD`. For shared library builds,
42*1003e004SJérôme Duval // our CMake will define `ZYDIS_SHOULD_EXPORT` depending on whether the target is being imported or
43*1003e004SJérôme Duval // exported. If CMake isn't used, users can manually define these to fit their use-case.
44*1003e004SJérôme Duval 
45*1003e004SJérôme Duval // Backward compatibility: CMake would previously generate these variables names. However, because
46*1003e004SJérôme Duval // they have pretty cryptic names, we renamed them when we got rid of `GenerateExportHeader`. For
47*1003e004SJérôme Duval // backward compatibility for users that don't use CMake and previously manually defined these, we
48*1003e004SJérôme Duval // translate the old defines here and print a warning.
49*1003e004SJérôme Duval #if defined(ZYDIS_STATIC_DEFINE)
50*1003e004SJérôme Duval #   pragma message("ZYDIS_STATIC_DEFINE was renamed to ZYDIS_STATIC_BUILD.")
51*1003e004SJérôme Duval #   define ZYDIS_STATIC_BUILD
52*1003e004SJérôme Duval #endif
53*1003e004SJérôme Duval #if defined(Zydis_EXPORTS)
54*1003e004SJérôme Duval #   pragma message("Zydis_EXPORTS was renamed to ZYDIS_SHOULD_EXPORT.")
55*1003e004SJérôme Duval #   define ZYDIS_SHOULD_EXPORT
56*1003e004SJérôme Duval #endif
57*1003e004SJérôme Duval 
58*1003e004SJérôme Duval /**
59*1003e004SJérôme Duval  * Symbol is exported in shared library builds.
60*1003e004SJérôme Duval  */
61*1003e004SJérôme Duval #if defined(ZYDIS_STATIC_BUILD)
62*1003e004SJérôme Duval #   define ZYDIS_EXPORT
63*1003e004SJérôme Duval #else
64*1003e004SJérôme Duval #   if defined(ZYDIS_SHOULD_EXPORT)
65*1003e004SJérôme Duval #       define ZYDIS_EXPORT ZYAN_DLLEXPORT
66*1003e004SJérôme Duval #   else
67*1003e004SJérôme Duval #       define ZYDIS_EXPORT ZYAN_DLLIMPORT
68*1003e004SJérôme Duval #   endif
69*1003e004SJérôme Duval #endif
70*1003e004SJérôme Duval 
71*1003e004SJérôme Duval /**
72*1003e004SJérôme Duval  * Symbol is not exported and for internal use only.
73*1003e004SJérôme Duval  */
74*1003e004SJérôme Duval #define ZYDIS_NO_EXPORT
75*1003e004SJérôme Duval 
76*1003e004SJérôme Duval #endif // ZYDIS_DEFINES_H
77