Skip to content

Commit

Permalink
CI optimization and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Mar 9, 2024
1 parent addb76e commit ae97d28
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
- name: Install packages
run: |
brew install \
bison flex gnu-sed bash boost double-conversion jemalloc fmt glog pkg-config ccache
bison flex gnu-sed bash boost double-conversion jemalloc glog pkg-config ccache fmt
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- { scope: 'MKD', tests: 'OFF' }

include:
- config: { os: ubuntu-20.04, env: { CC: clang-12, CXX: clang++-12 }, build_type: Debug, extra_opts: '-DENABLE_ASAN=1' }
- config: { os: ubuntu-20.04, env: { CC: clang-12, CXX: clang++-12 }, build_type: RelWithDebInfo, extra_opts: '-DENABLE_ASAN=1' }
setup: { scope: 'ALL', tests: 'ON' }
- config: { os: ubuntu-20.04, env: { CC: clang-12, CXX: clang++-12 }, build_type: RelWithDebInfo, extra_opts: '-DENABLE_TSAN=1' }
setup: { scope: 'ALL', tests: 'ON' }
Expand All @@ -97,7 +97,7 @@ jobs:
run: |
sudo apt-get -y update
sudo apt-get -y install \
binutils-dev libevent-dev acl-dev libfmt-dev libjemalloc-dev ccache \
binutils-dev libevent-dev acl-dev libjemalloc-dev libfmt-dev ccache \
libdouble-conversion-dev libiberty-dev liblz4-dev libssl-dev liblzma-dev \
libunwind-dev libdwarf-dev libelf-dev libgoogle-glog-dev libutfcpp-dev \
libboost-filesystem-dev libboost-program-options-dev libboost-system-dev \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-msys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ env:

jobs:
build:
name: windows-msys [${{ matrix.env.CC }}, ${{ matrix.setup.scope }}]
name: windows-msys [${{ matrix.env.CC }}, scope ${{ matrix.setup.scope }}, Release]
runs-on: windows-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -107,8 +107,8 @@ jobs:
diffutils:p
libevent:p
double-conversion:p
glog:p
fmt:p
glog:p
dlfcn:p
ninja:p
ccache:p
Expand Down
28 changes: 17 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ set(IS_MSYS OFF)
if(MSVC)
set(OSTYPE_TXT "Windows")
message(STATUS "OSTYPE (forced by MSVC): '${OSTYPE_TXT}'")
set(PREFER_SYSTEM_LIBFMT ON)
elseif(MINGW)
set(OSTYPE_TXT "msys")
message(STATUS "OSTYPE (forced by MINGW): '${OSTYPE_TXT}'")
Expand Down Expand Up @@ -351,6 +352,7 @@ else()
GIT_TAG 10.1.0
)
FetchContent_MakeAvailable(fmt)
include_directories(${fmt_SOURCE_DIR}/include)
endif()

find_package(Boost 1.67 REQUIRED COMPONENTS chrono iostreams program_options)
Expand Down Expand Up @@ -380,6 +382,9 @@ if(PKG_CONFIG_FOUND)
endif(MSVC)
pkg_check_modules(ZSTD IMPORTED_TARGET libzstd>=1.5.2)
pkg_check_modules(XXHASH IMPORTED_TARGET libxxhash>=0.8.1)
if(PREFER_SYSTEM_LIBFMT)
pkg_check_modules(FMT IMPORTED_TARGET libfmt>=10.1.0)
endif()
endif()

if(XXHASH_FOUND)
Expand Down Expand Up @@ -565,6 +570,7 @@ list(

if(DWARFS_GIT_BUILD)
list(APPEND LIBDWARFS_SRC ${CMAKE_CURRENT_BINARY_DIR}/src/dwarfs/version.cpp)
include_directories(dwarfs PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include)
else()
list(APPEND LIBDWARFS_SRC src/dwarfs/version.cpp)
endif()
Expand All @@ -588,25 +594,20 @@ add_library(dwarfs ${LIBDWARFS_SRC})
add_library(dwarfs_compression ${LIBDWARFS_COMPRESSION_SRC})
add_library(dwarfs_tool src/dwarfs/tool.cpp)

if(DWARFS_GIT_BUILD)
target_include_directories(dwarfs PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/include)
endif()
# [maxirmx] For me it does not make sense but is required on Ubuntu 20.04 (gcc 10.5)
target_link_libraries(dwarfs_tool dwarfs)

target_compile_definitions(
dwarfs_tool PRIVATE PRJ_BUILD_ID="${CMAKE_SYSTEM_PROCESSOR}, ${CMAKE_SYSTEM}, ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}"
)

target_link_libraries(dwarfs_compression folly)
target_link_libraries(dwarfs_tool dwarfs)

if(STATIC_BUILD_DO_NOT_USE)
add_link_options(-static -static-libgcc)
endif(STATIC_BUILD_DO_NOT_USE)

if("${TEBAKO_BUILD_SCOPE}" STREQUAL "ALL" OR
"${TEBAKO_BUILD_SCOPE}" STREQUAL "MKD")
add_library(mkdwarfs_main src/mkdwarfs_main.cpp)
target_link_libraries(mkdwarfs_main folly)

add_executable(mkdwarfs src/mkdwarfs.cpp)
target_link_libraries(mkdwarfs mkdwarfs_main)
Expand All @@ -622,10 +623,6 @@ if("${TEBAKO_BUILD_SCOPE}" STREQUAL "ALL")
add_library(dwarfsbench_main src/dwarfsbench_main.cpp)
add_library(dwarfsextract_main src/dwarfsextract_main.cpp)

target_link_libraries(dwarfsck_main folly)
target_link_libraries(dwarfsbench_main folly)
target_link_libraries(dwarfsextract_main folly)

add_executable(dwarfsck src/dwarfsck.cpp)
add_executable(dwarfsbench src/dwarfsbench.cpp)
add_executable(dwarfsextract src/dwarfsextract.cpp)
Expand Down Expand Up @@ -950,6 +947,9 @@ foreach(tgt dwarfs dwarfs_compression dwarfs_tool ${BINARY_TARGETS} ${MAIN_TARGE
set_property(TARGET ${tgt} PROPERTY CXX_EXTENSIONS OFF)

add_dependencies(${tgt} metadata_thrift)
if (NOT ("${OSTYPE_TXT}" MATCHES "Windows"))
add_dependencies(${tgt} ${LIBARCHIVE_PRJ})
endif()

if(ENABLE_ASAN)
target_compile_options(${tgt} PRIVATE -fsanitize=address
Expand Down Expand Up @@ -1007,6 +1007,12 @@ list(APPEND LIBRARIES
${Boost_LIBRARIES}
)

if(PREFER_SYSTEM_LIBFMT)
list(APPEND LIBRARIES PkgConfig::FMT)
else()
list(APPEND LIBRARIES fmt)
endif()

if(LIBLZ4_FOUND)
list(APPEND LIBRARIES PkgConfig::LIBLZ4)
endif()
Expand Down

0 comments on commit ae97d28

Please sign in to comment.