mirror of
https://github.com/QuasarApp/pe-parse.git
synced 2025-04-26 12:24:32 +00:00
More Windows compatibility (#75)
* Attempt to make setup.py more platform independent * Fix markdown * Fix cmake config for pre-Windows 10 installations * Fix Travis build
This commit is contained in:
parent
766b183a1b
commit
a8f7da7a2b
@ -1,5 +1,5 @@
|
||||
find_path(PEPARSE_INCLUDE_DIR "parser-library/parse.h")
|
||||
find_library(PEPARSE_LIBRARIES NAMES "libpe-parser-library")
|
||||
find_path(PEPARSE_INCLUDE_DIR $<SHELL_PATH:"parser-library/parse.h">)
|
||||
find_library(PEPARSE_LIBRARIES NAMES "libpe-parser-library" "pe-parser-library")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(peparse DEFAULT_MSG PEPARSE_INCLUDE_DIR PEPARSE_LIBRARIES)
|
||||
|
@ -7,11 +7,38 @@ Building
|
||||
If you can build pe-parse and have a working python environment (headers and
|
||||
libraries) you can build pepy.
|
||||
|
||||
Python 2.7
|
||||
----------
|
||||
1. Build pepy:
|
||||
* python setup.py build
|
||||
2. Install pepy:
|
||||
* python setup.py install
|
||||
|
||||
**Building on Windows:** If you get a build error of 'Unable to find
|
||||
vcvarsall.bat', you must set the `VS90COMNTOOLS` environment variable prior
|
||||
to the appropriate path as per
|
||||
[this SO article](http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat):
|
||||
> While running setup.py for package installations, Python 2.7 searches for an
|
||||
> installed Visual Studio 2008. You can trick Python to use a newer Visual
|
||||
> Studio by setting the correct path in VS90COMNTOOLS environment variable
|
||||
> before calling setup.py.
|
||||
>
|
||||
> Execute the following command based on the version of Visual Studio installed:
|
||||
> * Visual Studio 2010 (VS10): `SET VS90COMNTOOLS=%VS100COMNTOOLS%`
|
||||
> * Visual Studio 2012 (VS11): `SET VS90COMNTOOLS=%VS110COMNTOOLS%`
|
||||
> * Visual Studio 2013 (VS12): `SET VS90COMNTOOLS=%VS120COMNTOOLS%`
|
||||
> * Visual Studio 2015/2017 (VS14): `SET VS90COMNTOOLS=%VS140COMNTOOLS%`
|
||||
|
||||
Python 3.x
|
||||
----------
|
||||
1. Build pepy:
|
||||
* python3 setup.py build
|
||||
2. Install pepy:
|
||||
* python3 setup.py install
|
||||
|
||||
**Building on Windows:** Python 3.x is typically installed as _python.exe_
|
||||
**NOT** _python3.exe_.
|
||||
|
||||
Using
|
||||
=====
|
||||
Parsed object
|
||||
|
@ -24,19 +24,36 @@
|
||||
# SUCH DAMAGE.
|
||||
|
||||
from distutils.core import setup, Extension
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
SOURCE_FILES = [os.path.join(here, 'pepy.cpp'),
|
||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'src', 'parse.cpp')),
|
||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'src', 'buffer.cpp'))]
|
||||
|
||||
if platform.system() == 'Windows':
|
||||
INCLUDE_DIRS = [os.path.abspath(os.path.join(os.path.dirname(sys.executable), 'include')),
|
||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'include')),
|
||||
'C:\\usr\\include']
|
||||
LIBRARY_DIRS = [os.path.abspath(os.path.join(os.path.dirname(sys.executable), 'libs')),
|
||||
'C:\\usr\\lib']
|
||||
COMPILE_ARGS = ["/EHsc"]
|
||||
else:
|
||||
INCLUDE_DIRS = ['/usr/local/include',
|
||||
'/opt/local/include',
|
||||
'/usr/include',
|
||||
'../pe-parser-library/include']
|
||||
os.path.abspath(os.path.join(here, '..', 'pe-parser-library', 'include'))]
|
||||
LIBRARY_DIRS = ['/usr/lib',
|
||||
'/usr/local/lib']
|
||||
COMPILE_ARGS = ["-std=c++11", "-g", "-O0"] # Debug only
|
||||
|
||||
extension_mod = Extension('pepy',
|
||||
sources = ['pepy.cpp',
|
||||
'../pe-parser-library/src/parse.cpp',
|
||||
'../pe-parser-library/src/buffer.cpp'],
|
||||
extra_compile_args = ["-std=c++11", "-g", "-O0"], # Debug only
|
||||
sources = SOURCE_FILES,
|
||||
extra_compile_args = COMPILE_ARGS,
|
||||
language='c++',
|
||||
include_dirs = INCLUDE_DIRS,
|
||||
library_dirs = LIBRARY_DIRS)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user