diff options
author | 杨宇千 <crupest@outlook.com> | 2019-07-10 17:23:29 +0800 |
---|---|---|
committer | 杨宇千 <crupest@outlook.com> | 2019-07-10 17:23:29 +0800 |
commit | d163bafa461779a3795818aa8c8b5238880ede24 (patch) | |
tree | 9eadf181655e293158cab095bb688cad9c0b1f18 | |
parent | e37dd256e5bca4caf819d18c73cd2d11e06683df (diff) | |
download | cru-d163bafa461779a3795818aa8c8b5238880ede24.tar.gz cru-d163bafa461779a3795818aa8c8b5238880ede24.tar.bz2 cru-d163bafa461779a3795818aa8c8b5238880ede24.zip |
...
-rw-r--r-- | .gitignore | 60 | ||||
-rw-r--r-- | include/cru/common/event.hpp | 3 | ||||
-rw-r--r-- | tools/generate_clang_complete.py | 43 | ||||
-rw-r--r-- | tools/win_build.py | 17 |
4 files changed, 120 insertions, 3 deletions
@@ -530,4 +530,62 @@ healthchecksdb # Backup folder for Package Reference Convert tool in Visual Studio 2017 MigrationBackup/ -# End of https://www.gitignore.io/api/c++,cmake,python,visualstudio,visualstudiocode
\ No newline at end of file +# End of https://www.gitignore.io/api/c++,cmake,python,visualstudio,visualstudiocode + +# Created by https://www.gitignore.io/api/emacs +# Edit at https://www.gitignore.io/?templates=emacs + +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +# network security +/network-security.data + + +# End of https://www.gitignore.io/api/emacs + +.clang_complete diff --git a/include/cru/common/event.hpp b/include/cru/common/event.hpp index d08bcbea..2e4b82b4 100644 --- a/include/cru/common/event.hpp +++ b/include/cru/common/event.hpp @@ -17,7 +17,7 @@ namespace details { // It erases event args types and provides a // unified form to create event revoker and // revoke(remove) handler. -class EventBase : private SelfResovable<EventBase> { +class EventBase : public SelfResovable<EventBase> { friend EventRevoker; protected: @@ -116,6 +116,7 @@ struct IEvent { // It stores a list of event handlers. template <typename TEventArgs> class Event : public details::EventBase, public IEvent<TEventArgs> { + using typename IEvent<TEventArgs>::EventHandler; private: struct HandlerData { HandlerData(EventHandlerToken token, EventHandler handler) diff --git a/tools/generate_clang_complete.py b/tools/generate_clang_complete.py new file mode 100644 index 00000000..44da60f3 --- /dev/null +++ b/tools/generate_clang_complete.py @@ -0,0 +1,43 @@ +import os +import os.path + +clang_complete_file_name = '.clang_complete' + +# project root dir +project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +os.chdir(project_root) + +global_std_standard = 'c++17' # change this to change standard +global_std_standard_arg = '-std={}'.format(global_std_standard) + +global_include_paths = [ + os.path.abspath('include') +] + +global_definitions = [] + + +def generate_clang_complete_content(additional_include_paths=[], additional_definitions=[]): + include_args = [ + '-I{}'.format(path) for path in additional_include_paths + global_include_paths] + definition_args = [ + '-D{}'.format(definition) for definition in additional_definitions + global_definitions] + args = [global_std_standard_arg] + include_args + definition_args + return '\n'.join(args) + + +def generate_root_clang_complete(): + with open(os.path.join('src/', clang_complete_file_name), 'w') as f: + print(generate_clang_complete_content(), file=f) + + +def generate_win_clang_complete_content(): + return generate_clang_complete_content(additional_definitions=['UNICODE', '_UNICODE', 'WIN32', '_WINDOWS']) + + +def generate_win_clang_complete(): + with open(os.path.join('src/win/', clang_complete_file_name), 'w') as f: + print(generate_win_clang_complete_content(), file=f) + +generate_root_clang_complete() +generate_win_clang_complete() diff --git a/tools/win_build.py b/tools/win_build.py index c3f1ec57..ab1c7107 100644 --- a/tools/win_build.py +++ b/tools/win_build.py @@ -1,6 +1,7 @@ import argparse import os import os.path +import shutil import subprocess import sys @@ -17,6 +18,20 @@ args = parser.parse_args() project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +def init_vc_environment(arch): + arch_bat_map = { + 'x86': 'vcvarsamd64_x86', + 'x64': 'vcvars64' + } + vars = subprocess.check_output(['C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\{}'.format( + arch_bat_map[arch]), '&&', 'set'], shell=True, text=True) + for var in vars.splitlines(): + k, _, v = map(str.strip, var.strip().partition('=')) + if k.startswith('?'): + continue + os.environ[k] = v + + def configure(): generater_vs_arch_map = { 'x86': 'Win32', @@ -33,7 +48,7 @@ def build(): os.chdir(project_root) -configure() +configure() if args.command == 'build': build() |