Skip to content

Commit

Permalink
Fixed problem with install on non-android devices. Fixed issue with O…
Browse files Browse the repository at this point in the history
…TExtension downloading old Encrypto_utils project (now downloading master by default). Fixed redownloading dependencies when cloning with git --recursive
  • Loading branch information
oliver-schick committed Feb 11, 2020
1 parent 1640281 commit 970860c
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 34 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ if(ANDROID)
set(OTExtension_INSTALL_ARCHIVE "${OTExtension_INSTALL_PREFIX}/lib")
set(OTExtension_INSTALL_CONFIG "usr/local")
else(ANDROID)
set(OTExtension_INSTALL_PREFIX "")
set(OTExtension_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
set(OTExtension_INSTALL_INCLUDE "include")
set(OTExtension_INSTALL_LIB "lib")
set(OTExtension_INSTALL_ARCHIVE "lib")
set(OTExtension_INSTALL_CONFIG "usr/local")
set(OTExtension_INSTALL_CONFIG "${CMAKE_INSTALL_PREFIX}")
endif(ANDROID)

if(ANDROID AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Expand Down Expand Up @@ -83,7 +83,7 @@ install_config(OTExtension_INSTALL_LOCATION "${PROJECT_NAME}" "${OTExtension_INS

install(TARGETS otextension
EXPORT "${INSTALL_NAME}Targets"
ARCHIVE DESTINATION "${OTExtension_INSTALL_LIB}"
ARCHIVE DESTINATION "${OTExtension_INSTALL_ARCHIVE}"
LIBRARY DESTINATION "${OTExtension_INSTALL_LIB}"
INCLUDES DESTINATION "${OTExtension_INSTALL_INCLUDE}"
)
Expand Down
Binary file added a923a0b72faf5203a99233e696c163af1e5c17d2.zip
Binary file not shown.
9 changes: 4 additions & 5 deletions cmake/Modules/AddENCRYPTO_utils.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
cmake_minimum_required(VERSION 3.13)

find_package(ENCRYPTO_utils QUIET)
if(ENCRYPTO_utils_FOUND)
message(STATUS "Found ENCRYPTO_utils.")
elseif(NOT ENCRYPTO_utils_FOUND AND NOT TARGET ENCRYPTO_utils::encrypto_utils)
set(ENCRYPTO_utils_LIBRARY_TYPE ${OTExtension_LIBRARY_TYPE})
if(NOT TARGET ENCRYPTO_utils::encrypto_utils)
if(NOT ENCRYPTO_utils_LIBRARY_TYPE)
set(ENCRYPTO_utils_LIBRARY_TYPE ${OTExtension_LIBRARY_TYPE})
endif()
file(GLOB ENCRYPTO_utils_FILE_LIST "${PROJECT_SOURCE_DIR}/extern/ENCRYPTO_utils/*")
list(LENGTH ENCRYPTO_utils_FILE_LIST ENCRYPTO_utils_NUM_FILES)
#if ENCRYPTO_utils directory is empty
Expand Down
28 changes: 14 additions & 14 deletions cmake/Modules/FetchENCRYPTO_utils.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
cmake_minimum_required(VERSION 3.13)

set(ENCRYPTO_utils_SOURCE
CACHE PATH
"Path to ENCRYPTO_utils source."
)
set(ENCRYPTO_utils_URL
https://github.com/oliver-schick/ENCRYPTO_utils/archive/23639b335f64532abdf64cdd131473599799ad62.zip
CACHE STRING
"URL of ENCRYPTO_utils project."
)
set(ENCRYPTO_utils_URL_HASH
SHA256=37a4de5c943cd98592e1af2f8cd3b6f76337ccdbdba80dbf777a2f7c951dae15
CACHE STRING
"Hash of ENCRYPTO_utils archive."
)
set(ENCRYPTO_utils_SOURCE CACHE PATH "Path to ENCRYPTO_utils source.")
set(ENCRYPTO_utils_REPOSITORY
https://github.com/oliver-schick/ENCRYPTO_utils.git
CACHE STRING "Git repository of ENCRYPTO_utils project.")
set(ENCRYPTO_utils_TAG master CACHE STRING "Git tag of downloaded ENCRYPTO_utils project.")
#Specific commit hash. Please regularly update to maintain compatibility with OTExtension.
set(ENCRYPTO_utils_URL
https://github.com/oliver-schick/ENCRYPTO_utils/archive/0380d7f82bc871ab9b1c593265e92482a070d8cf.zip
CACHE STRING "URL of ENCRYPTO_utils project.")
#sha256sum of downloaded file. To get it on linux simply type following command line:
#$ wget -O out [URL] && sha256sum out
set(ENCRYPTO_utils_URL_HASH SHA256=e50fe0667a313a3209492bac20516750b4fa6b8bb19fd94f84043ac1fbbdbd68 CACHE STRING "Hash of ENCRYPTO_utils archive.")
option(DOWNLOAD_ENCRYPTO_utils "Set this option to download a specific commit of ENCRYPTO_utils." OFF)
mark_as_advanced(ENCRYPTO_utils_REPOSITORY ENCRYPTO_utils_TAG ENCRYPTO_utils_URL ENCRYPTO_utils_URL_HASH DOWNLOAD_ENCRYPTO_utils)

include(FetchHelper)
fetch_helper(ENCRYPTO_utils)
35 changes: 23 additions & 12 deletions cmake/Modules/FetchHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,40 @@ macro(fetch_helper content_name)
else()
set(${content_name}_DOWNLOAD_DIR_COMMAND "")
endif()
if(NOT ${${content_name}_SOURCE} STREQUAL "")
set(${content_name}_URL_COMMAND URL ${${content_name}_SOURCE})
set(${content_name}_URL_HASH_COMMAND "")
if(NOT "${${content_name}_SOURCE}" STREQUAL "")
set(${content_name}_DOWNLOAD_COMMAND1 URL ${${content_name}_SOURCE})
set(${content_name}_DOWNLOAD_COMMAND2 "")
elseif(DOWNLOAD_${content_name} OR "${${content_name}_REPOSITORY}" STREQUAL "")
set(${content_name}_DOWNLOAD_COMMAND1 URL ${${content_name}_URL})
set(${content_name}_DOWNLOAD_COMMAND2 URL_HASH ${${content_name}_URL_HASH})
else()
set(${content_name}_URL_COMMAND URL ${${content_name}_URL})
set(${content_name}_URL_HASH_COMMAND URL_HASH ${${content_name}_URL_HASH})
set(${content_name}_DOWNLOAD_COMMAND1 GIT_REPOSITORY ${${content_name}_REPOSITORY})
set(${content_name}_DOWNLOAD_COMMAND2 GIT_TAG ${${content_name}_TAG})
endif()
include(FetchContent)
FetchContent_Declare(${content_name}
${${content_name}_URL_COMMAND}
${${content_name}_URL_HASH_COMMAND}
${${content_name}_DOWNLOAD_COMMAND1}
${${content_name}_DOWNLOAD_COMMAND2}
${${content_name}_DOWNLOAD_DIR_COMMAND}
)
FetchContent_GetProperties(${content_name})
if(NOT ${LOWER_CASE_${content_name}}_POPULATED)
FetchContent_Populate(${content_name})
if(${ARGV1})
if(NOT "${ARGV1}" STREQUAL "")
message(STATUS "Applying patches to ${content_name}...")
include("Patch${content_name}")
endif()
add_subdirectory(
${${LOWER_CASE_${content_name}}_SOURCE_DIR}
${${LOWER_CASE_${content_name}}_BINARY_DIR}
)
if(NOT "${ARGV2}" STREQUAL "")
add_subdirectory(
${${LOWER_CASE_${content_name}}_SOURCE_DIR}
${${LOWER_CASE_${content_name}}_BINARY_DIR}
EXCLUDE_FROM_ALL
)
else()
add_subdirectory(
${${LOWER_CASE_${content_name}}_SOURCE_DIR}
${${LOWER_CASE_${content_name}}_BINARY_DIR}
)
endif()
endif()
endmacro()

0 comments on commit 970860c

Please sign in to comment.