Skip to content

Commit

Permalink
Use submodules instead of cmake downloads
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: pytorch#96

Reviewed By: jianyuh

Differential Revision: D15336047

Pulled By: dskhudia

fbshipit-source-id: 93435ba920baa3a712c5741e60c479901c95115d
  • Loading branch information
dskhudia authored and facebook-github-bot committed May 14, 2019
1 parent b14f582 commit 7de846a
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 80 deletions.
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "third_party/asmjit"]
path = third_party/asmjit
url = https://github.com/asmjit/asmjit.git
[submodule "third_party/cpuinfo"]
path = third_party/cpuinfo
url = https://github.com/pytorch/cpuinfo
[submodule "third_party/googletest"]
path = third_party/googletest
url = https://github.com/google/googletest
24 changes: 4 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,8 @@ target_compile_options(fbgemm_avx512 PRIVATE
if(NOT TARGET asmjit)
#Download asmjit from github if ASMJIT_SRC_DIR is not specified.
if(NOT DEFINED ASMJIT_SRC_DIR)
message(STATUS "Downloading asmjit to ${FBGEMM_THIRDPARTY_DIR}/asmjit
(define ASMJIT_SRC_DIR to avoid it)")
configure_file("${FBGEMM_SOURCE_DIR}/cmake/modules/DownloadASMJIT.cmake"
"${FBGEMM_BINARY_DIR}/asmjit-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/asmjit-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/asmjit-download")
set(ASMJIT_SRC_DIR "${FBGEMM_THIRDPARTY_DIR}/asmjit" CACHE STRING
"asmjit source directory")
set(ASMJIT_SRC_DIR "${FBGEMM_SOURCE_DIR}/third_party/asmjit"
CACHE STRING "asmjit source directory from submodules")
endif()

#build asmjit
Expand All @@ -127,16 +119,8 @@ endif()
if(NOT TARGET cpuinfo)
#Download cpuinfo from github if CPUINFO_SOURCE_DIR is not specified.
if(NOT DEFINED CPUINFO_SOURCE_DIR)
message(STATUS "Downloading cpuinfo to ${FBGEMM_THIRDPARTY_DIR}/cpuinfo
(define CPUINFO_SOURCE_DIR to avoid it)")
configure_file("${FBGEMM_SOURCE_DIR}/cmake/modules/DownloadCPUINFO.cmake"
"${FBGEMM_BINARY_DIR}/cpuinfo-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/cpuinfo-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/cpuinfo-download")
set(CPUINFO_SOURCE_DIR "${FBGEMM_THIRDPARTY_DIR}/cpuinfo" CACHE STRING
"cpuinfo source directory")
set(CPUINFO_SOURCE_DIR "${FBGEMM_SOURCE_DIR}/third_party/cpuinfo"
CACHE STRING "cpuinfo source directory from submodules")
endif()

#build cpuinfo
Expand Down
16 changes: 0 additions & 16 deletions cmake/modules/DownloadASMJIT.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions cmake/modules/DownloadCPUINFO.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions cmake/modules/DownloadGTEST.cmake

This file was deleted.

14 changes: 2 additions & 12 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,8 @@ if(FBGEMM_BUILD_TESTS AND NOT TARGET gtest)
#Download Googletest framework from github if
#GOOGLETEST_SOURCE_DIR is not specified.
if(NOT DEFINED GOOGLETEST_SOURCE_DIR)
message(STATUS "Downloading googletest to
${FBGEMM_THIRDPARTY_DIR}/googletest
(define GOOGLETEST_SOURCE_DIR to avoid it)")
configure_file("${FBGEMM_SOURCE_DIR}/cmake/modules/DownloadGTEST.cmake"
"${FBGEMM_BINARY_DIR}/googletest-download/CMakeLists.txt")
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/googletest-download")
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
WORKING_DIRECTORY "${FBGEMM_BINARY_DIR}/googletest-download")
set(GOOGLETEST_SOURCE_DIR "${FBGEMM_THIRDPARTY_DIR}/googletest" CACHE STRING
"googletest source directory")
set(GOOGLETEST_SOURCE_DIR "${FBGEMM_SOURCE_DIR}/third_party/googletest"
CACHE STRING "googletest source directory from submodules")
endif()

#build Googletest framework
Expand Down Expand Up @@ -44,4 +35,3 @@ foreach(TEST_FILE ${TEST_LIST})
add_gtest("${TEST_NAME}"
"${TEST_FILE_ONLY}")
endforeach()

1 change: 1 addition & 0 deletions third_party/asmjit
Submodule asmjit added at 673dce
1 change: 1 addition & 0 deletions third_party/cpuinfo
Submodule cpuinfo added at d5e37a
1 change: 1 addition & 0 deletions third_party/googletest
Submodule googletest added at 0fc546

0 comments on commit 7de846a

Please sign in to comment.