Skip to content

Commit

Permalink
Merge pull request #61 from zao/ci/update
Browse files Browse the repository at this point in the history
ci: update all actions to current, update vcpkg
chore: update vcpkg to master (2024-07-11)
fix: omit debug DLLs for release-only triplet
  • Loading branch information
zao authored Jul 16, 2024
2 parents 2b943bc + 8ff5c3e commit cac08f0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 42 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,59 @@ jobs:
triplet: x64-windows
runs-on: ${{ matrix.os }}
env:
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}-release
VCPKG_TARGET_TRIPLET: ${{ matrix.triplet }}-release
VCPKG_INSTALLED_DIR: ${{ github.workspace }}/vcpkg_installed/
DEPS_DIR: ${{ github.workspace }}/vcpkg_installed/${{ matrix.triplet }}
INST_DIR: ${{ github.workspace }}/install-prefix
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: run-vcpkg
uses: lukka/run-vcpkg@v10
uses: lukka/run-vcpkg@v11
with:
vcpkgJsonGlob: "./vcpkg.json"
runVcpkgInstall: true

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1
uses: microsoft/setup-msbuild@v2

- name: Obtain and run CMake
uses: threeal/cmake-action@v1.3.0
with:
source-dir: "."
build-dir: "build"
generator: "Visual Studio 17 2022"
options: CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake CMAKE_INSTALL_PREFIX="${{ env.INST_DIR }}"
options: CMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake CMAKE_INSTALL_PREFIX="${{ env.INST_DIR }}" VCPKG_TARGET_TRIPLET="${{ env.VCPKG_TARGET_TRIPLET }}"

- name: Build DLL
run: "cmake --build build --config Release -t INSTALL"

- name: Archive DLL
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SimpleGraphic-${{ matrix.triplet }}.dll
path: "${{ env.INST_DIR }}/SimpleGraphic.dll"

- name: Archive DLL symbols
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SimpleGraphic-${{ matrix.triplet }}.pdb
path: "${{ github.workspace }}/build/Release/SimpleGraphic.pdb"

- name: Archive dependency DLLs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SimpleGraphic-${{ matrix.triplet }}-deps.dll
path: |
${{ env.INST_DIR }}/*.dll
!${{ env.INST_DIR }}/SimpleGraphic.dll
- name: Archive dependency DLL symbols
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SimpleGraphic-${{ matrix.triplet }}-deps.pdb
path: |
Expand Down
64 changes: 33 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
endif ()

if (WIN32)
target_compile_options(SimpleGraphic
PRIVATE
"/EHa"
)
target_compile_definitions(SimpleGraphic
PRIVATE
"_CRT_SECURE_NO_DEPRECATE=1"
"_CRT_SECURE_NO_WARNINGS=1"
"_SCL_SECURE_NO_DEPRECATE=1"
"_SCL_SECURE_NO_WARNINGS=1"
)
target_link_libraries(SimpleGraphic
PRIVATE
"winmm.lib"
Expand Down Expand Up @@ -198,39 +209,30 @@ install(TARGETS SimpleGraphic RUNTIME DESTINATION ".")
if (WIN32)
set(DEPS_DIR "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}")

find_file(LuaJIT_DLL_DEBUG
NAMES "lua51.dll"
PATHS "${DEPS_DIR}"
PATH_SUFFIXES "debug/bin"
REQUIRED
NO_DEFAULT_PATH
)
find_file(LuaJIT_DLL_RELEASE
NAMES "lua51.dll"
PATHS "${DEPS_DIR}"
PATH_SUFFIXES "bin"
REQUIRED
NO_DEFAULT_PATH
)
find_file(ZLIB_DLL_DEBUG
NAMES "zlibd1.dll"
PATHS "${DEPS_DIR}"
PATH_SUFFIXES "debug/bin"
REQUIRED
NO_DEFAULT_PATH
)
find_file(ZLIB_DLL_RELEASE
NAMES "zlib1.dll"
PATHS "${DEPS_DIR}"
PATH_SUFFIXES "bin"
REQUIRED
NO_DEFAULT_PATH
if (NOT VCPKG_TARGET_TRIPLET MATCHES "-release")
find_file(LuaJIT_DLL_DEBUG NAMES "lua51.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "debug/bin" REQUIRED NO_DEFAULT_PATH)
find_file(ZLIB_DLL_DEBUG NAMES "zlibd1.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "debug/bin" REQUIRED NO_DEFAULT_PATH)

install(FILES
${LuaJIT_DLL_DEBUG}
${ZLIB_DLL_DEBUG}
DESTINATION "."
CONFIGURATIONS Debug
)
endif ()

find_file(LuaJIT_DLL_RELEASE NAMES "lua51.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "bin" REQUIRED NO_DEFAULT_PATH)
find_file(ZLIB_DLL_RELEASE NAMES "zlib1.dll"
PATHS "${DEPS_DIR}" PATH_SUFFIXES "bin" REQUIRED NO_DEFAULT_PATH
)

install(FILES ${LuaJIT_DLL_DEBUG} ${ZLIB_DLL_DEBUG} DESTINATION "."
CONFIGURATIONS Debug
)
install(FILES ${LuaJIT_DLL_RELEASE} ${ZLIB_DLL_RELEASE} DESTINATION "."
install(FILES
${LuaJIT_DLL_RELEASE}
${ZLIB_DLL_RELEASE}
DESTINATION "."
CONFIGURATIONS Release MinSizeRel RelWithDebInfo
)
endif ()
Expand Down
2 changes: 1 addition & 1 deletion vcpkg
Submodule vcpkg updated 3942 files
2 changes: 1 addition & 1 deletion vcpkg-configuration.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"default-registry": {
"kind": "builtin",
"baseline": "836a2d684dac6b543563e53ab30a1a5b8afaf97b"
"baseline": "3d72d8c930e1b6a1b2432b262c61af7d3287dcd0"
},
"registries": [
{
Expand Down

0 comments on commit cac08f0

Please sign in to comment.