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 build dependencies from source #180

Merged
merged 1 commit into from
Aug 28, 2023
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
14 changes: 8 additions & 6 deletions .github/workflows/ci.linux.arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ jobs:

- name: Install Dependencies
run: |
dnf install -y git gcc-c++ cmake
dnf install -y git gcc-c++ cmake 'dnf-command(config-manager)'
dnf install -y gcc-toolset-9-gcc-c++
dnf install -y openssl-devel libcurl-devel libaio-devel
dnf install -y epel-release
dnf install -y fuse-devel libgsasl-devel
dnf config-manager --set-enabled powertools
dnf install -y gtest-devel gmock-devel gflags-devel fuse-devel libgsasl-devel e2fsprogs-devel

- name: Build
run: |
source /opt/rh/gcc-toolset-9/enable
cmake -B build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D ENABLE_SASL=ON -D ENABLE_FUSE=ON \
-D ENABLE_URING=OFF -D FETCH_GTEST_GFLAGS_SOURCE=ON
cmake --build build
cmake -B build -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D PHOTON_BUILD_DEPENDENCIES=OFF -D PHOTON_BUILD_TESTING=ON \
-D PHOTON_ENABLE_SASL=ON -D PHOTON_ENABLE_FUSE=ON \
-D PHOTON_ENABLE_EXTFS=ON
cmake --build build -j -- VERBOSE=1

- name: Test
run: |
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/ci.linux.x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@ jobs:

- name: Install Dependencies
run: |
dnf install -y git gcc-c++ cmake
dnf install -y git gcc-c++ cmake 'dnf-command(config-manager)'
dnf install -y gcc-toolset-9-gcc-c++
dnf install -y openssl-devel libcurl-devel libaio-devel
dnf install -y epel-release
dnf install -y fuse-devel libgsasl-devel
dnf config-manager --set-enabled powertools
dnf install -y gtest-devel gmock-devel gflags-devel fuse-devel libgsasl-devel e2fsprogs-devel

- name: Build
run: |
source /opt/rh/gcc-toolset-9/enable
cmake -B build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D ENABLE_SASL=ON -D ENABLE_FUSE=ON \
-D ENABLE_URING=OFF -D FETCH_GTEST_GFLAGS_SOURCE=ON
cmake --build build
cmake -B build -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D PHOTON_BUILD_DEPENDENCIES=OFF -D PHOTON_BUILD_TESTING=ON \
-D PHOTON_ENABLE_SASL=ON -D PHOTON_ENABLE_FUSE=ON \
-D PHOTON_ENABLE_EXTFS=ON
cmake --build build -j -- VERBOSE=1

- name: Test
run: |
Expand All @@ -54,17 +56,19 @@ jobs:
run: |
dnf install -y git gcc-c++ cmake
dnf install -y gcc-toolset-9-gcc-c++
dnf install -y openssl-devel libcurl-devel libaio-devel
dnf install -y openssl-devel libcurl-devel
dnf install -y epel-release
dnf install -y fuse-devel libgsasl-devel
dnf install -y fuse-devel libgsasl-devel e2fsprogs-devel

- name: Build
run: |
source /opt/rh/gcc-toolset-9/enable
cmake -B build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D ENABLE_SASL=ON -D ENABLE_FUSE=ON \
-D ENABLE_URING=ON -D FETCH_GTEST_GFLAGS_SOURCE=ON
cmake --build build
cmake -B build -D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D PHOTON_BUILD_DEPENDENCIES=ON -D PHOTON_BUILD_TESTING=ON \
-D PHOTON_ENABLE_SASL=ON -D PHOTON_ENABLE_FUSE=ON \
-D PHOTON_ENABLE_EXTFS=ON \
-D PHOTON_ENABLE_URING=ON
cmake --build build -j -- VERBOSE=1

- name: Test
run: |
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:

- name: Build
run: |
cmake -B ${{github.workspace}}/build -D BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=Debug \
-D ENABLE_SASL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3
cmake --build ${{github.workspace}}/build
cmake -B ${{github.workspace}}/build -D PHOTON_BUILD_TESTING=ON -D CMAKE_BUILD_TYPE=Debug \
-D PHOTON_ENABLE_SASL=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@3
cmake --build ${{github.workspace}}/build -j -- VERBOSE=1

- name: Test
working-directory: ${{github.workspace}}/build
Expand Down
7 changes: 7 additions & 0 deletions CMake/Findcurl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
find_path(CURL_INCLUDE_DIRS curl/curl.h)

find_library(CURL_LIBRARIES curl)

find_package_handle_standard_args(curl DEFAULT_MSG CURL_LIBRARIES CURL_INCLUDE_DIRS)

