premake / premake/premake-core

files and removefiles not working inside a filter

Open
#1,907 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

support-request
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

Before opening a new issue, please use the issue search feature to see if a similar issue already exists. If not, please help us help you by filling in the template below.

What are you trying to do?
I'm trying to build a library that has separate files for all platforms

What problem are you having?
When using files inside a filter no files are added and when using removefiles inside a filter no files are removed

What have you tried so far?
When using files inside a filter did not work I tried using removefiles inside a filter
What version of Premake are you using?
5.0.0-dev

Anything else we should know?
An example:

project "hidapi"
	kind "StaticLib"
	language "C"

	location "../projects/hidapi"

	includedirs {"../externals/hidapi/hidapi/"}

	files {"../externals/hidapi/hidapi/hidapi.h", "../externals/hidapi/linux/hid.c", "../externals/hidapi/windows/hid.c", "../externals/hidapi/windows/hidapi_winapi.h"}

	filter "system:linux"
		removefiles {"../externals/hidapi/windows/hid.c", "../externals/hidapi/windows/hidapi_winapi.h"}

	filter "system:windows"
		removefiles {"../externals/hidapi/linux/**"}

here, the windows files aren't removed on linux and the linux files aren't removed on windows

(You can now support Premake on our OpenCollective. Your contributions help us spend more time responding to issues like these!)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the provided Premake project and platform-specific filter example. Check how files and removefiles are processed within system filters, then verify that each platform excludes the other platform's files while retaining its own files.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.