Files
pytorch/modules/module_test/CMakeLists.txt
peter 0829ef00dd Unify caffe2 and libtorch build scripts on Windows (#18683)
Summary:
`scripts/build_windows.bat` is the original way to build caffe2 on Windows, but since it is merged into libtorch, the build scripts should be unified because they actually do the same thing except there are some different flags.

The follow-up is to add the tests. Looks like the CI job for caffe2 windows is defined [here](https://github.com/pytorch/ossci-job-dsl/blob/master/src/jobs/caffe2.groovy#L906). Could we make them a separate file, just like what we've done in `.jenkins/pytorch/win-build.sh`? There's a bunch of things we can do there, like using ninja and sccache to accelerate build.

cc orionr yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18683

Differential Revision: D14730188

Pulled By: ezyang

fbshipit-source-id: ea287d7f213d66c49faac307250c31f9abeb0ebe
2019-04-05 07:47:32 -07:00

20 lines
685 B
CMake

if (NOT CAFFE2_CMAKE_BUILDING_WITH_MAIN_REPO)
# If we are building the standalone module, we set the proper cmake variables.
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
find_package(Caffe2 REQUIRED)
set(BUILD_TEST ON)
option(BUILD_SHARED_LIBS "Build shared libs." ON)
endif()
if (BUILD_TEST)
add_library(
caffe2_module_test_dynamic
${CMAKE_CURRENT_SOURCE_DIR}/module_test_dynamic.cc)
target_link_libraries(caffe2_module_test_dynamic caffe2_library)
install(TARGETS caffe2_module_test_dynamic DESTINATION lib)
if (MSVC AND BUILD_SHARED_LIBS)
install(FILES $<TARGET_PDB_FILE:caffe2_module_test_dynamic> DESTINATION lib OPTIONAL)
endif()
endif()