Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support installation #5

Merged
merged 1 commit into from
Apr 3, 2024
Merged
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
12 changes: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ jobs:

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
run: >
cmake --build ${{ steps.strings.outputs.build-output-dir }}
--config ${{ matrix.build_type }}

- name: Install
run: >
cmake --install ${{ steps.strings.outputs.build-output-dir }}
--prefix ${{ steps.strings.outputs.build-output-dir }}/dist
--config ${{ matrix.build_type }}
--component benoni
--verbose

- name: Test
working-directory: ${{ steps.strings.outputs.build-output-dir }}
Expand Down
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ elseif(UNIX)
add_subdirectory(src/linux)
endif()

set_target_properties(benoni PROPERTIES PUBLIC_HEADER include/benoni/http.h)

include(GNUInstallDirs)

install(TARGETS benoni
EXPORT benoni
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
COMPONENT benoni
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT benoni)
install(EXPORT benoni
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake"
COMPONENT benoni)

if(BENONI_EXAMPLES)
add_subdirectory(examples)
endif()
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ configure: .always
build: .always
$(CLANG_FORMAT) --style=file -i include/benoni/http.h src/apple/http.mm src/win32/http.cc src/linux/http.cc examples/http_example.cc test/unit/postman-echo-get.cc test/packaging/project/project.cc
$(CMAKE) --build build
$(CMAKE) --install build --prefix build/dist --config Debug --component benoni --verbose

example: .always
$(EXAMPLE)
Expand Down
4 changes: 3 additions & 1 deletion src/apple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ add_library(benoni STATIC http.mm)

target_compile_options(benoni PUBLIC "-fobjc-arc")

target_include_directories(benoni PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_include_directories(benoni PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/include>)

target_link_libraries(benoni PUBLIC "-framework Foundation")
4 changes: 3 additions & 1 deletion src/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
add_library(benoni STATIC http.cc)

target_include_directories(benoni PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_include_directories(benoni PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/include>)

target_link_libraries(benoni PUBLIC libsoup)
4 changes: 3 additions & 1 deletion src/win32/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
add_library(benoni STATIC http.cc)

target_include_directories(benoni PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_include_directories(benoni PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/include>)

target_link_libraries(benoni PUBLIC "Winhttp.lib")