Alibek Omarov
5 years ago
3 changed files with 0 additions and 147 deletions
@ -1,10 +0,0 @@
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env |
||||
from waflib.TaskGen import feature, after_method |
||||
|
||||
@feature('c', 'cxx') |
||||
@after_method('apply_flags_msvc') |
||||
def make_pdb_unique(self): |
||||
for t in self.compiled_tasks: |
||||
pdb_unique_cflag = '/Fd' + t.outputs[0].change_ext('.pdb').abspath() |
||||
t.env.append_value('CFLAGS', pdb_unique_cflag) |
||||
t.env.append_value('CXXFLAGS', pdb_unique_cflag) |
@ -1,88 +0,0 @@
@@ -1,88 +0,0 @@
|
||||
# encoding: utf-8 |
||||
# sdl2.py -- sdl2 waf plugin |
||||
# Copyright (C) 2018 a1batross |
||||
# This program is free software: you can redistribute it and/or modify |
||||
# it under the terms of the GNU General Public License as published by |
||||
# the Free Software Foundation, either version 3 of the License, or |
||||
# (at your option) any later version. |
||||
# |
||||
# This program is distributed in the hope that it will be useful, |
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
# GNU General Public License for more details. |
||||
|
||||
import os |
||||
|
||||
def options(opt): |
||||
grp = opt.add_option_group('SDL2 options') |
||||
grp.add_option('-s', '--sdl2', action='store', dest = 'SDL2_PATH', default = None, |
||||
help = 'path to precompiled SDL2 library(required for Windows)') |
||||
|
||||
grp.add_option('--skip-sdl2-sanity-check', action='store_false', default = True, dest='SDL2_SANITY_CHECK', |
||||
help = 'skip checking SDL2 sanity') |
||||
|
||||
def my_dirname(path): |
||||
# really dumb, will not work with /path/framework//, but still enough |
||||
if path[-1] == '/': |
||||
path = path[:-1] |
||||
return os.path.dirname(path) |
||||
|
||||
def sdl2_configure_path(conf, path): |
||||
conf.env.HAVE_SDL2 = 1 |
||||
if conf.env.DEST_OS == 'darwin': |
||||
conf.env.INCLUDES_SDL2 = [ |
||||
os.path.abspath(os.path.join(path, 'Headers')) |
||||
] |
||||
conf.env.FRAMEWORKPATH_SDL2 = [my_dirname(path)] |
||||
conf.env.FRAMEWORK_SDL2 = ['SDL2'] |
||||
else: |
||||
conf.env.INCLUDES_SDL2 = [ |
||||
os.path.abspath(os.path.join(path, 'include')), |
||||
os.path.abspath(os.path.join(path, 'include/SDL2')) |
||||
] |
||||
libpath = 'lib' |
||||
if conf.env.COMPILER_CC == 'msvc': |
||||
if conf.env.DEST_CPU == 'x86_64': |
||||
libpath = 'lib/x64' |
||||
else: |
||||
libpath = 'lib/' + conf.env.DEST_CPU |
||||
conf.env.LIBPATH_SDL2 = [os.path.abspath(os.path.join(path, libpath))] |
||||
conf.env.LIB_SDL2 = ['SDL2'] |
||||
|
||||
def configure(conf): |
||||
if conf.options.SDL2_PATH: |
||||
conf.start_msg('Configuring SDL2 by provided path') |
||||
sdl2_configure_path(conf, conf.options.SDL2_PATH) |
||||
conf.end_msg('yes: {0}, {1}, {2}'.format(conf.env.LIB_SDL2, conf.env.LIBPATH_SDL2, conf.env.INCLUDES_SDL2)) |
||||
else: |
||||
try: |
||||
conf.check_cfg( |
||||
path='sdl2-config', |
||||
args='--cflags --libs', |
||||
package='', |
||||
msg='Checking for library SDL2', |
||||
uselib_store='SDL2') |
||||
except conf.errors.ConfigurationError: |
||||
conf.env.HAVE_SDL2 = 0 |
||||
|
||||
if not conf.env.HAVE_SDL2 and conf.env.CONAN: |
||||
conf.load('conan') |
||||
conf.add_conan_remote('bincrafters', 'https://api.bintray.com/conan/bincrafters/public-conan') |
||||
conf.add_dependency('sdl2/2.0.9@bincrafters/stable', options = { 'shared': 'True' } ) |
||||
|
||||
if conf.env.HAVE_SDL2 and conf.options.SDL2_SANITY_CHECK: |
||||
try: |
||||
conf.check_cc( |
||||
fragment=''' |
||||
#define SDL_MAIN_HANDLED |
||||
#include <SDL.h> |
||||
int main( void ) |
||||
{ |
||||
SDL_Init( SDL_INIT_EVERYTHING ); |
||||
return 0; |
||||
}''', |
||||
msg = 'Checking for library SDL2 sanity', |
||||
use = 'SDL2', |
||||
execute = False) |
||||
except conf.errors.ConfigurationError: |
||||
conf.env.HAVE_SDL2 = 0 |
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
#! /usr/bin/env python |
||||
# Modified: Alibek Omarov <a1ba.omarov@gmail.com> |
||||
# Originally taken from Thomas Nagy's blogpost |
||||
|
||||
""" |
||||
Strip executables upon installation |
||||
""" |
||||
|
||||
import shutil, os |
||||
from waflib import Build, Utils, Context, Errors, Logs |
||||
|
||||
def options(opt): |
||||
grp = opt.option_groups['install/uninstall options'] |
||||
grp.add_option('--no-strip', dest='no_strip', action='store_true', default=False, |
||||
help='don\'t strip binaries. You must pass this flag to install command(default: False)') |
||||
|
||||
def configure(conf): |
||||
if conf.env.DEST_BINFMT in ['elf', 'mac-o']: |
||||
conf.find_program('strip', var='STRIP') |
||||
if not conf.env.STRIPFLAGS: |
||||
conf.env.STRIPFLAGS = os.environ['STRIPFLAGS'] if 'STRIPFLAGS' in os.environ else [] |
||||
|
||||
def copy_fun(self, src, tgt): |
||||
inst_copy_fun(self, src, tgt) |
||||
|
||||
if self.generator.bld.options.no_strip: |
||||
return |
||||
|
||||
if self.env.DEST_BINFMT not in ['elf', 'mac-o']: # don't strip unknown formats or PE |
||||
return |
||||
|
||||
if getattr(self.generator, 'link_task', None) and self.generator.link_task.outputs[0] in self.inputs: |
||||
cmd = self.env.STRIP + self.env.STRIPFLAGS + [tgt] |
||||
try: |
||||
self.generator.bld.cmd_and_log(cmd, output=Context.BOTH, quiet=Context.BOTH) |
||||
if not self.generator.bld.progress_bar: |
||||
c1 = Logs.colors.NORMAL |
||||
c2 = Logs.colors.CYAN |
||||
|
||||
f1 = os.path.getsize(src) |
||||
f2 = os.path.getsize(tgt) |
||||
|
||||
Logs.info('%s+ strip %s%s%s (%d bytes change)', c1, c2, tgt, c1, f2 - f1) |
||||
except Errors.WafError as e: |
||||
print(e.stdout, e.stderr) |
||||
|
||||
inst_copy_fun = Build.inst.copy_fun |
||||
Build.inst.copy_fun = copy_fun |
||||
|
Loading…
Reference in new issue