Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CMakeList.txt): allow passing third-party dependency version from environment variable #80

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
hooks:
- id: clang-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.287
rev: v0.0.290
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -39,11 +39,11 @@ repos:
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.12.0
hooks:
- id: pyupgrade
args: [--py37-plus]
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

-
- Allow passing third-party dependency version from environment variable by [@XuehaiPan](https://github.com/XuehaiPan) in [#80](https://github.com/metaopt/optree/pull/80).

### Changed

-
- Bump `abseil-cpp` version to 20230802.1 by [@XuehaiPan](https://github.com/XuehaiPan) in [#80](https://github.com/metaopt/optree/pull/80).

### Fixed

Expand Down
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,20 @@ cmake_minimum_required(VERSION 3.11) # for FetchContent
project(optree LANGUAGES CXX)

include(FetchContent)
set(PYBIND11_VERSION v2.11.1)
set(ABSEIL_CPP_VERSION 20230802.0)

set(THIRD_PARTY_DIR "${CMAKE_SOURCE_DIR}/third-party")
if(NOT DEFINED PYBIND11_VERSION AND NOT "$ENV{PYBIND11_VERSION}" STREQUAL "")
set(PYBIND11_VERSION "$ENV{PYBIND11_VERSION}")
endif()
if(NOT DEFINED ABSEIL_CPP_VERSION AND NOT "$ENV{ABSEIL_CPP_VERSION}" STREQUAL "")
set(ABSEIL_CPP_VERSION "$ENV{ABSEIL_CPP_VERSION}")
endif()
if(NOT PYBIND11_VERSION)
set(PYBIND11_VERSION v2.11.1)
endif()
if(NOT ABSEIL_CPP_VERSION)
set(ABSEIL_CPP_VERSION 20230802.1)
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
Expand Down