Skip to content

Commit

Permalink
Introduce an indirection header for including Python.h.
Browse files Browse the repository at this point in the history
We should no longer include Python.h directly and instead use the new
pySafePython.h file. Including Python.h directly is known to cause
problems on certain platforms with certain build configurations.

A follow up change will replace all current includes of Python.h.

See #785
See #1006

(Internal change: 2033910)
  • Loading branch information
c64kernal authored and pixar-oss committed Jan 28, 2020
1 parent 8093b08 commit 9cbf5e1
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions pxr/base/tf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ pxr_library(tf
type_Impl.h

PYTHON_PUBLIC_HEADERS
pySafePython.h
pyStaticTokens.h

PRIVATE_CLASSES
Expand Down
34 changes: 34 additions & 0 deletions pxr/base/tf/pySafePython.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Copyright 2020 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#ifndef PXR_BASE_TF_PY_SAFE_PYTHON_H
#define PXR_BASE_TF_PY_SAFE_PYTHON_H

/// \file tf/pySafePython.h
/// Intended to replace a direct include of Python.h, which causes several
/// build problems with certain configurations and platforms (e.g., debug
/// builds on Windows)

#include <boost/python/detail/wrap_python.hpp>

#endif // PXR_BASE_TF_PY_SAFE_PYTHON_H

0 comments on commit 9cbf5e1

Please sign in to comment.