1 cmake_minimum_required(VERSION 3.4)
3 set(CMAKE_CXX_STANDARD 14)
4 set(CMAKE_CXX_STANDARD_REQUIRED ON)
5 set(CMAKE_SKIP_RPATH ON)
7 find_package(PkgConfig REQUIRED)
8 pkg_check_modules(LIBUSB REQUIRED libusb-1.0>=1.0.16)
9 pkg_check_modules(LIBZ REQUIRED zlib)
10 pkg_check_modules(LIBZSTD REQUIRED libzstd)
14 set(OPENSSL_USE_STATIC_LIBS TRUE)
19 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -O2")
22 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc")
37 link_directories(${CMAKE_CURRENT_SOURCE_DIR}/libuuu ${LIBUSB_LIBRARY_DIRS} ${LIBZSTD_LIBRARY_DIRS} ${LIBZ_LIBRARY_DIRS})
39 set(CLIST_EXECUTABLE ${CMAKE_CURRENT_SOURCE_DIR}/gen_txt_include.sh)
40 set(generated_files_dir "${CMAKE_BINARY_DIR}/uuu/gen")
42 function(preprocess_clst out_var)
45 set(out_f "${generated_files_dir}/${in_f}")
46 string(REPLACE ".lst" ".clst" out_f ${out_f})
47 add_custom_command(OUTPUT ${out_f}
49 COMMAND mkdir -p ${generated_files_dir}
50 COMMAND ${CLIST_EXECUTABLE} ${in_f} ${out_f}
52 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
53 COMMENT "Creating preprocessed clst file ${out_f}"
56 list(APPEND result ${out_f})
58 set(${out_var} "${result}" PARENT_SCOPE)
61 preprocess_clst(CLSTS ${LSTS})
63 include_directories(${generated_files_dir})
72 add_executable(uuu ${SOURCES})
73 target_link_libraries(uuu uuc_s ${OPENSSL_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBZ_LIBRARIES} ${LIBZSTD_LIBRARIES} dl bz2)
75 install(TARGETS uuu DESTINATION bin)
76 target_compile_definitions(uuu
77 PRIVATE "TARGET_PATH=\"${CMAKE_INSTALL_PREFIX}/bin/uuu\""