initial commit
parent
80ffb0a5e7
commit
07a877af18
|
@ -0,0 +1,72 @@
|
|||
# ---> SCons
|
||||
# for projects that use SCons for building: http://http://www.scons.org/
|
||||
.sconsign.dblite
|
||||
|
||||
# ---> C
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.os
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
|
||||
# binary files
|
||||
bin/
|
||||
# test files
|
||||
assets/
|
||||
# custom build tracking
|
||||
compile_commands.json
|
||||
# logs and some custom thoughts
|
||||
log
|
||||
thoughts
|
||||
|
||||
*.swp
|
||||
vgcore.*
|
||||
*.pdf
|
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
import re
|
||||
|
||||
if sys.version_info < (3,):
|
||||
def isbasestring(s):
|
||||
return isinstance(s,basestring)
|
||||
else:
|
||||
def isbasestring(s):
|
||||
return isinstance(s, (str,bytes))
|
||||
|
||||
def add_kel_source_files(self, sources, filetype, lib_env=None, shared=False, target_post=""):
|
||||
|
||||
if isbasestring(filetype):
|
||||
dir_path = self.Dir('.').abspath
|
||||
filetype = sorted(glob.glob(dir_path+"/"+filetype))
|
||||
|
||||
for path in filetype:
|
||||
target_name = re.sub( r'(.*?)(\.cpp|\.c\+\+)', r'\1' + target_post, path )
|
||||
if shared:
|
||||
target_name+='.os'
|
||||
sources.append( self.SharedObject( target=target_name, source=path ) )
|
||||
else:
|
||||
target_name+='.o'
|
||||
sources.append( self.StaticObject( target=target_name, source=path ) )
|
||||
pass
|
||||
|
||||
env=Environment(CPPPATH=['#source','#','#driver'],
|
||||
CXX='c++',
|
||||
CPPDEFINES=['GIN_UNIX'],
|
||||
CXXFLAGS=['-std=c++17','-g','-Wall','-Wextra'],
|
||||
LIBS=[])
|
||||
env.__class__.add_source_files = add_kel_source_files
|
||||
|
||||
env.sources = []
|
||||
env.headers = []
|
||||
env.objects = []
|
||||
|
||||
Export('env')
|
||||
SConscript('source/SConscript')
|
||||
SConscript('driver/SConscript')
|
||||
|
||||
# Library build
|
||||
|
||||
env_library = env.Clone()
|
||||
|
||||
env.objects_shared = []
|
||||
env_library.add_source_files(env.objects_shared, env.sources, shared=True)
|
||||
env.library_shared = env_library.SharedLibrary('#bin/kelgin-window', [env.objects_shared])
|
||||
|
||||
env.objects_static = []
|
||||
env_library.add_source_files(env.objects_static, env.sources)
|
||||
env.library_static = env_library.StaticLibrary('#bin/kelgin-window', [env.objects_static])
|
||||
|
||||
env.Alias('library', [env.library_shared, env.library_static])
|
||||
env.Alias('library_shared', env.library_shared)
|
||||
env.Alias('library_static', env.library_static)
|
||||
|
||||
env.Default('library')
|
||||
|
||||
# Tests
|
||||
SConscript('test/SConscript')
|
||||
|
||||
env.Alias('test', env.test_program)
|
||||
|
||||
# Clang format part
|
||||
env.Append(BUILDERS={'ClangFormat' : Builder(action = 'clang-format --style=file -i $SOURCE')})
|
||||
env.format_actions = []
|
||||
def format_iter(env,files):
|
||||
for f in files:
|
||||
env.format_actions.append(env.AlwaysBuild(env.ClangFormat(target=f+"-clang-format",source=f)))
|
||||
pass
|
||||
|
||||
format_iter(env,env.sources + env.headers)
|
||||
|
||||
env.Alias('format', env.format_actions)
|
||||
|
||||
env.Alias('all', ['format', 'library_shared', 'library_static', 'test'])
|
||||
|
||||
env.Install('/usr/local/lib/', [env.library_shared, env.library_static])
|
||||
env.Install('/usr/local/include/kelgin/window/', [env.headers])
|
||||
env.Alias('install', '/usr/local/')
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/false
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
|
||||
|
||||
Import('env')
|
||||
|
||||
dir_path = Dir('.').abspath
|
||||
|
||||
env.sources += sorted(glob.glob(dir_path + "/*.cpp"))
|
||||
env.headers += sorted(glob.glob(dir_path + "/*.h"))
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/false
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
|
||||
|
||||
Import('env')
|
||||
|
||||
dir_path = Dir('.').abspath
|
||||
|
||||
env.sources += sorted(glob.glob(dir_path + "/*.cpp"))
|
||||
env.headers += sorted(glob.glob(dir_path + "/*.h"))
|
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include <kelgin/common.h>
|
||||
|
||||
namespace gin {
|
||||
class Window {
|
||||
public:
|
||||
virtual ~Window() = default;
|
||||
};
|
||||
|
||||
class Device {
|
||||
public:
|
||||
virtual ~Device() = default;
|
||||
|
||||
virtual Own<Window> createWindow();
|
||||
};
|
||||
|
||||
Own<Device> createDevice();
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
|
||||
Import('env')
|
||||
|
||||
dir_path = Dir('.').abspath
|
||||
env.test_sources = sorted(glob.glob(dir_path + "/*.cpp"))
|
||||
|
||||
env_test = env.Clone()
|
||||
env_test.Append(CPPDEFINES=['GIN_COMPILE_TEST_BINARY'])
|
||||
env.test_objects = []
|
||||
env.test_sources.append(dir_path+'/suite/suite.cpp')
|
||||
|
||||
env.test_program = env_test.Program('#bin/test', [env.test_sources, env.library_static])
|
Loading…
Reference in New Issue