Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build from sources error #514

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,19 @@ set(PROJECT_EXPORT_GROUP "${PROJECT_NAME}Targets")
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
COMMAND ${GIT_EXECUTABLE} rev-parse --show-toplevel
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE DEPTHAI_DOWNLOADED_SOURCES
OUTPUT_QUIET ERROR_QUIET
RESULT_VARIABLE _git_root_dir_error
OUTPUT_VARIABLE _git_root_dir
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(DEPTHAI_DOWNLOADED_SOURCES ON)
if(_git_root_dir_error EQUAL 0 AND "${_git_root_dir}" STREQUAL "${CMAKE_CURRENT_LIST_DIR}")
set(DEPTHAI_DOWNLOADED_SOURCES OFF)
endif()
message(DEBUG "Git root dir (${_git_root_dir_error}): ${_git_root_dir}")
message(DEBUG "DepthAI as downloaded sources: ${DEPTHAI_DOWNLOADED_SOURCES}")
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
Expand Down
11 changes: 9 additions & 2 deletions shared/depthai-bootloader-shared.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(SUBSTRING ${statusCommit} 0 1 status)
if(${status} STREQUAL "-")
if("${status}" STREQUAL "-")
message(FATAL_ERROR "Submodule 'depthai-bootloader-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
endif()
endif()
Expand All @@ -49,4 +49,11 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
else()
set(DEPTHAI_BOOTLOADER_SHARED_COMMIT_FOUND FALSE)
endif()
endif()
endif()

# Make sure files exist
foreach(source_file ${DEPTHAI_BOOTLOADER_SHARED_SOURCES})
if(NOT EXISTS ${source_file})
message(FATAL_ERROR "depthai-bootloader-shared submodule files missing. Make sure to download prepackaged release instead of \"Source code\" on GitHub. Example: depthai-core-vX.Y.Z.tar.gz")
endif()
endforeach()
12 changes: 10 additions & 2 deletions shared/depthai-shared.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(SUBSTRING ${statusCommit} 0 1 status)
if(${status} STREQUAL "-")
if("${status}" STREQUAL "-")
message(FATAL_ERROR "Submodule 'depthai-shared' not initialized/updated. Run 'git submodule update --init --recursive' first")
endif()
endif()
Expand All @@ -55,4 +55,12 @@ if(GIT_FOUND AND NOT DEPTHAI_DOWNLOADED_SOURCES)
else()
set(DEPTHAI_SHARED_COMMIT_FOUND FALSE)
endif()
endif()
endif()

# Make sure files exist
foreach(source_file ${DEPTHAI_SHARED_SOURCES})
message(STATUS "Checking file: ${source_file}")
if(NOT EXISTS ${source_file})
message(FATAL_ERROR "depthai-shared submodule files missing. Make sure to download prepackaged release instead of \"Source code\" on GitHub. Example: depthai-core-vX.Y.Z.tar.gz")
endif()
endforeach()