@@ -131,30 +131,34 @@ else()
131131endif ()
132132
133133
134- # Add source to this project's executable.
134+ # Create the OpenSHC.exe target, should not require the game
135135add_executable (OpenSHC.exe WIN32 src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES} )
136136set_target_properties (OpenSHC.exe PROPERTIES OUTPUT_NAME ${OPEN_SHC_NAME} )
137137set_target_properties (OpenSHC.exe PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /EXE" )
138138target_compile_definitions (OpenSHC.exe PRIVATE OPEN_SHC_EXE )
139139target_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
142148file_add_depends ("${CRUSADER_DIR} /binkw32_real.dll" )
143149if (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" )
145151else ()
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" )
147153endif ()
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
159163add_library (OpenSHC.dll SHARED src/entry.cpp ${CORE_SOURCES} ${OPENSHC_SOURCES} )
160164set_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
173176add_custom_command (TARGET OpenSHC.dll.deploy POST_BUILD
0 commit comments