@ -1,33 +1,28 @@
project ( package_windows )
project ( package_windows )
if( WIN32 )
option( BUILD_DFLAUNCH "Whether to build the Steam launcher exectuable (requires Steam SDK)." OFF )
if ( BUILD_DFLAUNCH )
if ( ( DEFINED ENV{steam_username} ) AND ( DEFINED ENV{steam_password} ) )
if ( WIN32 AND BUILD_DFLAUNCH )
# d o w n l o a d S t e a m S D K
# b u i l d e r m u s t m a n u a l l y d o w n l o a d S t e a m S D K
set ( STEAMAPI_DIR ${ dfhack_SOURCE_DIR } /depends/steam )
set ( STEAMAPI_DIR ${ dfhack_SOURCE_DIR } /depends/steam )
file ( DOWNLOAD "https://partner.steamgames.com/downloads/steamworks_sdk_156.zip"
set ( STEAMAPI_VER 156 )
$ { S T E A M A P I _ D I R } / s t e a m w o r k s _ s d k _ 1 5 6 . z i p
set ( STEAMAPI_ZIP_EXPECTED_HASH af5a579990dbe5ae4c1b0689260d001b )
E X P E C T E D _ H A S H M D 5 = a f 5 a 5 7 9 9 9 0 d b e 5 a e 4 c 1 b 0 6 8 9 2 6 0 d 0 0 1 b
set ( STEAMSDK_ZIP ${ STEAMAPI_DIR } /steamworks_sdk_ ${ STEAMAPI_VER } .zip )
U S E R P W D $ E N V { s t e a m _ u s e r n a m e } : $ E N V { s t e a m _ p a s s w o r d }
S T A T U S S T E A M _ S D K _ D O W N L O A D _ S T A T U S
set ( STEAM_SDK_HASH "NOT FOUND" )
S H O W _ P R O G R E S S
file ( MD5 ${ STEAMSDK_ZIP } STEAM_SDK_HASH )
)
if ( NOT ( ${ STEAM_SDK_HASH } STREQUAL ${ STEAMAPI_ZIP_EXPECTED_HASH } ) )
list ( GET STEAM_SDK_DOWNLOAD_STATUS 0 STEAM_SDK_DL_STATUS_CODE )
message ( FATAL_ERROR "You need the Steamworks SDK at ${STEAMSDK_ZIP} to build launchdf.exe. Please disable the BUILD_DFLAUNCH CMake option or download the Steam SDK from: https://partner.steamgames.com/downloads/steamworks_sdk_${STEAMAPI_VER}.zip" )
list ( GET STEAM_SDK_DOWNLOAD_STATUS 1 STEAM_SDK_DL_ERROR_MESSAGE )
endif ( )
if ( NOT ( ${ STEAM_SDK_DL_STATUS_CODE } EQUAL 0 ) )
if ( ${ STEAMSDK_ZIP } IS_NEWER_THAN ${ STEAMAPI_DIR } /sdk )
message ( FATAL_ERROR "Steam SDK download: " ${ STEAM_SDK_DL_ERROR_MESSAGE } )
else ( )
message ( STATUS "Steam SDK download: " ${ STEAM_SDK_DL_ERROR_MESSAGE } )
file ( ARCHIVE_EXTRACT
file ( ARCHIVE_EXTRACT
I N P U T $ { S T E A M AP I _ D I R } / s t e a m w o r k s _ s d k _ 1 5 6 . z i p
I N P U T $ { S T E A M S D K _ Z I P }
D E S T I N A T I O N $ { S T E A M A P I _ D I R } )
D E S T I N A T I O N $ { S T E A M A P I _ D I R } )
endif ( )
set ( STEAMAPI_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.lib" )
set ( STEAMAPI_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.lib" )
set ( STEAMAPI_SOURCE_DIR "${STEAMAPI_DIR}/sdk/public/steam" )
set ( STEAMAPI_SOURCE_DIR "${STEAMAPI_DIR}/sdk/public/steam" )
set ( STEAMAPI_SHARED_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.dll" )
set ( STEAMAPI_SHARED_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.dll" )
endif ( )
else ( )
message ( SEND_ERROR "Need to set steam_username and steam_password in environment to download Steamworks SDK" )
endif ( )
include_directories ( ${ STEAMAPI_SOURCE_DIR } )
include_directories ( ${ STEAMAPI_SOURCE_DIR } )
link_libraries ( ${ STEAMAPI_LIBRARY } )
link_libraries ( ${ STEAMAPI_LIBRARY } )
@ -35,4 +30,3 @@ if(WIN32)
install ( TARGETS launchdf DESTINATION ${ DFHACK_DATA_DESTINATION } )
install ( TARGETS launchdf DESTINATION ${ DFHACK_DATA_DESTINATION } )
install ( FILES ${ STEAMAPI_SHARED_LIBRARY } DESTINATION ${ DFHACK_DATA_DESTINATION } )
install ( FILES ${ STEAMAPI_SHARED_LIBRARY } DESTINATION ${ DFHACK_DATA_DESTINATION } )
endif ( )
endif ( )
endif ( )