blisp-rpm/0001-Fix-cmake.patch

122 lines
4.4 KiB
Diff
Raw Normal View History

2023-01-12 19:32:01 +00:00
diff -ru blisp-0.0.2/CMakeLists.txt blisp-0.0.2-b/CMakeLists.txt
--- blisp-0.0.2/CMakeLists.txt 2023-01-12 05:49:04.000000000 -0500
+++ blisp-0.0.2-b/CMakeLists.txt 2023-01-12 14:31:14.092073606 -0500
@@ -32,29 +32,18 @@
2022-12-31 04:56:06 +00:00
ARCHIVE_OUTPUT_DIRECTORY "static"
OUTPUT_NAME "blisp")
-target_sources(libblisp_obj PRIVATE
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/serialport.c
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/timing.c)
-
-target_include_directories(libblisp_obj PRIVATE ${CMAKE_SOURCE_DIR}/vendor/libserialport)
-
2023-01-12 19:32:01 +00:00
if(WIN32)
target_link_libraries(libblisp_obj PRIVATE Setupapi.lib)
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD)
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/windows.c)
elseif(UNIX AND NOT APPLE)
2022-12-31 04:56:06 +00:00
- target_sources(libblisp_obj PRIVATE
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/linux.c
- ${CMAKE_SOURCE_DIR}/vendor/libserialport/linux_termios.c)
- target_compile_definitions(libblisp_obj PRIVATE
- LIBSERIALPORT_ATBUILD
- HAVE_TERMIOS2_SPEED
- HAVE_STRUCT_TERMIOS2
- HAVE_DECL_BOTHER
- "SP_API=__attribute__((visibility(\"default\")))"
- "SP_PRIV=__attribute__((visibility(\"hidden\")))")
- write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
2023-01-12 19:32:01 +00:00
+ find_package(PkgConfig)
+ pkg_check_modules(LIBSP REQUIRED libserialport>=0.1.1)
2022-12-31 04:56:06 +00:00
+
2023-01-12 19:32:01 +00:00
+ target_link_libraries(libblisp_obj PRIVATE ${LIBSP_LIBRARIES})
+ target_include_directories(libblisp_obj PRIVATE ${LIBSP_INCLUDE_DIRS})
+ target_compile_options(libblisp_obj PUBLIC ${LIBSP_CFLAGS_OTHER})
elseif(APPLE)
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
@@ -67,6 +56,49 @@
write_file(${CMAKE_SOURCE_DIR}/vendor/libserialport/config.h "// bypass errors.")
endif()
2022-12-31 04:56:06 +00:00
+set(BLISP_PACKAGE_NAME Blisp)
2023-01-12 19:32:01 +00:00
+set(BLISP_VERSION 0.0.2)
2022-12-31 04:56:06 +00:00
+include(GNUInstallDirs)
+if(UNIX OR MSYS OR MINGW)
+ set(BLISP_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/blisp)
+elseif(WIN32)
+ set(BLISP_INSTALL_CMAKEDIR "cmake")
2023-01-12 19:32:01 +00:00
+endif()
+
2022-12-31 04:56:06 +00:00
if(BLISP_BUILD_CLI)
add_subdirectory(tools/blisp)
+ install(TARGETS blisp
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ )
endif()
+
+install(TARGETS libblisp
+ EXPORT ${BLISP_PACKAGE_NAME}Config
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+)
+
2023-01-12 19:32:01 +00:00
+file(GLOB HEADER_FILES
+ "${PROJECT_SOURCE_DIR}/include/*.h"
+ "${PROJECT_SOURCE_DIR}/data/*.h"
+)
2022-12-31 04:56:06 +00:00
+
+install(FILES ${HEADER_FILES}
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+install(EXPORT ${BLISP_PACKAGE_NAME}Config
+ NAMESPACE ${BLISP_PROJECT_NAME}::
+ DESTINATION ${BLISP_INSTALL_CMAKEDIR}
+)
+
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file("${PROJECT_BINARY_DIR}/${BLISP_PACKAGE_NAME}ConfigVersion.cmake"
+ VERSION ${BLISP_VERSION}
+ COMPATIBILITY SameMajorVersion
+)
+
+install(FILES "${PROJECT_BINARY_DIR}/${BLISP_PACKAGE_NAME}ConfigVersion.cmake"
+ DESTINATION ${BLISP_INSTALL_CMAKEDIR}
+)
2023-01-12 19:32:01 +00:00
diff -ru blisp-0.0.2/tools/blisp/CMakeLists.txt blisp-0.0.2-b/tools/blisp/CMakeLists.txt
--- blisp-0.0.2/tools/blisp/CMakeLists.txt 2023-01-12 05:49:04.000000000 -0500
+++ blisp-0.0.2-b/tools/blisp/CMakeLists.txt 2023-01-12 14:20:35.839890965 -0500
@@ -1,20 +1,21 @@
set(ARGTABLE3_ENABLE_TESTS OFF CACHE BOOL "Enable unit tests")
set(ARGTABLE3_ENABLE_EXAMPLES OFF CACHE BOOL "Enable examples")
#set(ARGTABLE3_REPLACE_GETOPT OFF CACHE BOOL "Replace getopt in the system C library")
2022-12-31 04:56:06 +00:00
-add_subdirectory(${CMAKE_SOURCE_DIR}/vendor/argtable3 ${CMAKE_CURRENT_BINARY_DIR}/argtable3)
2023-01-12 19:32:01 +00:00
add_executable(blisp src/main.c src/cmd/write.c src/util.c src/common.c src/cmd/iot.c)
2022-12-31 04:56:06 +00:00
-target_include_directories(blisp PRIVATE
- "${CMAKE_SOURCE_DIR}/include"
- "${CMAKE_SOURCE_DIR}/vendor/argtable3/src")
+find_package(Argtable3 REQUIRED)
+target_include_directories(blisp PRIVATE
+ "${CMAKE_SOURCE_DIR}/include")
target_link_libraries(blisp PRIVATE
- argtable3
+ argtable3::argtable3
+ ${LIBSP_LIBRARIES}
libblisp_static)
2023-01-12 19:32:01 +00:00
if (WIN32)
2022-12-31 04:56:06 +00:00
target_link_libraries(blisp PRIVATE Setupapi.lib)
2023-01-12 19:32:01 +00:00
elseif (APPLE)
2022-12-31 04:56:06 +00:00
target_link_libraries(blisp PRIVATE "-framework IOKit" "-framework CoreFoundation")
2023-01-12 19:32:01 +00:00
-endif ()
2022-12-31 04:56:06 +00:00
\ No newline at end of file
2023-01-12 19:32:01 +00:00
+endif ()
2022-12-31 04:56:06 +00:00
+