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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
graft nes_py/cpp
1+
graft nes_py/nes

makefile

+3-1
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

+32
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
# The source files for building the extension. Globs locate all the cpp files
1515
# used by the LaiNES subproject. MANIFEST.in has to include the blanket
1616
# "cpp" directory to ensure that the .inc file gets included too
17-
SOURCES = glob('nes_py/cpp/*.cpp') + glob('nes_py/cpp/mappers/*.cpp')
17+
SOURCES = glob('nes_py/nes/src/*.cpp') + glob('nes_py/nes/src/mappers/*.cpp')
1818
# The directory pointing to header files used by the LaiNES cpp files.
1919
# This directory has to be included using MANIFEST.in too to include the
2020
# headers with sdist
21-
INCLUDE_DIRS = ['nes_py/cpp/include']
21+
INCLUDE_DIRS = ['nes_py/nes/include']
2222
# Build arguments to pass to the compiler
2323
EXTRA_COMPILE_ARGS = [
2424
'-std=c++1y',

0 commit comments

Comments
 (0)