include(ExternalProject) set(EXTERNAL_NAME steamworks) string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) set(STEAMWORKS_URL "${EXTERNAL_BUILD_ASSETS}/dependencies/steamworks_sdk_158a.zip") set(STEAMWORKS_URL_SHA512 "fe906a7510a2125ab1441ad349e8bc31fafc9ab8130ec3843287e615a850305a8ed303e8d9e5bae4fee06024987834fb9f64c6c10d3da3784267a4906e59c831") # Ninja needs to know all the files that result from this upfront, so we need to tell it what files this is going # to generate with BUILD_BYPRODUCTS. We need to include all the files that are going to be referenced from elsewhere # in the build. # # This should include both libraries and headers, since from the point of view of the build, those are the outputs # of the project, even though we're not actually building anything here, and just unzipping an existing binary. # # I believe this list can't be obtained automatically from the compressed file, and needs to be generated by hand. # Steam SDK .zip has a sdk/ subdirectory, but for ExternalProject, this gets turned into project/src/steamworks. # So inside the SDK, sdk/redistributable_bin/steam_api.dll becomes project/src/steamworks/redistributable_bin/steam_api.dll # This can be seen under $BUILD_DIR/ext. ExternalProject_Add( ${EXTERNAL_NAME} URL ${STEAMWORKS_URL} URL_HASH SHA512=${STEAMWORKS_URL_SHA512} CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "" LOG_DOWNLOAD 1 DOWNLOAD_EXTRACT_TIMESTAMP 1 BUILD_BYPRODUCTS "project/src/steamworks/redistributable_bin/win64/steam_api64.lib" "project/src/steamworks/redistributable_bin/win64/steam_api64.dll" "project/src/steamworks/redistributable_bin/osx/steam_api.dylib" "project/src/steamworks/redistributable_bin/linux64/libsteam_api.so" "project/src/steamworks/redistributable_bin/linux32/libsteam_api.so" "project/src/steamworks/redistributable_bin/steam_api.lib" "project/src/steamworks/redistributable_bin/steam_api.dll" "project/src/steamworks/public/steam/isteamapplist.h" "project/src/steamworks/public/steam/isteamapps.h" "project/src/steamworks/public/steam/isteamappticket.h" "project/src/steamworks/public/steam/isteamclient.h" "project/src/steamworks/public/steam/isteamcontroller.h" "project/src/steamworks/public/steam/isteamdualsense.h" "project/src/steamworks/public/steam/isteamfriends.h" "project/src/steamworks/public/steam/isteamgamecoordinator.h" "project/src/steamworks/public/steam/isteamgameserver.h" "project/src/steamworks/public/steam/isteamgameserverstats.h" "project/src/steamworks/public/steam/isteamhtmlsurface.h" "project/src/steamworks/public/steam/isteamhttp.h" "project/src/steamworks/public/steam/isteaminput.h" "project/src/steamworks/public/steam/isteaminventory.h" "project/src/steamworks/public/steam/isteammatchmaking.h" "project/src/steamworks/public/steam/isteammusic.h" "project/src/steamworks/public/steam/isteammusicremote.h" "project/src/steamworks/public/steam/isteamnetworking.h" "project/src/steamworks/public/steam/isteamnetworkingmessages.h" "project/src/steamworks/public/steam/isteamnetworkingsockets.h" "project/src/steamworks/public/steam/isteamnetworkingutils.h" "project/src/steamworks/public/steam/isteamparentalsettings.h" "project/src/steamworks/public/steam/isteamps3overlayrenderer.h" "project/src/steamworks/public/steam/isteamremoteplay.h" "project/src/steamworks/public/steam/isteamremotestorage.h" "project/src/steamworks/public/steam/isteamscreenshots.h" "project/src/steamworks/public/steam/isteamugc.h" "project/src/steamworks/public/steam/isteamuser.h" "project/src/steamworks/public/steam/isteamuserstats.h" "project/src/steamworks/public/steam/isteamutils.h" "project/src/steamworks/public/steam/isteamvideo.h" "project/src/steamworks/public/steam/matchmakingtypes.h" "project/src/steamworks/public/steam/steam_api_common.h" "project/src/steamworks/public/steam/steam_api_flat.h" "project/src/steamworks/public/steam/steam_api.h" "project/src/steamworks/public/steam/steam_api_internal.h" "project/src/steamworks/public/steam/steamclientpublic.h" "project/src/steamworks/public/steam/steamencryptedappticket.h" "project/src/steamworks/public/steam/steam_gameserver.h" "project/src/steamworks/public/steam/steamhttpenums.h" "project/src/steamworks/public/steam/steamnetworkingfakeip.h" "project/src/steamworks/public/steam/steamnetworkingtypes.h" "project/src/steamworks/public/steam/steamps3params.h" "project/src/steamworks/public/steam/steamtypes.h" "project/src/steamworks/public/steam/steamuniverse.h" ) set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals") ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/public CACHE STRING INTERNAL) if (WIN32) if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") set(ARCH_DIR ${SOURCE_DIR}/redistributable_bin/win64) set(ARCH_SUFFIX "64") else() set(ARCH_DIR ${SOURCE_DIR}/redistributable_bin) set(ARCH_SUFFIX "") endif() set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${ARCH_DIR}) set(${EXTERNAL_NAME_UPPER}_LIB_PATH ${ARCH_DIR}) set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/steam_api${ARCH_SUFFIX}.lib" CACHE STRING INTERNAL) add_paths_to_fixup_libs("${${EXTERNAL_NAME_UPPER}_DLL_PATH}") elseif(APPLE) set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/osx32/libsteam_api.dylib CACHE STRING INTERNAL) set(_STEAMWORKS_LIB_DIR "${SOURCE_DIR}/redistributable_bin/osx32") ExternalProject_Add_Step( ${EXTERNAL_NAME} change-install-name COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking" COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${_STEAMWORKS_LIB_DIR} -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake DEPENDEES install WORKING_DIRECTORY LOG 1 ) elseif(NOT ANDROID AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") # FIXME need to account for different architectures set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/linux64/libsteam_api.so CACHE STRING INTERNAL) endif()