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

ci: Support windows #5

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
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
26 changes: 25 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,22 @@ jobs:
with:
update: true
install: >-
mingw-w64-x86_64-git
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-autotools
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gcc
mingw-w64-x86_64-make
mingw-w64-x86_64-python-pip
python-setuptools
mingw-w64-x86_64-python-pytest
mingw-w64-x86_64-ninja
git
automake1.16
automake-wrapper
autoconf
autoconf-wrapper
libtool
make

- name: Install build tools (macos-latest)
if: matrix.sys.os == 'macos-latest'
Expand All @@ -79,13 +87,29 @@ jobs:
- name: Check build tools
run: |
which cmake
cmake --version
which make
make --version
which autoreconf
autoreconf --version
which python
python --version

- name: Check CMake configuration
run: |
cmake -S . -B build
rm -rf build

- name: Install package
if: matrix.sys.os != 'windows-latest'
run: python -m pip install -e .[test]

- name: Install package
if: matrix.sys.os == 'windows-latest'
run: |
#export PATH="/mingw64/bin:/usr/bin:/bin:/usr/local/bin:/opt/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:$PATH"
python -m pip install -e .[test]

- name: Uninstall magic (linux)
if: matrix.sys.os == 'ubuntu-latest'
run: |
Expand Down
20 changes: 18 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,32 @@ set(CMAKE_MACOSX_RPATH 1)

set(libmagic_PREFIX libmagic)

find_program(MAKE_EXE NAMES make gmake nmake)
if (NOT MAKE_EXE)
message(FATAL_ERROR "make not found")
else()
message(STATUS "Found make: ${MAKE_EXE}")
endif()


find_program(AUTORECONF NAMES autoreconf)
if (NOT AUTORECONF)
message(FATAL_ERROR "autoreconf not found")
else()
message(STATUS "Found autoreconf: ${AUTORECONF}")
endif()


include(GNUInstallDirs)
include(ExternalProject)
ExternalProject_Add(libmagic
GIT_REPOSITORY https://github.com/file/file.git
GIT_TAG FILE5_41
PREFIX ${libmagic_PREFIX}
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND autoreconf -f -i && ./configure --prefix=<INSTALL_DIR> --libdir=<INSTALL_DIR>/${CMAKE_INSTALL_LIBDIR} --datadir=<INSTALL_DIR>/${CMAKE_INSTALL_DATADIR}
CONFIGURE_COMMAND ${AUTORECONF} -f -i && ./configure --prefix=<INSTALL_DIR> --libdir=<INSTALL_DIR>/${CMAKE_INSTALL_LIBDIR} --datadir=<INSTALL_DIR>/${CMAKE_INSTALL_DATADIR}
BUILD_COMMAND ${MAKE_EXE}
INSTALL_COMMAND ${MAKE_EXE}
INSTALL_COMMAND ${MAKE_EXE} install
)

if(SKBUILD)
Expand Down