Skip to content

Commit

Permalink
Add option to build DXTex as shared lib to cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarques1995 committed Jan 29, 2025
1 parent 9303898 commit ce8b2c0
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 128 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ project (DirectXTex

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

option(BUILD_SHARED_LIBS "Build DirectXTex as a shared library" OFF)

option(BUILD_SAMPLE "Build DDSView sample (requires fxc.exe)" ON)

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

add_library(${PROJECT_NAME} STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
add_library(${PROJECT_NAME} ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})

if(WIN32 AND BUILD_SHARED_LIBS)
target_compile_definitions(${PROJECT_NAME} PRIVATE DXTEX_EXPORT)
target_compile_definitions(${PROJECT_NAME} INTERFACE DXTEX_IMPORT)
endif()

if(BUILD_DX11 AND WIN32)
target_include_directories(${PROJECT_NAME} PRIVATE ${COMPILED_SHADERS})
Expand Down
Loading

0 comments on commit ce8b2c0

Please sign in to comment.