-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
61 lines (53 loc) · 2.51 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
cmake_minimum_required(VERSION 3.7)
project(canokey-qemu C)
include(GNUInstallDirs)
set(CMAKE_C_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fno-omit-frame-pointer")
option(QEMU_DEBUG_OUTPUT "Control ENABLE_DEBUG_OUTPUT in core" OFF)
set(VIRTCARD ON CACHE BOOL "Enable VIRTCARD in core" FORCE)
if (NOT QEMU_DEBUG_OUTPUT)
set(ENABLE_DEBUG_OUTPUT OFF CACHE BOOL "Disable ENABLE_DEBUG_OUTPUT in core" FORCE)
endif ()
set(USBD_PRODUCT_STRING "CanoKey QEMU")
add_subdirectory(canokey-core EXCLUDE_FROM_ALL)
set(LIBCANOKEY_QEMU_SO_VERSION 0)
set(LIBCANOKEY_QEMU_PREFIX ${CMAKE_INSTALL_PREFIX})
set(LIBCANOKEY_QEMU_LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR})
set(LIBCANOKEY_QEMU_INCLUDEDIR ${CMAKE_INSTALL_FULL_INCLUDEDIR})
file(GLOB_RECURSE SRC Src/*.c)
if(${APPLE})
add_library(canokey-qemu STATIC ${SRC}
canokey-core/virt-card/device-sim.c
canokey-core/virt-card/fabrication.c
canokey-core/littlefs/bd/lfs_filebd.c)
else()
add_library(canokey-qemu SHARED ${SRC}
canokey-core/virt-card/device-sim.c
canokey-core/virt-card/fabrication.c
canokey-core/littlefs/bd/lfs_filebd.c)
endif()
set_target_properties(canokey-qemu PROPERTIES PUBLIC_HEADER Inc/canokey-qemu.h)
set_target_properties(canokey-qemu PROPERTIES SOVERSION ${LIBCANOKEY_QEMU_SO_VERSION})
target_include_directories(canokey-qemu SYSTEM PRIVATE Inc canokey-core/virt-card canokey-core)
target_compile_definitions(canokey-qemu PRIVATE HW_VARIANT_NAME="CanoKey QEMU")
target_link_libraries(canokey-qemu general canokey-core)
add_dependencies(canokey-qemu gitrev)
install(TARGETS canokey-qemu LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
if(${APPLE})
configure_file(canokey-qemu_mac.pc.in canokey-qemu.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/canokey-core/canokey-crypto/libcanokey-crypto.a
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
install(FILES ${CMAKE_BINARY_DIR}/canokey-core/canokey-crypto/patched/mbedtls/library/libmbedcrypto.a
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
install(FILES ${CMAKE_BINARY_DIR}/canokey-core/libcanokey-core.a
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR})
install(FILES ${CMAKE_BINARY_DIR}/canokey-qemu.pc
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
else()
configure_file(canokey-qemu.pc.in canokey-qemu.pc @ONLY)
install(FILES ${CMAKE_BINARY_DIR}/canokey-qemu.pc
DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)
endif()