Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,26 @@ jobs:
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

- name: 'Clean up'
working-directory: ${{ github.workspace }}
run: Remove-Item -Path out -Recurse -Force

- name: 'Configure CMake (Spectre)'
working-directory: ${{ github.workspace }}
run: cmake --preset=${{ matrix.build_type }} -DENABLE_SPECTRE_MITIGATION=ON

- name: 'Build (Spectre)'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

- name: 'Clean up'
working-directory: ${{ github.workspace }}
run: Remove-Item -Path out -Recurse -Force

- name: 'Configure CMake (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --preset=${{ matrix.build_type }} -DBUILD_SHARED_LIBS=ON

- name: 'Build (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,15 @@ jobs:
name: 'Test (Math only)'
working-directory: ${{ github.workspace }}
run: ctest --preset=${{ matrix.build_type }} -L Math

- name: 'Clean up'
working-directory: ${{ github.workspace }}
run: Remove-Item -Path out -Recurse -Force

- name: 'Configure CMake (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --preset=${{ matrix.build_type }} -DBUILD_TESTING=ON -DBUILD_TOOLS=OFF -DBUILD_SHARED_LIBS=ON

- name: 'Build (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}
18 changes: 18 additions & 0 deletions .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,48 @@ jobs:
os: [windows-2019, windows-2022]
build_type: [x64-Debug-VCPKG]
arch: [amd64]
shared: [OFF]
include:
- os: windows-2022
build_type: x64-Debug-Clang-VCPKG
arch: amd64
shared: OFF
- os: windows-2022
build_type: x86-Debug-VCPKG
arch: amd64_x86
shared: OFF
- os: windows-2022
build_type: x64-Debug-Redist
arch: amd64
shared: OFF
- os: windows-2022
build_type: x64-Release-Redist
arch: amd64
shared: OFF
- os: windows-2022
build_type: arm64-Debug-VCPKG
arch: amd64_arm64
shared: OFF
- os: windows-2022
build_type: arm64ec-Debug-VCPKG
arch: amd64_arm64
shared: OFF
- os: windows-2022
build_type: x64-Debug-MinGW
arch: amd64
shared: OFF
- os: windows-2022
build_type: x64-Release-MinGW
arch: amd64
shared: OFF
- os: windows-2022
build_type: x64-Debug-MinGW
arch: amd64
shared: ON
- os: windows-2022
build_type: x64-Release-MinGW
arch: amd64
shared: ON

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down Expand Up @@ -126,6 +143,7 @@ jobs:
working-directory: ${{ github.workspace }}
run: >
cmake --preset=${{ matrix.build_type }} -DBUILD_TESTING=OFF -DBUILD_XAUDIO_WIN10=OFF -DBUILD_XAUDIO_WIN8=OFF -DBUILD_XAUDIO_REDIST=ON
-DBUILD_SHARED_LIBS=${{ matrix.shared }}
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_DIR="${{ github.workspace }}/build"
-DVCPKG_TARGET_TRIPLET="${env:VCPKG_DEFAULT_TRIPLET}"

Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/win10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ jobs:
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

- name: 'Clean up'
working-directory: ${{ github.workspace }}
run: Remove-Item -Path out -Recurse -Force

- if: matrix.arch != 'amd64_arm64'
name: 'Configure CMake (Spectre)'
working-directory: ${{ github.workspace }}
Expand All @@ -106,3 +110,16 @@ jobs:
name: 'Build (Spectre)'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}

- if: matrix.arch != 'amd64_arm64'
name: 'Clean up'
working-directory: ${{ github.workspace }}
run: Remove-Item -Path out -Recurse -Force

- name: 'Configure CMake (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --preset=${{ matrix.build_type }} -DBUILD_SHARED_LIBS=ON

- name: 'Build (DLL)'
working-directory: ${{ github.workspace }}
run: cmake --build out\build\${{ matrix.build_type }}
15 changes: 13 additions & 2 deletions Audio/SoundCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@
#define DIRECTX_ENABLE_SEEK_TABLES
#endif

