diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9f081d1..6d979f7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -41,7 +41,7 @@ jobs: id: cache_key run: | cd scripts - python3 get_cache_key.py exiv2 || exit 1 + python3 get_cache_key.py fmt exiv2 || exit 1 - name: Cache id: cache uses: actions/cache@v4 @@ -52,6 +52,7 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: | cp scripts/build_*.sh -v ./ || exit 1 + ./build_fmt.sh || exit 1 ./build_exiv2.sh || exit 1 - name: Build run: | @@ -137,7 +138,7 @@ jobs: id: cache_key run: | cd scripts - python3 get_cache_key.py exiv2 libzip x264 ffmpeg rapidjson || exit 1 + python3 get_cache_key.py fmt exiv2 libzip x264 ffmpeg rapidjson || exit 1 - name: Cache id: cache uses: actions/cache@v4 @@ -152,6 +153,7 @@ jobs: run: | export PKG_CONFIG_PATH=`pwd`/clib/lib/pkgconfig cp scripts/build_*.sh -v ./ || exit 1 + ./build_fmt.sh || exit 1 ./build_exiv2.sh || exit 1 ./build_libzip.sh || exit 1 ./build_x264.sh || exit 1 @@ -186,7 +188,7 @@ jobs: id: cache_key run: | cd scripts - python get_cache_key.py --prefix=win zlib pkgconf expat exiv2 openssl libzip x264 ffmpeg rapidjson || exit 1 + python get_cache_key.py --prefix=win zlib pkgconf fmt expat exiv2 openssl libzip x264 ffmpeg rapidjson || exit 1 - name: Cache id: cache uses: actions/cache@v4 @@ -223,6 +225,11 @@ jobs: run: | COPY /Y scripts\build_win_pkgconf.bat || exit 1 CALL build_win_pkgconf.bat || exit 1 + - name: Build fmt + if: steps.cache.outputs.cache-hit != 'true' + run: | + COPY /Y scripts\build_win_fmt.bat || exit 1 + CALL build_win_fmt.bat || exit 1 - name: Build expat if: steps.cache.outputs.cache-hit != 'true' run: | diff --git a/.github/workflows/github-pages.yaml b/.github/workflows/github-pages.yaml index f0136d3..e53fc01 100644 --- a/.github/workflows/github-pages.yaml +++ b/.github/workflows/github-pages.yaml @@ -58,7 +58,7 @@ jobs: id: cache_key run: | cd scripts - python3 get_cache_key.py exiv2 libzip x264 ffmpeg rapidjson || exit 1 + python3 get_cache_key.py fmt exiv2 libzip x264 ffmpeg rapidjson || exit 1 - name: Cache id: cache uses: actions/cache@v4 @@ -73,6 +73,7 @@ jobs: run: | export PKG_CONFIG_PATH=`pwd`/clib/lib/pkgconfig cp scripts/build_*.sh -v ./ || exit 1 + ./build_fmt.sh || exit 1 ./build_exiv2.sh || exit 1 ./build_libzip.sh || exit 1 ./build_x264.sh || exit 1 diff --git a/Dockerfile b/Dockerfile index 07f1c75..51a9071 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,12 @@ RUN apt-get update && apt-get install -y \ RUN curl https://sh.rustup.rs -sSf | \ sh -s -- --default-toolchain nightly -y ENV PATH=/root/.cargo/bin:$PATH +RUN cd ~ && git clone --depth 1 'https://github.com/fmtlib/fmt' \ + && cd fmt && mkdir -p build && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release .. "-DCMAKE_INSTALL_PREFIX=/clib" \ + -DFMT_DOC=OFF -DFMT_TEST=OFF \ + && make -j$(grep -c ^processor /proc/cpuinfo) && make install \ + && cd ~ && rm -rf fmt RUN cd ~ && git clone --depth 1 'https://github.com/Exiv2/exiv2' \ && cd exiv2 && mkdir -p build && cd build \ && cmake -DCMAKE_BUILD_TYPE=Release .. "-DCMAKE_INSTALL_PREFIX=/clib" \ diff --git a/scripts/build_fmt.sh b/scripts/build_fmt.sh new file mode 100755 index 0000000..009032d --- /dev/null +++ b/scripts/build_fmt.sh @@ -0,0 +1,6 @@ +export PREFIX=`pwd`/clib +mkdir -p cbuild && cd cbuild || exit 1 +git clone --depth 1 'https://github.com/fmtlib/fmt' && cd fmt || exit 1 +mkdir -p build && cd build || exit 1 +cmake -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$PREFIX" -DFMT_DOC=OFF -DFMT_TEST=OFF ../ || exit 1 +make -j8 && make install || exit 1 diff --git a/scripts/build_win_fmt.bat b/scripts/build_win_fmt.bat new file mode 100644 index 0000000..2ef3ae7 --- /dev/null +++ b/scripts/build_win_fmt.bat @@ -0,0 +1,24 @@ +@ECHO OFF +SETLOCAL +SET TOP=%CD% +SET PREFIX=%CD%\clib +IF NOT EXIST cbuild ( + MD cbuild || EXIT /B 1 +) +CD cbuild || EXIT /B 1 +git clone --depth 1 "https://github.com/fmtlib/fmt" || EXIT /B %ERRORLEVEL% +CD fmt || EXIT /B %ERRORLEVEL% +IF NOT EXIST build ( + MD build || EXIT /B 1 +) +CD build || EXIT /B 1 +cmake ^ + -G Ninja ^ + -DCMAKE_PREFIX_PATH=%PREFIX% ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_INSTALL_PREFIX=%PREFIX% ^ + -DFMT_DOC=OFF ^ + -DFMT_TEST=OFF ^ + ../ || EXIT /B %ERRORLEVEL% +ninja && ninja install || ninja && ninja install || EXIT /B %ERRORLEVEL% +ENDLOCAL \ No newline at end of file diff --git a/scripts/get_cache_key.py b/scripts/get_cache_key.py index dab099e..da14630 100644 --- a/scripts/get_cache_key.py +++ b/scripts/get_cache_key.py @@ -7,7 +7,7 @@ from time import gmtime, time, strftime from typing import List -ALL_FEATURES = ['exiv2', 'expat', 'ffmpeg', 'libzip', 'openssl', 'pkgconf', 'rapidjson', 'x264', 'zlib'] +ALL_FEATURES = ['exiv2', 'expat', 'ffmpeg', 'fmt', 'libzip', 'openssl', 'pkgconf', 'rapidjson', 'x264', 'zlib'] def sha256(data) -> str: if isinstance(data, str):