File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
4762set_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
5166include (GenerateExportHeader )
Original file line number Diff line number Diff line change 9696// RCDATA
9797//
9898
99+ #include "gwca_embed_stamp.h"
100+
99101IDR_GWCA_DLL RCDATA "..\\Dependencies\\GWCA\\bin\\gwca.dll"
100102IDR_PORTAL_CONNECTIONS_JSON RCDATA "Windows\\Pathfinding\\portal_connections.json"
101103
Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments