Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cmake --build . --config Release --verbose
- name: Upload results
uses: actions/upload-artifact@v4
with:
Expand All @@ -54,7 +54,7 @@ jobs:
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
cmake --build .
cmake --build . --verbose
- name: Upload results
uses: actions/upload-artifact@v4
with:
Expand All @@ -75,7 +75,7 @@ jobs:
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
cmake --build .
cmake --build . --verbose
- name: Upload results
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -144,7 +144,7 @@ jobs:
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCMAKE_BUILD_TYPE=Release
cmake --build . -j2
cmake --build . -j2 --verbose
cp ./tools/blisp/blisp "/artifacts/${artifact_name}"
echo "Produced artifact at /artifacts/${artifact_name}"

Expand All @@ -168,7 +168,7 @@ jobs:
mkdir build
cd build
cmake .. -DBLISP_BUILD_CLI=ON -DCOMPILE_TESTS=ON
cmake --build .
cmake --build . --verbose
- name: Run unit tests
run: |
cd build
Expand Down
17 changes: 3 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(CMAKE_C_STANDARD 11)
option(BLISP_BUILD_CLI "Build CLI Tool" OFF)
option(BLISP_USE_SYSTEM_LIBRARIES "Use system-installed libraries" "${CMAKE_USE_SYSTEM_LIBRARIES}")
option(COMPILE_TESTS "Compile the tests" OFF)
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)

add_library(libblisp_obj OBJECT
lib/blisp.c
Expand All @@ -30,8 +31,7 @@ endif()

set_property(TARGET libblisp_obj PROPERTY POSITION_INDEPENDENT_CODE 1)

add_library(libblisp SHARED $<TARGET_OBJECTS:libblisp_obj>)
add_library(libblisp_static STATIC $<TARGET_OBJECTS:libblisp_obj>)
add_library(libblisp $<TARGET_OBJECTS:libblisp_obj>)

set(BLISP_PUBLIC_HEADERS
include/blisp.h
Expand All @@ -44,20 +44,11 @@ set_target_properties(libblisp PROPERTIES
PUBLIC_HEADER "${BLISP_PUBLIC_HEADERS}"
VERSION 0.0.5
SOVERSION 1
LIBRARY_OUTPUT_DIRECTORY "shared"
OUTPUT_NAME "blisp")

set_target_properties(libblisp_static PROPERTIES
PUBLIC_HEADER "${BLISP_PUBLIC_HEADERS}"
VERSION 0.0.5
SOVERSION 1
ARCHIVE_OUTPUT_DIRECTORY "static"
OUTPUT_NAME "blisp")

if(BLISP_USE_SYSTEM_LIBRARIES)
find_package(Libserialport REQUIRED)
target_link_libraries(libblisp PUBLIC Libserialport::Libserialport)
target_link_libraries(libblisp_static PUBLIC Libserialport::Libserialport)
target_include_directories(libblisp_obj PUBLIC ${Libserialport_INCLUDE_DIRS})
else()
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
Expand All @@ -70,7 +61,6 @@ else()

if(WIN32)
target_link_libraries(libblisp PRIVATE Setupapi.lib)
target_link_libraries(libblisp_static PRIVATE Setupapi.lib)
target_compile_definitions(libblisp_obj PRIVATE LIBSERIALPORT_MSBUILD)
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/windows.c)
Expand All @@ -89,7 +79,6 @@ else()
elseif(UNIX AND ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
target_include_directories(libblisp_obj PRIVATE /usr/local/include/)
target_link_libraries(libblisp PRIVATE -L/usr/local/lib usb serialport)
target_link_libraries(libblisp_static PRIVATE -L/usr/local/lib usb serialport)
elseif(APPLE)
target_sources(libblisp_obj PRIVATE
${CMAKE_SOURCE_DIR}/vendor/libserialport/macosx.c)
Expand All @@ -104,7 +93,7 @@ else()
endif()

include(GNUInstallDirs)
install(TARGETS libblisp libblisp_static
install(TARGETS libblisp
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
7 changes: 6 additions & 1 deletion tools/blisp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ else()

target_include_directories(blisp PRIVATE
"${CMAKE_SOURCE_DIR}/vendor/argtable3/src")

# find_package(Argtable3) will pick up -lm from argtable3's .pc
# file, but we need to supply it manually when linking directly
# against the bundled library.
target_link_libraries(blisp PRIVATE m)
endif()

target_include_directories(blisp PRIVATE
"${CMAKE_SOURCE_DIR}/include")

target_link_libraries(blisp PRIVATE
argtable3::argtable3
libblisp_static file_parsers)
libblisp file_parsers)

if (NOT CMAKE_C_COMPILER_ID MATCHES "MSVC")
target_compile_options(libblisp_obj PRIVATE -Wall -Wextra -Wpedantic)
Expand Down