Skip to content

Commit

Permalink
CI: fix submodule building
Browse files Browse the repository at this point in the history
  • Loading branch information
PolisanTheEasyNick authored Sep 7, 2024
2 parents f1892d6 + 7359905 commit 71c1274
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,4 @@ jobs:
- name: Build project
run: |
cd build
make
- name: Run tests
run: |
cd build
make test
make
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ set(CMAKE_CXX_FLAGS "-Wno-dev")

#add_definitions(-DDEBUG) #DANGEROUS! IT WILL SKIP SECURITY CHECKS

include(pigpio/util/Findpigpio.cmake) #sets pigpio_INCLUDE_DIRS if found in system
include(pigpio/util/Findpigpio.cmake) #sets pigpio_INCLUDE_DIRS and pigpiod_if2_LIBRARY if found in system
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(pigpio QUIET)

if(NOT pigpio_FOUND)
message("pigpio not found in system! Building from submodule instead.")
add_subdirectory(pigpio)
message(WARNING "pigpio not found in system! Will be builded from submodule.")
add_subdirectory("${CMAKE_SOURCE_DIR}/pigpio")
set(pigpio_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/pigpio")
set(PIGPIOD_IF2_LIBRARY "${CMAKE_BINARY_DIR}/pigpio/libpigpiod_if2.so")
include_directories(${pigpio_INCLUDE_DIRS})
set(pigpiod_if2_LIBRARY "${CMAKE_BINARY_DIR}/pigpio/libpigpiod_if2.so")
endif()

include_directories(${pigpio_INCLUDE_DIRS})

add_executable(led-backlight
main.c
server/server.h server/server.c
Expand All @@ -28,10 +29,9 @@ add_executable(led-backlight
globals/globals.h globals/globals.c
)

target_link_libraries(led-backlight OpenSSL::SSL config ${CMAKE_THREAD_LIBS_INIT})

target_link_libraries(led-backlight OpenSSL::SSL config ${CMAKE_THREAD_LIBS_INIT} ${pigpiod_if2_LIBRARY})
if(NOT pigpio_FOUND)
target_link_libraries(led-backlight ${PIGPIOD_IF2_LIBRARY})
add_dependencies(led-backlight pigpiod_if2) #is there cleaner way to make submodule build???
endif()

include(GNUInstallDirs)
Expand Down

0 comments on commit 71c1274

Please sign in to comment.