-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
72 lines (47 loc) · 3.19 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
cmake_minimum_required(VERSION 2.6)
project(U-LP_Library)
set(lib_name_shared ulpcrypt)
set(lib_name_static ulpcrypt-static)
set(lib_files src/ulpcrypt.h src/structs.h src/structs.c src/keygen.h src/keygen.c src/crypt.h src/crypt.c src/encoding.h src/encoding.c src/random.h src/random.c src/mathutil.h src/mathutil.c src/ring_structs.h src/ring_structs.c src/ring_keygen.h src/ring_keygen.c src/ring_crypt.h src/ring_crypt.c)
add_library(${lib_name_shared} SHARED ${lib_files})
add_library(${lib_name_static} STATIC ${lib_files})
set(CMAKE_C_FLAGS "-Wall -Wextra -std=c11 -lm")
set(CMAKE_C_FLAGS_DEBUG "-O0 -g")
set(CMAKE_C_FLAGS_RELEASE "-O3")
set(CMAKE_BUILD_TYPE Release)
### testing ###
enable_testing()
add_executable(test_structs test/test_structs.c src/structs.h src/structs.c)
add_test(test_structs test_structs)
add_executable(test_random test/test_random.c src/random.h src/random.c)
add_test(test_random test_random)
add_executable(test_max test/test_max.c src/mathutil.h src/mathutil.c)
add_test(test_max test_max)
add_executable(test_mulmod test/test_mulmod.c src/mathutil.h src/mathutil.c)
add_test(test_mulmod test_mulmod)
add_executable(test_expmod test/test_expmod.c src/mathutil.h src/mathutil.c)
add_test(test_expmod test_expmod)
add_executable(test_prime test/test_prime.c src/mathutil.h src/mathutil.c)
add_test(test_prime test_prime)
add_executable(test_gen_params test/test_gen_params.c src/keygen.h src/keygen.c src/mathutil.h src/mathutil.c src/structs.h src/structs.c src/random.h src/random.c)
add_test(test_gen_params test_gen_params)
add_executable(test_gen_keys test/test_gen_keys.c src/keygen.h src/keygen.c src/mathutil.h src/mathutil.c src/structs.h src/structs.c src/random.h src/random.c)
add_test(test_gen_keys test_gen_keys)
add_executable(test_coding test/test_coding.c src/encoding.h src/encoding.c)
add_test(test_coding test_coding)
add_executable(test_crypt test/test_crypt.c src/crypt.h src/crypt.c src/encoding.h src/encoding.c src/structs.h src/structs.c src/random.h src/random.c src/mathutil.h src/mathutil.c src/keygen.h src/keygen.c)
add_test(test_crypt test_crypt)
add_executable(test_ring_structs test/test_ring_structs.c src/ring_structs.h src/ring_structs.c)
add_test(test_ring_structs test_ring_structs)
add_executable(test_poly_mulmod test/test_poly_mulmod.c src/mathutil.h src/mathutil.c)
add_test(test_poly_mulmod test_poly_mulmod)
add_executable(test_ring_gen_keys test/test_ring_gen_keys.c src/ring_keygen.h src/ring_keygen.c src/mathutil.h src/mathutil.c src/random.h src/random.c src/ring_structs.h src/ring_structs.c)
add_test(test_ring_gen_keys test_ring_gen_keys)
add_executable(test_ring_crypt test/test_ring_crypt.c src/ring_crypt.h src/ring_crypt.c src/ring_keygen.h src/ring_keygen.c src/mathutil.h src/mathutil.c src/random.h src/random.c src/ring_structs.h src/ring_structs.c src/encoding.h src/encoding.c)
add_test(test_ring_crypt test_ring_crypt)
add_executable(test_lib_shared test/test_lib.c src/ulpcrypt.h)
target_link_libraries(test_lib_shared ${lib_name_shared})
add_test(test_lib_shared test_lib_shared)
add_executable(test_lib_static test/test_lib.c src/ulpcrypt.h)
target_link_libraries(test_lib_static ${lib_name_static})
add_test(test_lib_static test_lib_static)