Debian Codegraph @

src/crypto/CMakeLists.txt

raw
1 # Copyright (c) 2014-2022, The Monero Project
2 #
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without modification, are
6 # permitted provided that the following conditions are met:
7 #
8 # 1. Redistributions of source code must retain the above copyright notice, this list of
9 # conditions and the following disclaimer.
10 #
11 # 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 # of conditions and the following disclaimer in the documentation and/or other
13 # materials provided with the distribution.
14 #
15 # 3. Neither the name of the copyright holder nor the names of its contributors may be
16 # used to endorse or promote products derived from this software without specific
17 # prior written permission.
18 #
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 # THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27 # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 set(crypto_sources
30 aesb.c
31 blake256.c
32 chacha.c
33 crypto-ops-data.c
34 crypto-ops.c
35 crypto.cpp
36 groestl.c
37 hash-extra-blake.c
38 hash-extra-groestl.c
39 hash-extra-jh.c
40 hash-extra-skein.c
41 hash.c
42 hmac-keccak.c
43 jh.c
44 keccak.c
45 oaes_lib.c
46 random.c
47 skein.c
48 slow-hash.c
49 rx-slow-hash.c
50 CryptonightR_JIT.c
51 tree-hash.c)
52
53 if(ARCH_ID STREQUAL "i386" OR ARCH_ID STREQUAL "x86_64" OR ARCH_ID STREQUAL "x86-64" OR ARCH_ID STREQUAL "amd64")
54 list(APPEND crypto_sources CryptonightR_template.S)
55 endif()
56
57 include_directories(${RANDOMX_INCLUDE})
58
59 set(crypto_headers)
60
61 monero_find_all_headers(crypto_private_headers "${CMAKE_CURRENT_SOURCE_DIR}")
62
63 monero_private_headers(cncrypto
64 ${crypto_private_headers})
65 monero_add_library(cncrypto
66 ${crypto_sources}
67 ${crypto_headers}
68 ${crypto_private_headers})
69 target_link_libraries(cncrypto
70 PUBLIC
71 epee
72 randomx
73 ${Boost_SYSTEM_LIBRARY}
74 ${SODIUM_LIBRARY}
75 PRIVATE
76 ${EXTRA_LIBRARIES})
77
78 if (ARM)
79 option(NO_OPTIMIZED_MULTIPLY_ON_ARM
80 "Compute multiply using generic C implementation instead of ARM ASM" OFF)
81 if(NO_OPTIMIZED_MULTIPLY_ON_ARM)
82 message(STATUS "Using generic C implementation for multiply")
83 set_property(SOURCE slow-hash.c
84 PROPERTY COMPILE_DEFINITIONS "NO_OPTIMIZED_MULTIPLY_ON_ARM")
85 endif()
86 endif()
87
88 # Because of the way Qt works on android with JNI, the code does not live in the main android thread
89 # So this code runs with a 1 MB default stack size.
90 # This will force the use of the heap for the allocation of the scratchpad
91 if (ANDROID OR IOS)
92 if( BUILD_GUI_DEPS )
93 add_definitions(-DFORCE_USE_HEAP=1)
94 endif()
95 endif()
96
97 # cheat because cmake and ccache hate each other
98 set_property(SOURCE CryptonightR_template.S PROPERTY LANGUAGE C)
99 set_property(SOURCE CryptonightR_template.S PROPERTY XCODE_EXPLICIT_FILE_TYPE sourcecode.asm)
100
101 # Must be done last, because it references libraries in this directory
102 add_subdirectory(wallet)