Generate `enum` bindings for Python and Java (#8393)
[cvc5.git] / cmake / FindSymFPU.cmake
1 ###############################################################################
2 # Top contributors (to current version):
3 # Gereon Kremer, Mathias Preiner
4 #
5 # This file is part of the cvc5 project.
6 #
7 # Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8 # in the top-level source directory and their institutional affiliations.
9 # All rights reserved. See the file COPYING in the top-level source
10 # directory for licensing information.
11 # #############################################################################
12 #
13 # Find SymFPU
14 # SymFPU_FOUND - should always be true
15 # SymFPU - interface target for the SymFPU headers
16 ##
17
18 find_path(SymFPU_INCLUDE_DIR NAMES symfpu/core/unpackedFloat.h)
19
20 set(SymFPU_FOUND_SYSTEM FALSE)
21 if(SymFPU_INCLUDE_DIR)
22 # Found SymFPU to be installed system-wide
23 set(SymFPU_FOUND_SYSTEM TRUE)
24 endif()
25
26 if(NOT SymFPU_FOUND_SYSTEM)
27 check_ep_downloaded("SymFPU-EP")
28 if(NOT SymFPU-EP_DOWNLOADED)
29 check_auto_download("SymFPU" "")
30 endif()
31
32 include(ExternalProject)
33 include(deps-helper)
34
35 set(SymFPU_COMMIT "8fbe139bf0071cbe0758d2f6690a546c69ff0053")
36
37 ExternalProject_Add(
38 SymFPU-EP
39 ${COMMON_EP_CONFIG}
40 URL https://github.com/martin-cs/symfpu/archive/${SymFPU_COMMIT}.tar.gz
41 URL_HASH SHA1=9e00045130b93e3c2a46ce73a1b5b6451340dc46
42 PATCH_COMMAND patch -p1 -d <SOURCE_DIR>
43 -i ${CMAKE_CURRENT_LIST_DIR}/deps-utils/SymFPU-patch-20201114.patch
44 CONFIGURE_COMMAND ""
45 BUILD_COMMAND ""
46 INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/core
47 <INSTALL_DIR>/include/symfpu/core
48 COMMAND ${CMAKE_COMMAND} -E copy_directory <SOURCE_DIR>/utils
49 <INSTALL_DIR>/include/symfpu/utils
50 )
51
52 set(SymFPU_INCLUDE_DIR "${DEPS_BASE}/include/")
53 endif()
54
55 set(SymFPU_FOUND TRUE)
56
57 add_library(SymFPU INTERFACE IMPORTED GLOBAL)
58 set_target_properties(
59 SymFPU PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${SymFPU_INCLUDE_DIR}"
60 )
61
62 mark_as_advanced(SymFPU_FOUND)
63 mark_as_advanced(SymFPU_FOUND_SYSTEM)
64 mark_as_advanced(SymFPU_INCLUDE_DIR)
65
66 if(SymFPU_FOUND_SYSTEM)
67 message(STATUS "Found SymFPU: ${SymFPU_INCLUDE_DIR}")
68 else()
69 message(STATUS "Building SymFPU: ${SymFPU_INCLUDE_DIR}")
70 add_dependencies(SymFPU SymFPU-EP)
71 endif()