mark_as_advanced(CURL_INCLUDE_DIRS CURL_LIBRARIES)
14 changes: 5 additions & 9 deletions CMake/Finde2fs.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
if (LIBE2FS_PATH)
find_path(LIBE2FS_INCLUDE_DIRS ext2fs/ext2fs.h HINTS ${LIBE2FS_PATH}/include)
find_library(LIBE2FS_LIBRARIES ext2fs HINTS ${LIBE2FS_PATH}/lib)
else()
find_path(LIBE2FS_INCLUDE_DIRS ext2fs/ext2fs.h)
find_library(LIBE2FS_LIBRARIES ext2fs)
endif()
find_path(E2FS_INCLUDE_DIRS ext2fs/ext2fs.h)

find_package_handle_standard_args(e2fs DEFAULT_MSG LIBE2FS_LIBRARIES LIBE2FS_INCLUDE_DIRS)
find_library(E2FS_LIBRARIES ext2fs)

mark_as_advanced(LIBE2FS_INCLUDE_DIRS LIBE2FS_LIBRARIES)
find_package_handle_standard_args(e2fs DEFAULT_MSG E2FS_LIBRARIES E2FS_INCLUDE_DIRS)

mark_as_advanced(E2FS_INCLUDE_DIRS E2FS_LIBRARIES)
6 changes: 6 additions & 0 deletions CMake/Findfstack.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
pkg_check_modules(DPDK REQUIRED libdpdk)

find_path(FSTACK_INCLUDE_DIRS NAMES ff_api.h PATHS /usr/local/include NO_DEFAULT_PATH)

find_library(FSTACK_LIBRARIES NAMES fstack PATHS /usr/local/lib NO_DEFAULT_PATH)

set(FSTACK_INCLUDE_DIRS ${FSTACK_INCLUDE_DIRS} ${DPDK_INCLUDE_DIRS})

set(FSTACK_LIBRARIES ${FSTACK_LIBRARIES} ${DPDK_STATIC_LDFLAGS})

find_package_handle_standard_args(fstack DEFAULT_MSG FSTACK_LIBRARIES FSTACK_INCLUDE_DIRS)

mark_as_advanced(FSTACK_INCLUDE_DIRS FSTACK_LIBRARIES)
2 changes: 1 addition & 1 deletion CMake/Findgflags.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
find_path(GFLAGS_INCLUDE_DIRS gflags/gflags.h)

find_library(GFLAGS_LIBRARIES gflags)
find_library(GFLAGS_LIBRARIES gflags_nothreads)

find_package_handle_standard_args(gflags DEFAULT_MSG GFLAGS_LIBRARIES GFLAGS_INCLUDE_DIRS)

Expand Down
7 changes: 0 additions & 7 deletions CMake/Findgmock.cmake

This file was deleted.

17 changes: 17 additions & 0 deletions CMake/Findgoogletest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
find_path(GOOGLETEST_INCLUDE_DIRS gtest/gtest.h gmock/gmock.h)

find_library(GOOGLETEST_GTEST_LIBRARIES gtest)
find_library(GOOGLETEST_GTEST_MAIN_LIBRARIES gtest_main)
find_library(GOOGLETEST_GMOCK_LIBRARIES gmock)
find_library(GOOGLETEST_GMOCK_MAIN_LIBRARIES gmock_main)

set(GOOGLETEST_LIBRARIES
${GOOGLETEST_GTEST_LIBRARIES}
${GOOGLETEST_GTEST_MAIN_LIBRARIES}
${GOOGLETEST_GMOCK_LIBRARIES}
${GOOGLETEST_GMOCK_MAIN_LIBRARIES}
)

find_package_handle_standard_args(googletest DEFAULT_MSG GOOGLETEST_LIBRARIES GOOGLETEST_INCLUDE_DIRS)

mark_as_advanced(GOOGLETEST_INCLUDE_DIRS GOOGLETEST_LIBRARIES)
10 changes: 10 additions & 0 deletions CMake/Findopenssl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
find_path(OPENSSL_INCLUDE_DIRS openssl/ssl.h openssl/crypto.h)

find_library(OPENSSL_SSL_LIBRARIES ssl)
find_library(OPENSSL_CRYPTO_LIBRARIES crypto)

set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})

find_package_handle_standard_args(openssl DEFAULT_MSG OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIRS)

mark_as_advanced(OPENSSL_INCLUDE_DIRS OPENSSL_LIBRARIES)
22 changes: 3 additions & 19 deletions CMake/Finduring.cmake
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
# * Find liburing Find the liburing library and includes
#
# URING_INCLUDE_DIR - where to find liburing.h, etc. URING_LIBRARIES - List of
# libraries when using uring. URING_FOUND - True if uring found.
find_path(URING_INCLUDE_DIRS liburing.h)

