Skip to content

Commit

Permalink
fix(CMakeLists.txt): torch 2.1.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
XuehaiPan committed Oct 14, 2023
1 parent ad0806e commit 5ca172a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ cmake_minimum_required(VERSION 3.11) # for FetchContent
project(torchopt LANGUAGES CXX)

include(FetchContent)
set(PYBIND11_VERSION v2.10.3)

if(NOT DEFINED PYBIND11_VERSION AND NOT "$ENV{PYBIND11_VERSION}" STREQUAL "")
set(PYBIND11_VERSION "$ENV{PYBIND11_VERSION}")
endif()
if(NOT PYBIND11_VERSION)
set(PYBIND11_VERSION v2.11.1)
endif()

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Threads REQUIRED) # -pthread
Expand Down Expand Up @@ -285,7 +291,5 @@ endforeach()

message(STATUS "Detected Torch Python libraries: \"${TORCH_LIBRARIES}\"")

add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)

include_directories("${CMAKE_SOURCE_DIR}")
add_subdirectory(src)

0 comments on commit 5ca172a

Please sign in to comment.