#ifndef DIRECTX_TOOLKIT_API
#ifdef DIRECTX_TOOLKIT_EXPORT
#define DIRECTX_TOOLKIT_API __declspec(dllexport)
#elif defined(DIRECTX_TOOLKIT_IMPORT)
#define DIRECTX_TOOLKIT_API __declspec(dllimport)
#else
#define DIRECTX_TOOLKIT_API
#endif
#endif


namespace DirectX
{
// Helper for getting a format tag from a WAVEFORMATEX
Expand Down Expand Up @@ -55,11 +66,11 @@ namespace DirectX


// Helper for validating wave format structure
bool __cdecl IsValid(_In_ const WAVEFORMATEX* wfx) noexcept;
DIRECTX_TOOLKIT_API bool __cdecl IsValid(_In_ const WAVEFORMATEX* wfx) noexcept;


// Helper for getting a default channel mask from channels
uint32_t __cdecl GetDefaultChannelMask(int channels) noexcept;
DIRECTX_TOOLKIT_API uint32_t __cdecl GetDefaultChannelMask(int channels) noexcept;


// Helpers for creating various wave format structures
Expand Down
37 changes: 36 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ project (DirectXTK
HOMEPAGE_URL "https://go.microsoft.com/fwlink/?LinkId=248929"
LANGUAGES CXX)

if(DEFINED XBOX_CONSOLE_TARGET)
set(CMAKE_CXX_STANDARD_LIBRARIES "")
endif()

option(BUILD_TOOLS "Build XWBTool" ON)

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

option(BUILD_XAUDIO_WIN10 "Build for XAudio 2.9" OFF)
option(BUILD_XAUDIO_WIN8 "Build for XAudio 2.8" ON)
option(BUILD_XAUDIO_REDIST "Build for XAudio2Redist" OFF)
Expand Down Expand Up @@ -245,7 +251,28 @@ if(NOT USE_PREBUILT_SHADERS)
USES_TERMINAL)
endif()

add_library(${PROJECT_NAME} STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
if(WIN32 AND BUILD_SHARED_LIBS)
message(STATUS "Build library as a DLL")

configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/build/DirectXTK.rc.in"
"${CMAKE_CURRENT_BINARY_DIR}/DirectXTK.rc" @ONLY)

add_library(${PROJECT_NAME} SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS} "${CMAKE_CURRENT_BINARY_DIR}/DirectXTK.rc")

target_compile_definitions(${PROJECT_NAME} PRIVATE DIRECTX_TOOLKIT_EXPORT)
target_compile_definitions(${PROJECT_NAME} INTERFACE DIRECTX_TOOLKIT_IMPORT)

if(XBOX_CONSOLE_TARGET MATCHES "durango")
target_link_libraries(${PROJECT_NAME} PRIVATE kernelx.lib combase.lib d3d12_x.lib xi.lib)
endif()

if(MINGW)
target_link_libraries(${PROJECT_NAME} PRIVATE xinput1_4.lib)
endif()
else()
add_library(${PROJECT_NAME} ${LIBRARY_SOURCES} ${LIBRARY_HEADERS})
endif()

target_include_directories(${PROJECT_NAME} PRIVATE ${COMPILED_SHADERS} Src)

Expand Down Expand Up @@ -431,10 +458,18 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|IntelLLVM")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
target_compile_options(${t} PRIVATE "-Wno-ignored-attributes" "-Walloc-size-larger-than=4GB")

if(BUILD_SHARED_LIBS)
target_compile_options(${t} PRIVATE "-Wno-attributes")
endif()
endforeach()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(BUILD_SHARED_LIBS)
target_compile_options(${PROJECT_NAME} PRIVATE "/wd4251" "/wd4275")
endif()

if(ENABLE_CODE_ANALYSIS)
message(STATUS "Building with Code Analysis (PREFIX)")
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
Expand Down
Loading
Loading