mirror of
https://github.com/lubosz/overte.git
synced 2025-04-05 22:42:33 +02:00
Make steamworks an external dependency
This commit is contained in:
parent
fc7b271e50
commit
1a8d6ea614
3 changed files with 71 additions and 24 deletions
62
cmake/externals/steamworks/CMakeLists.txt
vendored
Normal file
62
cmake/externals/steamworks/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
include(ExternalProject)
|
||||
|
||||
set(EXTERNAL_NAME steamworks)
|
||||
|
||||
string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER)
|
||||
|
||||
set(STEAMWORKS_URL "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Steamworks.zip")
|
||||
set(STEAMWORKS_URL_MD5 "95ba9d0e3ddc04f8a8be17d2da806cbb")
|
||||
|
||||
ExternalProject_Add(
|
||||
${EXTERNAL_NAME}
|
||||
URL ${STEAMWORKS_URL}
|
||||
URL_MD5 ${STEAMWORKS_URL_MD5}
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD 1
|
||||
)
|
||||
|
||||
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 TYPE 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 TYPE 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 TYPE 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 <SOURCE_DIR>
|
||||
LOG 1
|
||||
)
|
||||
|
||||
elseif(NOT ANDROID)
|
||||
|
||||
# FIXME need to account for different architectures
|
||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/linux64/libsteam_api.so CACHE TYPE INTERNAL)
|
||||
|
||||
endif()
|
|
@ -6,6 +6,7 @@
|
|||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
macro(TARGET_STEAMWORKS)
|
||||
add_dependency_external_projects(steamworks)
|
||||
find_package(Steamworks REQUIRED)
|
||||
target_include_directories(${TARGET_NAME} PRIVATE ${STEAMWORKS_INCLUDE_DIRS})
|
||||
target_link_libraries(${TARGET_NAME} ${STEAMWORKS_LIBRARIES})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
#
|
||||
# FindSteamworks.cmake
|
||||
#
|
||||
#
|
||||
# Try to find the Steamworks controller library
|
||||
#
|
||||
# This module defines the following variables
|
||||
|
@ -20,26 +20,10 @@
|
|||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
|
||||
set(STEAMWORKS_POSSIBLE_PATHS "/Users/clement/Downloads/steamworks_sdk_137/")
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(STEAMWORKS)
|
||||
|
||||
find_path(STEAMWORKS_INCLUDE_DIRS
|
||||
NAMES steam_api.h
|
||||
PATH_SUFFIXES "public/steam"
|
||||
PATHS ${STEAMWORKS_POSSIBLE_PATHS}
|
||||
)
|
||||
|
||||
get_filename_component(STEAMWORKS_INCLUDE_DIR_NAME ${STEAMWORKS_INCLUDE_DIRS} NAME)
|
||||
if (STEAMWORKS_INCLUDE_DIR_NAME STREQUAL "steam")
|
||||
get_filename_component(STEAMWORKS_INCLUDE_DIRS ${STEAMWORKS_INCLUDE_DIRS} PATH)
|
||||
else()
|
||||
message(STATUS "Include directory not named steam, this will cause issues with include statements")
|
||||
endif()
|
||||
|
||||
find_library(STEAMWORKS_LIBRARIES
|
||||
NAMES libsteam_api.dylib
|
||||
PATH_SUFFIXES "redistributable_bin/osx32"
|
||||
PATHS ${STEAMWORKS_POSSIBLE_PATHS}
|
||||
)
|
||||
|
||||
|
||||
find_package_handle_standard_args(Steamworks DEFAULT_MSG STEAMWORKS_LIBRARIES STEAMWORKS_INCLUDE_DIRS)
|
||||
set(STEAMWORKS_REQUIREMENTS STEAMWORKS_INCLUDE_DIRS STEAMWORKS_LIBRARIES)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Steamworks DEFAULT_MSG STEAMWORKS_INCLUDE_DIRS STEAMWORKS_LIBRARIES)
|
||||
mark_as_advanced(STEAMWORKS_LIBRARIES STEAMWORKS_INCLUDE_DIRS STEAMWORKS_SEARCH_DIRS)
|
||||
|
|
Loading…
Reference in a new issue