Skip to content

Commit

Permalink
Use the x64-windows-static-md triplet (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitlith committed Sep 4, 2022
1 parent 029a586 commit ef1645f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
os: [windows-latest] # Others are disabled, this only targets Windows
include:
- os: windows-latest
triplet: x64-windows
triplet: x64-windows-static-md
env:
# Indicates the CMake build directory where project files and binaries are being produced.
CMAKE_BUILD_DIR: ${{ github.workspace }}/build
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
run: ${{ env.VCPKG_ROOT }}/bootstrap-vcpkg.sh

- name: Configure CMake
run: cmake -S "${{github.workspace}}" -B "${{env.CMAKE_BUILD_DIR}}"
run: cmake -S "${{github.workspace}}" -B "${{env.CMAKE_BUILD_DIR}}" -DVCPKG_TARGET_TRIPLET=${{matrix.triplet}}

- name: Build
run: cmake --build "${{env.CMAKE_BUILD_DIR}}" --config Release --target ALL_BUILD -j 6 --
Expand Down
16 changes: 6 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
cmake_minimum_required(VERSION 3.0.0)

if (NOT DEFINED VCPKG_TARGET_TRIPLET)
if(WIN32)
set(VCPKG_TARGET_TRIPLET "x64-windows-static-md")
endif()
endif()

# If the toolchain is already defined, do not attempt to find it
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
# If the VCPKG_ROOT environment variable is not defined, try to automatically define it from AppData/home
Expand Down Expand Up @@ -97,13 +103,3 @@ add_custom_command(
$<TARGET_FILE:${PROJECT_NAME}>
$<TARGET_FILE_DIR:${PROJECT_NAME}>/driver/${DRIVER_NAME}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH}/driver_${DRIVER_NAME}$<TARGET_FILE_SUFFIX:${PROJECT_NAME}>
)

# Copy libprotobuf dll to output folder
# NOTE: This only works with Release/RelWithDebInfo, because Debug uses libprotobufd.dll
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE_DIR:${PROJECT_NAME}>/libprotobuf.dll
$<TARGET_FILE_DIR:${PROJECT_NAME}>/driver/${DRIVER_NAME}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH}/libprotobuf.dll
)

0 comments on commit ef1645f

Please sign in to comment.