Skip to content

Commit

Permalink
internal: get ga-sdk to work (skyrim-multiplayer#2157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pospelove authored Sep 9, 2024
1 parent 64c14cb commit fc351a6
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
7 changes: 6 additions & 1 deletion overlay_ports/ga-sdk-cpp/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ vcpkg_from_github(
PATCHES void.patch
)

# copy cmakrlists.txt
# copy cmakelists.txt
file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")

# add missing includes
Expand All @@ -17,8 +17,13 @@ file(WRITE "${SOURCE_PATH}/source/gameanalytics/GADevice.cpp" "#include <tchar.h
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_cmake_install()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/unofficial-ga-sdk-cpp-config.cmake
DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}"
)
37 changes: 37 additions & 0 deletions overlay_ports/ga-sdk-cpp/unofficial-ga-sdk-cpp-config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
include(CMakeFindDependencyMacro)

if(NOT TARGET unofficial::ga-sdk-cpp::ga-sdk-cpp)
add_library(unofficial::ga-sdk-cpp::ga-sdk-cpp UNKNOWN IMPORTED)

find_path(ga-sdk-cpp_INCLUDE_DIR NAMES GameAnalytics.h)

set_target_properties(unofficial::ga-sdk-cpp::ga-sdk-cpp PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${ga-sdk-cpp_INCLUDE_DIR}"
)

find_library(ga-sdk-cpp_LIBRARY_RELEASE NAMES ga-sdk-cpp PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" NO_DEFAULT_PATH REQUIRED)
find_library(ga-sdk-cpp_LIBRARY_DEBUG NAMES ga-sdk-cpp PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib" NO_DEFAULT_PATH REQUIRED)

set_target_properties(unofficial::ga-sdk-cpp::ga-sdk-cpp PROPERTIES
IMPORTED_LOCATION_DEBUG "${ga-sdk-cpp_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${ga-sdk-cpp_LIBRARY_RELEASE}"
IMPORTED_CONFIGURATIONS "Release;Debug"
)

find_dependency(CURL REQUIRED)
find_dependency(OpenSSL REQUIRED)
find_dependency(RapidJSON REQUIRED)
find_dependency(SQLite3 REQUIRED)
find_dependency(miniz REQUIRED)
find_dependency(zf-log REQUIRED)

target_link_libraries(unofficial::ga-sdk-cpp::ga-sdk-cpp INTERFACE
CURL::libcurl
OpenSSL::SSL
OpenSSL::Crypto
rapidjson
SQLite::SQLite3
miniz::miniz
zf_log
)
endif()
1 change: 1 addition & 0 deletions overlay_ports/ga-sdk-cpp/vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"rapidjson",
"sqlite3",
"zf-log",
"miniz",
{
"name": "vcpkg-cmake",
"host": true
Expand Down
27 changes: 26 additions & 1 deletion overlay_ports/zf-log/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,30 @@ vcpkg_from_github(
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/zf_log/")
vcpkg_cmake_config_fixup(PACKAGE_NAME "zf-log" CONFIG_PATH "lib/cmake/zf_log/")

# zf_log-config.cmake
# zf_log-debug.cmake
# zf_log-release.cmake
# zf_log.cmake

# rename zf_log to zf-log for each
file(RENAME "${CURRENT_PACKAGES_DIR}/share/zf-log/zf_log-config.cmake" "${CURRENT_PACKAGES_DIR}/share/zf-log/zf-log-config.cmake")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/zf-log/zf_log-debug.cmake" "${CURRENT_PACKAGES_DIR}/share/zf-log/zf-log-debug.cmake")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/zf-log/zf_log-release.cmake" "${CURRENT_PACKAGES_DIR}/share/zf-log/zf-log-release.cmake")
file(RENAME "${CURRENT_PACKAGES_DIR}/share/zf-log/zf_log.cmake" "${CURRENT_PACKAGES_DIR}/share/zf-log/zf-log.cmake")

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

#message("${CURRENT_PACKAGES_DIR}")
#file(READ tmp "${CURRENT_PACKAGES_DIR}/share/zf_log/zf_log-config.cmake")
#message("zf_log-config.cmake: ${tmp}")

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/zf-log/zf-log-config.cmake" "zf_log" "zf-log")

# also replace zf_log-*.cmake with zf-log-*.cmake

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/zf-log/zf-log.cmake" "zf_log-*.cmake" "zf-log-*.cmake")

0 comments on commit fc351a6

Please sign in to comment.