find_path(URING_INCLUDE_DIR liburing.h)
find_library(URING_LIBRARIES uring)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(uring DEFAULT_MSG URING_LIBRARIES
URING_INCLUDE_DIR)
find_package_handle_standard_args(uring DEFAULT_MSG URING_LIBRARIES URING_INCLUDE_DIRS)

if(URING_FOUND)
if(NOT TARGET uring)
add_library(uring UNKNOWN IMPORTED)
endif()
set_target_properties(
uring
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${URING_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${URING_LIBRARIES}")
mark_as_advanced(URING_LIBRARIES)
endif()
mark_as_advanced(URING_INCLUDE_DIRS URING_LIBRARIES)
7 changes: 7 additions & 0 deletions CMake/Findzlib.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
find_path(ZLIB_INCLUDE_DIRS zlib.h)

find_library(ZLIB_LIBRARIES z)

find_package_handle_standard_args(zlib DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)

mark_as_advanced(ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES)
75 changes: 75 additions & 0 deletions CMake/build-from-src.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Note: Be aware of the differences between CMake project and Makefile project.

set(actually_built)

function(build_from_src [dep])
if (dep STREQUAL "aio")
set(BINARY_DIR ${PROJECT_BINARY_DIR}/aio-build)
ExternalProject_Add(
aio
URL ${PHOTON_AIO_SOURCE}
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ""
BUILD_COMMAND make prefix=${BINARY_DIR} install -j
INSTALL_COMMAND ""
)
set(AIO_INCLUDE_DIRS ${BINARY_DIR}/include PARENT_SCOPE)
set(AIO_LIBRARIES ${BINARY_DIR}/lib/libaio.a PARENT_SCOPE)

elseif (dep STREQUAL "zlib")
set(BINARY_DIR ${PROJECT_BINARY_DIR}/zlib-build)
ExternalProject_Add(
zlib
URL ${PHOTON_ZLIB_SOURCE}
BUILD_IN_SOURCE ON
PATCH_COMMAND sed -ie "/CFLAGS.*CFLAGS--O3/ s/}/} -fPIC/" configure
CONFIGURE_COMMAND ./configure --prefix=${BINARY_DIR} --static
BUILD_COMMAND make -j
INSTALL_COMMAND make install
)
set(ZLIB_INCLUDE_DIRS ${BINARY_DIR}/include PARENT_SCOPE)
set(ZLIB_LIBRARIES ${BINARY_DIR}/lib/libz.a PARENT_SCOPE)

elseif (dep STREQUAL "uring")
set(BINARY_DIR ${PROJECT_BINARY_DIR}/uring-build)
ExternalProject_Add(
uring
GIT_REPOSITORY ${PHOTON_URING_SOURCE}
GIT_TAG liburing-2.3
GIT_PROGRESS ON
BUILD_IN_SOURCE ON
CONFIGURE_COMMAND ./configure --prefix=${BINARY_DIR}
BUILD_COMMAND make -C src -j
INSTALL_COMMAND make install
)
set(URING_INCLUDE_DIRS ${BINARY_DIR}/include PARENT_SCOPE)
set(URING_LIBRARIES ${BINARY_DIR}/lib/liburing.a PARENT_SCOPE)

elseif (dep STREQUAL "gflags")
ExternalProject_Add(
gflags
URL ${PHOTON_GFLAGS_SOURCE}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_POSITION_INDEPENDENT_CODE=ON
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(gflags BINARY_DIR)
set(GFLAGS_INCLUDE_DIRS ${BINARY_DIR}/include PARENT_SCOPE)
set(GFLAGS_LIBRARIES ${BINARY_DIR}/lib/libgflags.a ${BINARY_DIR}/lib/libgflags_nothreads.a PARENT_SCOPE)

elseif (dep STREQUAL "googletest")
ExternalProject_Add(
googletest
URL ${PHOTON_GOOGLETEST_SOURCE}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DINSTALL_GTEST=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(googletest SOURCE_DIR)
ExternalProject_Get_Property(googletest BINARY_DIR)
set(GOOGLETEST_INCLUDE_DIRS ${SOURCE_DIR}/googletest/include ${SOURCE_DIR}/googlemock/include PARENT_SCOPE)
set(GOOGLETEST_LIBRARIES ${BINARY_DIR}/lib/libgmock.a ${BINARY_DIR}/lib/libgmock_main.a
${BINARY_DIR}/lib/libgtest.a ${BINARY_DIR}/lib/libgtest_main.a PARENT_SCOPE)
endif ()

list(APPEND actually_built ${dep})
set(actually_built ${actually_built} PARENT_SCOPE)
endfunction()
Loading