Skip to content

Commit dcea118

Browse files
committed
Add option to build DXTex as shared lib to cmake
1 parent 9303898 commit dcea118

File tree

2 files changed

+148
-134
lines changed

2 files changed

+148
-134
lines changed

CMakeLists.txt

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ project (DirectXTex
1717

1818
option(BUILD_TOOLS "Build tex command-line tools" ON)
1919

20+
option(BUILD_SHARED_LIBS "Build DirectXTex as a shared library" OFF)
21+
2022
option(BUILD_SAMPLE "Build DDSView sample (requires fxc.exe)" ON)
2123

2224
# Includes the functions for Direct3D 11 resources and DirectCompute compression
@@ -220,7 +222,12 @@ if(BUILD_DX11 AND WIN32 AND (NOT (XBOX_CONSOLE_TARGET STREQUAL "durango")))
220222
endif()
221223
endif()
222224

223-
add_library(${PROJECT_NAME} STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
225+
add_library(${PROJECT_NAME} ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
226+
227+
if(WIN32 AND BUILD_SHARED_LIBS)
228+
target_compile_definitions(${PROJECT_NAME} PRIVATE DXTEX_EXPORT)
229+
target_compile_definitions(${PROJECT_NAME} INTERFACE DXTEX_IMPORT)
230+
endif()
224231

225232
if(BUILD_DX11 AND WIN32)
226233
target_include_directories(${PROJECT_NAME} PRIVATE ${COMPILED_SHADERS})

0 commit comments

Comments
 (0)