Reputation: 10936
I want to use scons for the building process of a small game I wrote. https://github.com/Dobiasd/Dron
I generally works including the recursion through the source directories, but I would like to not pollute src directory with .o files. VariantDir
should help me, but the following SConstruct
does not work (.o files still in ./src)
import fnmatch
import os
matches = []
for root, dirnames, filenames in os.walk('src/'):
for filename in filenames:
if fnmatch.fnmatch(filename, '*.cpp'):
matches.append(str(os.path.join(root, filename)))
env = Environment()
env.Append(LIBS = ['sfml-audio', 'sfml-graphics','sfml-window','sfml-system'])
env.Append(LIBPATH = '/usr/local/lib')
env.Append(CXXFLAGS = '-std=c++11 -Wall -Wextra -pedantic -Werror')
env.VariantDir('build', 'src')
env.Program(target = 'Dron', source = matches)
compilation (my expectation):
g++ -o obj/main.o -c -std=c++11 -Wall -Wextra -pedantic -Werror src/main.cpp
compilation (reality):
g++ -o src/main.o -c -std=c++11 -Wall -Wextra -pedantic -Werror src/main.cpp
It would be great if someone could tell me what I am doing wrong. :)
Upvotes: 2
Views: 1283