diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7eba93e..47f160c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,6 +8,11 @@ set(MAIN_FILE ${PLUMAGE_RENDER}/render.cpp ) +set(GLTF_MODEL_LOADER + "${PLUMAGE_RENDER}/glTFBoundingBox.h" + "${PLUMAGE_RENDER}/glTFBoundingBox.cpp" +) + # wayland requires additional source files IF(USE_WAYLAND_WSI) 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) add_executable(${RenderName} WIN32 ${SHADERS_GLSL} ${SHADERS_HLSL} ${MAIN_FILE} + ${GLTF_MODEL_LOADER} "render/glTFModel.h" "render/glTFModel.cpp" "render/renderFoundation.h" - "render/renderFoundation.cpp") + "render/renderFoundation.cpp" ) target_link_libraries(${RenderName} base ${Vulkan_LIBRARY} ${WINLIBS}) endif() set_target_properties(${RenderName} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) @@ -51,6 +57,12 @@ if(RESOURCE_INSTALL_DIR) 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() diff --git a/src/render/glTFModel_Common.h b/src/render/glTFModel_Common.h new file mode 100644 index 0000000..59a2554 --- /dev/null +++ b/src/render/glTFModel_Common.h @@ -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 \ No newline at end of file