Skip to content

Commit 1abddd9

Browse files
committed
reorganize NES C++ code
1 parent 9fffbee commit 1abddd9

33 files changed

+38
-4
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
graft nes_py/cpp
1+
graft nes_py/nes

makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ all: test deployment
1111

1212
# build the LaiNES CPP code
1313
lib_nes_env:
14-
scons
14+
cd nes_py/nes && scons
15+
mv nes_py/nes/lib_nes_env*.so nes_py
1516

1617
# run the Python test suite
1718
test: lib_nes_env
@@ -28,6 +29,7 @@ clean:
2829
rm nes_py/lib_nes_env.so || true
2930
find . -name "*.pyc" -delete
3031
find . -name "__pycache__" -delete
32+
find . -name ".sconsign.dblite" -delete
3133

3234
# build the deployment package
3335
deployment: clean

nes_py/nes/SConstruct

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""The compilation script for this project using SCons."""
2+
from os import environ
3+
4+
5+
# create a separate build directory
6+
VariantDir('build', 'src', duplicate=0)
7+
8+
9+
# the compiler and linker flags for the C++ environment
10+
FLAGS = [
11+
'-std=c++1y',
12+
'-O2',
13+
'-march=native',
14+
'-pipe',
15+
]
16+
17+
18+
# Create the C++ environment
19+
ENV = Environment(
20+
ENV=environ,
21+
CXX='clang++',
22+
CPPFLAGS=['-Wno-unused-value'],
23+
CXXFLAGS=FLAGS,
24+
LINKFLAGS=FLAGS,
25+
CPPPATH=['#include'],
26+
)
27+
28+
29+
# Locate all the C++ source files
30+
SRC = Glob('build/*.cpp') + Glob('build/*/*.cpp')
31+
# Create a shared library (it will add "lib" to the front automatically)
32+
ENV.SharedLibrary('_nes_env.so', SRC)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)