diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c7ed763c2f9df0d5e78b65432fd83c6f2ce85a6..42019395dbbf453409c0d9442b91797852d96b7d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -705,9 +705,7 @@ else() endif() if(NOT WITH_SHARED_IR) - if(WIN32) - add_definitions(-DIR_API=) - endif() + add_definitions(-DSTATIC_IR) endif() if(WITH_STRIP) diff --git a/paddle/ir/CMakeLists.txt b/paddle/ir/CMakeLists.txt index 6536a2fe0183fd2a996861272116df520ed7fea6..e82c944fb9fdbf1a68a16ad850a2ee762f1cffe3 100644 --- a/paddle/ir/CMakeLists.txt +++ b/paddle/ir/CMakeLists.txt @@ -1,3 +1,4 @@ +add_definitions(-DIR_LIBRARY) set_property(GLOBAL PROPERTY IR_TARGETS "") set_property(GLOBAL PROPERTY IR_MODULES "") function(ir_library TARGET_NAME) @@ -33,10 +34,6 @@ function(ir_library TARGET_NAME) endif() endfunction() -if(WITH_SHARED_IR) - add_definitions(-DIR_DLL_EXPORT) -endif() - add_subdirectory(core) add_subdirectory(pass) add_subdirectory(pattern_rewrite) diff --git a/paddle/ir/core/dll_decl.h b/paddle/ir/core/dll_decl.h index d0be0eff305bed866368786f59fcb255fcdbcdfa..10fed4fe45cde660409e619273ccd68634163210 100644 --- a/paddle/ir/core/dll_decl.h +++ b/paddle/ir/core/dll_decl.h @@ -13,15 +13,13 @@ // limitations under the License. #pragma once - +#define IR_API #if defined(_WIN32) -#ifndef IR_API -#ifdef IR_DLL_EXPORT +#ifndef STATIC_IR +#ifdef IR_LIBRARY #define IR_API __declspec(dllexport) #else #define IR_API __declspec(dllimport) -#endif // IR_DLL_EXPORT -#endif // IR_API -#else -#define IR_API +#endif // IR_LIBRARY +#endif // STATIC_IR #endif // _WIN32