Skip to content

Commit 39fd8ba

Browse files
committed
always pull in new gwca version even in incremental builds
1 parent 2bd8b28 commit 39fd8ba

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

GWToolboxdll/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,23 @@ set_source_files_properties(
4444
"${CMAKE_CURRENT_SOURCE_DIR}/Utils/GwDat/AtexDecompress.cpp"
4545
PROPERTIES COMPILE_FLAGS "/W0")
4646

47+
# Re-embed the current Dependencies/GWCA/bin/gwca.dll on every build
48+
set(GWCA_EMBED_DLL "${CMAKE_SOURCE_DIR}/Dependencies/GWCA/bin/gwca.dll")
49+
set(GWCA_EMBED_STAMP "${CMAKE_CURRENT_BINARY_DIR}/gwca_embed_stamp.h")
50+
if(NOT EXISTS "${GWCA_EMBED_STAMP}")
51+
file(WRITE "${GWCA_EMBED_STAMP}" "#define GWCA_EMBED_HASH \"\"\n")
52+
endif()
53+
add_custom_target(gwca_embed_stamp ALL
54+
COMMAND "${CMAKE_COMMAND}"
55+
-D "GWCA_EMBED_DLL=${GWCA_EMBED_DLL}"
56+
-D "GWCA_EMBED_STAMP=${GWCA_EMBED_STAMP}"
57+
-P "${CMAKE_SOURCE_DIR}/cmake/embed_gwca_stamp.cmake"
58+
BYPRODUCTS "${GWCA_EMBED_STAMP}"
59+
COMMENT "Checking embedded gwca.dll is current"
60+
VERBATIM)
61+
add_dependencies(GWToolboxdll gwca_embed_stamp)
4762
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/GWToolbox.rc"
48-
PROPERTIES OBJECT_DEPENDS "${CMAKE_SOURCE_DIR}/Dependencies/GWCA/bin/gwca.dll")
63+
PROPERTIES OBJECT_DEPENDS "${GWCA_EMBED_DLL};${GWCA_EMBED_STAMP}")
4964

5065
# auto-generated files - export header & pch
5166
include(GenerateExportHeader)

GWToolboxdll/GWToolbox.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ END
9696
// RCDATA
9797
//
9898

99+
#include "gwca_embed_stamp.h"
100+
99101
IDR_GWCA_DLL RCDATA "..\\Dependencies\\GWCA\\bin\\gwca.dll"
100102
IDR_PORTAL_CONNECTIONS_JSON RCDATA "Windows\\Pathfinding\\portal_connections.json"
101103

cmake/embed_gwca_stamp.cmake

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
if(NOT EXISTS "${GWCA_EMBED_DLL}")
2+
message(FATAL_ERROR "gwca.dll not found for embedding: ${GWCA_EMBED_DLL}")
3+
endif()
4+
5+
file(SHA256 "${GWCA_EMBED_DLL}" _gwca_hash)
6+
set(_content "#define GWCA_EMBED_HASH \"${_gwca_hash}\"\n")
7+
8+
set(_old "")
9+
if(EXISTS "${GWCA_EMBED_STAMP}")
10+
file(READ "${GWCA_EMBED_STAMP}" _old)
11+
endif()
12+
13+
if(NOT _old STREQUAL _content)
14+
file(WRITE "${GWCA_EMBED_STAMP}" "${_content}")
15+
message(STATUS "Embedded gwca.dll refreshed (${_gwca_hash})")
16+
endif()

0 commit comments

Comments
 (0)