Refactoring
This commit is contained in:
1 parent
f90324e2b7
commit
dc9ea361f0
16 files changed
+818
-1933
No files matched your search
@@ -0,0 +1,84 @@
|
||||
set(FRG_NAVIGATION_THIRDPARTY_DIR
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../thirdparty")
|
||||
|
||||
file(MAKE_DIRECTORY "${FRG_NAVIGATION_THIRDPARTY_DIR}")
|
||||
|
||||
function(frg_fetch_navigation_dependencies)
|
||||
set(_dependencies
|
||||
"https://github.com/AngusJohnson/Clipper2/archive/refs/tags/Clipper2_2.0.1.zip|Clipper2_2.0.1.zip|Clipper2-Clipper2_2.0.1|CPP/CMakeLists.txt"
|
||||
"https://github.com/artem-ogre/CDT/archive/refs/tags/2.0.2.zip|CDT-2.0.2.zip|CDT-2.0.2|CDT/include/CDT.h"
|
||||
"https://github.com/MikeLankamp/fpm/archive/refs/tags/v1.1.0.zip|fpm-v1.1.0.zip|fpm-1.1.0|include/fpm/fixed.hpp"
|
||||
)
|
||||
|
||||
foreach(_dependency IN LISTS _dependencies)
|
||||
string(REPLACE "|" ";" _parts "${_dependency}")
|
||||
list(GET _parts 0 _url)
|
||||
list(GET _parts 1 _archive_name)
|
||||
list(GET _parts 2 _source_name)
|
||||
list(GET _parts 3 _check_file)
|
||||
|
||||
set(_archive "${FRG_NAVIGATION_THIRDPARTY_DIR}/${_archive_name}")
|
||||
set(_source "${FRG_NAVIGATION_THIRDPARTY_DIR}/${_source_name}")
|
||||
|
||||
if(NOT EXISTS "${_source}/${_check_file}")
|
||||
if(NOT EXISTS "${_archive}")
|
||||
message(STATUS "Downloading ${_archive_name}...")
|
||||
file(DOWNLOAD "${_url}" "${_archive}"
|
||||
SHOW_PROGRESS
|
||||
STATUS _download_status)
|
||||
list(GET _download_status 0 _download_code)
|
||||
if(NOT _download_code EQUAL 0)
|
||||
file(REMOVE "${_archive}")
|
||||
message(FATAL_ERROR
|
||||
"Failed to download ${_url}: ${_download_status}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Extracting ${_archive_name}...")
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xf "${_archive}"
|
||||
WORKING_DIRECTORY "${FRG_NAVIGATION_THIRDPARTY_DIR}"
|
||||
RESULT_VARIABLE _extract_result)
|
||||
if(NOT _extract_result EQUAL 0)
|
||||
message(FATAL_ERROR
|
||||
"Failed to extract ${_archive}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(frg_configure_navigation_dependencies)
|
||||
frg_fetch_navigation_dependencies()
|
||||
|
||||
set(_clipper_source
|
||||
"${FRG_NAVIGATION_THIRDPARTY_DIR}/Clipper2-Clipper2_2.0.1")
|
||||
if(NOT TARGET Clipper2)
|
||||
set(CLIPPER2_UTILS OFF CACHE BOOL "" FORCE)
|
||||
set(CLIPPER2_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(CLIPPER2_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(CLIPPER2_USINGZ OFF CACHE STRING "" FORCE)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory("${_clipper_source}/CPP"
|
||||
"${CMAKE_BINARY_DIR}/thirdparty/clipper2" EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
if(NOT TARGET frg_navigation_cdt)
|
||||
add_library(frg_navigation_cdt INTERFACE)
|
||||
target_include_directories(frg_navigation_cdt INTERFACE
|
||||
"${FRG_NAVIGATION_THIRDPARTY_DIR}/CDT-2.0.2/CDT/include"
|
||||
"${FRG_NAVIGATION_THIRDPARTY_DIR}/CDT-2.0.2/include"
|
||||
"${FRG_NAVIGATION_THIRDPARTY_DIR}/CDT-2.0.2")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET frg_navigation_fpm)
|
||||
add_library(frg_navigation_fpm INTERFACE)
|
||||
target_include_directories(frg_navigation_fpm INTERFACE
|
||||
"${FRG_NAVIGATION_THIRDPARTY_DIR}/fpm-1.1.0/include")
|
||||
endif()
|
||||
|
||||
if(NOT TARGET frg_navigation_dependencies)
|
||||
add_library(frg_navigation_dependencies INTERFACE)
|
||||
target_link_libraries(frg_navigation_dependencies INTERFACE
|
||||
Clipper2 frg_navigation_cdt frg_navigation_fpm)
|
||||
endif()
|
||||
endfunction()
|
||||
Reference in new issue
Block a user