新增 命名空间和动态库控制宏

reconstruct-gltfLoader
InkSoul 2025-03-30 23:13:04 +08:00
parent 8d4ed62b67
commit be0e1e70bd
2 changed files with 43 additions and 1 deletions

View File

@ -8,6 +8,11 @@ set(MAIN_FILE
${PLUMAGE_RENDER}/render.cpp ${PLUMAGE_RENDER}/render.cpp
) )
set(GLTF_MODEL_LOADER
"${PLUMAGE_RENDER}/glTFBoundingBox.h"
"${PLUMAGE_RENDER}/glTFBoundingBox.cpp"
)
# wayland requires additional source files # wayland requires additional source files
IF(USE_WAYLAND_WSI) IF(USE_WAYLAND_WSI)
SET(SOURCE ${SOURCE} ${CMAKE_BINARY_DIR}/xdg-shell-client-protocol.h ${CMAKE_BINARY_DIR}/xdg-shell-protocol.c ) SET(SOURCE ${SOURCE} ${CMAKE_BINARY_DIR}/xdg-shell-client-protocol.h ${CMAKE_BINARY_DIR}/xdg-shell-protocol.c )
@ -37,10 +42,11 @@ include_directories(${lib_base_path})
if(WIN32) if(WIN32)
add_executable(${RenderName} WIN32 ${SHADERS_GLSL} ${SHADERS_HLSL} add_executable(${RenderName} WIN32 ${SHADERS_GLSL} ${SHADERS_HLSL}
${MAIN_FILE} ${MAIN_FILE}
${GLTF_MODEL_LOADER}
"render/glTFModel.h" "render/glTFModel.h"
"render/glTFModel.cpp" "render/glTFModel.cpp"
"render/renderFoundation.h" "render/renderFoundation.h"
"render/renderFoundation.cpp") "render/renderFoundation.cpp" )
target_link_libraries(${RenderName} base ${Vulkan_LIBRARY} ${WINLIBS}) target_link_libraries(${RenderName} base ${Vulkan_LIBRARY} ${WINLIBS})
endif() endif()
set_target_properties(${RenderName} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) set_target_properties(${RenderName} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
@ -51,6 +57,12 @@ if(RESOURCE_INSTALL_DIR)
endif() endif()
#if(WIN32)
# target_compile_definitions(MyLib PRIVATE MYLIB_EXPORTS)
#endif(UNIX AND NOT APPLE) # Linux
# add_compile_options(-fvisibility=hidden)
# add_compile_options(-fvisibility-inlines-hidden)
#endif()

View File

@ -0,0 +1,30 @@
#pragma once
/// 命名空间宏
#define GLTFLOADER_NAMESPACE_BEGIN namespace glTFLoader {
#define GLTFLOADER_NAMESPACE_END }
/// windows 导入导出宏GLTFLOADER_EXPORTS将在cmake中定义
/// unix-like 下提供符号可见性控制
#ifdef GLTFLOADER_STATIC_BUILD
#define GLTFLOADER_API
#define GLTFLOADER_LOCAL
#else
#ifdef _WIN32
#ifdef GLTFLOADER_EXPORTS
#define GLTFLOADER_API __declspec(dllexport)
#define GLTFLOADER_LOCAL
#else
#define GLTFLOADER_API __declspec(dllimport)
#define GLTFLOADER_LOCAL
#endif
#else
#if __GNUC__ >= 4 || defined(__clang__)
#define GLTFLOADER_API __attribute__ ((visibility ("default")))
#define GLTFLOADER_LOCAL __attribute__ ((visibility ("hidden")))
#else
#define GLTFLOADER_API
#define GLTFLOADER_LOCAL
#endif
#endif
#endif