File tree Expand file tree Collapse file tree 7 files changed +181
-71
lines changed
Expand file tree Collapse file tree 7 files changed +181
-71
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,10 @@ jobs:
102102 working-directory : ${{ github.workspace }}
103103 run : cmake --build out\build\${{ matrix.build_type }}
104104
105+ - name : ' Clean up'
106+ working-directory : ${{ github.workspace }}
107+ run : Remove-Item -Path out -Recurse -Force
108+
105109 - if : matrix.arch != 'amd64_arm64'
106110 name : ' Configure CMake (Spectre)'
107111 working-directory : ${{ github.workspace }}
@@ -111,3 +115,16 @@ jobs:
111115 name : ' Build (Spectre)'
112116 working-directory : ${{ github.workspace }}
113117 run : cmake --build out\build\${{ matrix.build_type }}
118+
119+ - if : matrix.arch != 'amd64_arm64'
120+ name : ' Clean up'
121+ working-directory : ${{ github.workspace }}
122+ run : Remove-Item -Path out -Recurse -Force
123+
124+ - name : ' Configure CMake (DLL)'
125+ working-directory : ${{ github.workspace }}
126+ run : cmake --preset=${{ matrix.build_type }} -DBUILD_SHARED_LIBS=ON
127+
128+ - name : ' Build (DLL)'
129+ working-directory : ${{ github.workspace }}
130+ run : cmake --build out\build\${{ matrix.build_type }}
Original file line number Diff line number Diff line change @@ -100,3 +100,15 @@ jobs:
100100 - name : ' Build'
101101 working-directory : ${{ github.workspace }}
102102 run : cmake --build out\build\${{ matrix.build_type }}
103+
104+ - name : ' Clean up'
105+ working-directory : ${{ github.workspace }}
106+ run : Remove-Item -Path out -Recurse -Force
107+
108+ - name : ' Configure CMake (DLL)'
109+ working-directory : ${{ github.workspace }}
110+ run : cmake --preset=${{ matrix.build_type }} -DBUILD_TESTING=ON -DBUILD_TOOLS=OFF -DBUILD_SHARED_LIBS=ON1
111+
112+ - name : ' Build (DLL)'
113+ working-directory : ${{ github.workspace }}
114+ run : cmake --build out\build\${{ matrix.build_type }}
Original file line number Diff line number Diff line change 7373 - name : ' Build'
7474 working-directory : ${{ github.workspace }}
7575 run : cmake --build out/build/${{ matrix.build_type }}
76+
77+ - name : ' Clean up'
78+ working-directory : ${{ github.workspace }}
79+ run : rm -rf out
80+
81+ - name : ' Configure CMake (-shared)'
82+ working-directory : ${{ github.workspace }}
83+ run : >
84+ cmake --preset=${{ matrix.build_type }}
85+ -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_MANIFEST_DIR="${{ github.workspace }}/build"
86+ -DVCPKG_TARGET_TRIPLET="x64-linux" -DBUILD_SHARED_LIBS=ON
87+
88+ env :
89+ CC : gcc-${{ matrix.gcc }}
90+ CXX : g++-${{ matrix.gcc }}
91+
92+ - name : ' Build (-shared)'
93+ working-directory : ${{ github.workspace }}
94+ run : cmake --build out/build/${{ matrix.build_type }}
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ project(DirectXMesh
1717
1818option (BUILD_TOOLS "Build meshconvert" ON )
1919
20+ option (BUILD_SHARED_LIBS "Build DirectXMesh as a shared library" OFF )
21+
2022# Includes the support for DirectX 12 input layouts
2123option (BUILD_DX12 "Build with DirectX12 Runtime support" ON )
2224
@@ -70,7 +72,20 @@ set(LIBRARY_SOURCES
7072 DirectXMesh/DirectXMeshVBWriter.cpp
7173 DirectXMesh/DirectXMeshWeldVertices.cpp)
7274
73- add_library (${PROJECT_NAME} STATIC ${LIBRARY_SOURCES} ${LIBRARY_HEADERS} )
75+ if (WIN32 AND BUILD_SHARED_LIBS )
76+ message (STATUS "Build library as a DLL" )
77+
78+ configure_file (
79+ "${CMAKE_CURRENT_SOURCE_DIR} /build/DirectXMesh.rc.in"
80+ "${CMAKE_CURRENT_BINARY_DIR} /DirectXMesh.rc" @ONLY)
81+
82+ add_library (${PROJECT_NAME} SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS} "${CMAKE_CURRENT_BINARY_DIR} /DirectXMesh.rc" )
83+
84+ target_compile_definitions (${PROJECT_NAME} PRIVATE DIRECTX_MESH_EXPORT)
85+ target_compile_definitions (${PROJECT_NAME} INTERFACE DIRECTX_MESH_IMPORT)
86+ else ()
87+ add_library (${PROJECT_NAME} ${LIBRARY_SOURCES} ${LIBRARY_HEADERS} )
88+ endif ()
7489
7590source_group (${PROJECT_NAME} REGULAR_EXPRESSION DirectXMesh/*.*)
7691
You can’t perform that action at this time.
0 commit comments