bombomby / optick

C++ Profiler For Games
https://optick.dev
MIT License
2.95k stars 296 forks source link

Support vcpkg #161

Open ylz-at opened 2 years ago

ylz-at commented 2 years ago

Hi, could you please support vcpkg? Then the integration process will be as easy as vcpkg install optick.

laycnc commented 2 years ago

I agree with you. We need this feature.

I have personally researched how to support vcpkg. I was able to confirm that it works by placing the attached sample in vcpkg/ports/optick. If @bombomby feels there is no problem, I would like to see this reflected in https://github.com/microsoft/vcpkg.

{
    "name": "optick",
    "version-string": "1.4.00",
    "port-version": 1,
    "description": "Optick is a super-lightweight C++ profiler for Games.",
    "homepage": "https://github.com/bombomby/optick",
    "license": "MIT",
    "dependencies": [
      {
        "name": "vcpkg-cmake",
        "host": true
      },
      {
        "name": "vcpkg-cmake-config",
        "host": true
      }
    ]
  }
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO bombomby/optick
    REF 1.4.0.0
    SHA512 9b835163aef7adaa7296c90eb104a742a32021a420f05ae7dd4025bceea0c4f624a1f447684a2c8a88ee8c43fd54ec83809e9434e6a786922b3b07b90f10c64e
    HEAD_REF master
)

vcpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
    OPTIONS
        -DOPTICK_USE_VULKAN=OFF
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/optick)

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

vcpkg_copy_pdbs()

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
MasterDrake commented 2 years ago

I agree with you. We need this feature.

I have personally researched how to support vcpkg. I was able to confirm that it works by placing the attached sample in vcpkg/ports/optick. If @bombomby feels there is no problem, I would like to see this reflected in https://github.com/microsoft/vcpkg.

{
    "name": "optick",
    "version-string": "1.4.00",
    "port-version": 1,
    "description": "Optick is a super-lightweight C++ profiler for Games.",
    "homepage": "https://github.com/bombomby/optick",
    "license": "MIT",
    "dependencies": [
      {
        "name": "vcpkg-cmake",
        "host": true
      },
      {
        "name": "vcpkg-cmake-config",
        "host": true
      }
    ]
  }
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)

vcpkg_from_github(
    OUT_SOURCE_PATH SOURCE_PATH
    REPO bombomby/optick
    REF 1.4.0.0
    SHA512 9b835163aef7adaa7296c90eb104a742a32021a420f05ae7dd4025bceea0c4f624a1f447684a2c8a88ee8c43fd54ec83809e9434e6a786922b3b07b90f10c64e
    HEAD_REF master
)

vcpkg_cmake_configure(
    SOURCE_PATH "${SOURCE_PATH}"
    OPTIONS
        -DOPTICK_USE_VULKAN=OFF
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/optick)

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

vcpkg_copy_pdbs()

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

Worked perfectly! Thanks!