pytorch/cmake
Edward Yang 0e5200adfe Refactor target_compile_options into torch_compile_options (#29730)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29730

Back in the day, Caffe2 had a good idea: instead of spattering
target_compile_options all over the codebase, define a helper
function which sets all the options for a target.  This is especially
helpful if I want to split libtorch.so into libtorch_cpu.so
and libtorch_cuda.so; I need a way to easily apply options
to multiple targets.  A shared helper function is just the ticket.

I moved every target_compile_options call in caffe2/CMakeLists.txt
that didn't seem target dependent (exclusions included OpenMP flags,
API-related macros, ONNX related macros and HIP flags) into
torch_compile_options.  I slavishly preserved the structure:
there's a nearly redundant WERROR if() in the output but I preserved
it.

There is one thing I don't like about this, which is that now
the compile options are off in a random directory that no one would
expect.  But c'est la vie...

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Differential Revision: D18571166

Pulled By: ezyang

fbshipit-source-id: 21cd5f7663485077600782078fbb1787fab09035
2019-11-18 07:05:48 -08:00
..
External Enable RCCL in ROCm build (#27383) 2019-10-04 17:41:41 -07:00
Modules Explain how to specify library location for MKL (#28779) 2019-10-28 08:00:54 -07:00
Modules_CUDA_fix FindCUDA: Use find_program instead of find_path to find nvcc (#29160) 2019-11-05 08:51:35 -08:00
public Refactor target_compile_options into torch_compile_options (#29730) 2019-11-18 07:05:48 -08:00
BuildVariables.cmake [build] Have PyTorch depend on minimal libcaffe2.so instead of libATen.so (#7399) 2018-05-24 07:47:27 -07:00
Caffe2Config.cmake.in Torch rename (#20774) 2019-06-12 20:12:34 -07:00
Caffe2ConfigVersion.cmake.in CMake changes to make Caffe2 more friendly for dependent libraries 2017-10-19 10:05:32 -07:00
cmake_uninstall.cmake.in move cmake_uninstall.cmake.in into cmake/ subfolder 2017-09-05 10:02:18 -07:00
Codegen.cmake Remove Tensor.h, TensorMethods.h from src/core. (#27086) 2019-10-06 09:37:50 -07:00
Dependencies.cmake Consolidate the places that find pybind11 include dirs (#29659) 2019-11-12 14:51:56 -08:00
GoogleTestPatch.cmake Fix conda build for Windows (#19824) 2019-04-27 23:10:46 -07:00
iOS.cmake Remove armv7s build from iOS (#26222) 2019-09-14 11:07:37 -07:00
MiscCheck.cmake Fix iOS simulator build (#25633) 2019-09-04 08:58:25 -07:00
ProtoBuf.cmake Fix Z7_MSVC_OVERRIDE for C source files (#24389) 2019-08-15 06:52:42 -07:00
ProtoBufPatch.cmake Update third_party protobuf to v3.6.1 2019-01-23 09:34:53 -08:00
Summary.cmake Update fbjni and enable PyTorch JNI build 2019-11-15 13:59:44 -08:00
TorchConfig.cmake.in add static libraries to TorchConfig.cmake.in (#29837) 2019-11-14 20:41:33 -08:00
TorchConfigVersion.cmake.in Build mechanism for custom operators (#10226) 2018-08-16 18:56:17 -07:00
Utils.cmake Pass WERROR to CMake as an explicit parameter rather than an env var. 2019-01-28 20:57:18 -08:00
Whitelist.cmake Add whitelist capability for smaller mobile binaries 2017-03-29 08:47:08 -07:00