Skip to content

Commit 3fa6896

Browse files
TheRedDaemonsourcehold
authored andcommitted
[PROJECT] split copy of SHC sources for exe to extra target
1 parent 78be7dd commit 3fa6896

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"editor.rulers": [
88
120
99
],
10+
//"cmake.automaticReconfigure": false,
11+
//"cmake.configureOnEdit": false,
1012
"files.associations": {
1113
"*.inl": "cpp",
1214
"iostream": "cpp",

CMakeLists.txt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,30 +131,34 @@ else()
131131
endif()
132132

133133

134-
# Add source to this project's executable.
134+
# Create the OpenSHC.exe target, should not require the game
135135
add_executable(OpenSHC.exe WIN32 src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES})
136136
set_target_properties(OpenSHC.exe PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
137137
set_target_properties(OpenSHC.exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/EXE")
138138
target_compile_definitions(OpenSHC.exe PRIVATE OPEN_SHC_EXE)
139139
target_precompile_headers(OpenSHC.exe PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FILE}>)
140140

141+
142+
143+
# Create custom target that pulls in the required dependencies to run the exe
144+
# NOTE: There seems to be an issue with our naming here, causing the depends to look for "OpenSHC.exe.exe" instead
145+
add_custom_target(OpenSHC.exe.runnable DEPENDS OpenSHC.exe.exe)
146+
141147
# Checks if a binkw32_real is present and uses this instead
142148
file_add_depends("${CRUSADER_DIR}/binkw32_real.dll")
143149
if(EXISTS "${CRUSADER_DIR}/binkw32_real.dll")
144-
target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/binkw32_real.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/binkw32.dll")
150+
target_file_copy_if_different(OpenSHC.exe.runnable "${CRUSADER_DIR}/binkw32_real.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/binkw32.dll")
145151
else()
146-
target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/binkw32.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/binkw32.dll")
152+
target_file_copy_if_different(OpenSHC.exe.runnable "${CRUSADER_DIR}/binkw32.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/binkw32.dll")
147153
endif()
148-
target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/Mss32.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/Mss32.dll")
154+
target_file_copy_if_different(OpenSHC.exe.runnable "${CRUSADER_DIR}/Mss32.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/Mss32.dll")
149155

150156
# shfolder is a normal windows lib, however, the game needs to work with the games version, so we still copy it
151157
# it should be checked later if the compiler emits a shfolder.dll on its own or if it statically links, which we do not want
152-
target_file_copy_if_different(OpenSHC.exe "${CRUSADER_DIR}/shfolder.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/shfolder.dll")
158+
target_file_copy_if_different(OpenSHC.exe.runnable "${CRUSADER_DIR}/shfolder.dll" "$<TARGET_FILE_DIR:OpenSHC.exe>/shfolder.dll")
153159

154160

155161

156-
# Place the dll and its pdb in the OpenSHC module folder for live testing
157-
set(OPEN_SHC_DLL_DEST "${CRUSADER_DIR}/ucp/modules/${OPEN_SHC_NAME}-${OPEN_SHC_VERSION}")
158162

159163
add_library(OpenSHC.dll SHARED src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES})
160164
set_target_properties(OpenSHC.dll PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME})
@@ -164,10 +168,9 @@ target_precompile_headers(OpenSHC.dll PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${PCH_FI
164168

165169

166170

167-
add_custom_target(
168-
OpenSHC.dll.deploy
169-
DEPENDS OpenSHC.dll
170-
)
171+
# Create custom target that deploys the DLL and the required UCP files to the modules folder
172+
add_custom_target(OpenSHC.dll.deploy DEPENDS OpenSHC.dll)
173+
set(OPEN_SHC_DLL_DEST "${CRUSADER_DIR}/ucp/modules/${OPEN_SHC_NAME}-${OPEN_SHC_VERSION}")
171174

172175
# Ensure the module folder exists
173176
add_custom_command(TARGET OpenSHC.dll.deploy POST_BUILD

0 commit comments

Comments
 (0)