From ff566993defe78a705173ab7ba883c19b37c8143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 27 Aug 2022 14:50:05 +0200 Subject: Support Debug/Release configurations. --- Makefile | 10 ++++++++-- README | 22 ++++++++++++++++------ c/CMakeLists.txt | 4 ++++ eb.el | 50 ++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 68 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index f6d8bee..9c63d23 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ SYSTEM ?= vs2019 +CONFIG ?= Debug +MAKEFLAGS += --no-print-directory EXE = b/$(SYSTEM)/EpisodeBrowser.exe ifneq ($(SYSTEM), mingw) @@ -6,9 +8,13 @@ EXE = b/$(SYSTEM)/Debug/EpisodeBrowser.exe endif all: +ifeq ($(SYSTEM), mingw) + cd b/$(SYSTEM) && cmake -DCMAKE_CONFIGURATION_TYPES=$(CONFIG) -G "Unix Makefiles" ../../c cd b/$(SYSTEM) && cmake --build . -j -ifneq ($(SYSTEM), mingw) - cp x/l/libxml2.dll b/$(SYSTEM)/Debug +else + cd b/$(SYSTEM) && cmake -DCMAKE_CONFIGURATION_TYPES=$(CONFIG) -G "Visual Studio 16 2019" ../../c + cd b/$(SYSTEM) && cmake --build . -j --config $(CONFIG) + cp x/l/libxml2.dll b/$(SYSTEM)/$(CONFIG) endif cp $(EXE) "C:\Users\John\Desktop\Delat" diff --git a/README b/README index 62e0a71..f0cecc9 100644 --- a/README +++ b/README @@ -54,14 +54,24 @@ debug.cpp,h Building ~~~~~~~~ -Episode Browser is built with GNU Make. For the build process, the -following additional programs are required: +To build Episode Browser, the following programs are required: - - GCC/G++ - - Perl + - GCC or Visual Studio (2019) + - GNU make + - CMake -To build b/EpisodeBrowser.exe, issue `make' in the root directory of -the project. +Furthermore, the following dependencies are required: + + - libxml2 (included with MSYS GCC) + +You may need to manually provide library and header file directories +in c/CMakeLists.txt. + +Episode Browse may be built by issuing `make' from the root directory. +The build process is controlled by a few environment variables: + + - SYSTEM = vs2019 (default) or mingw + - CONFIG = Debug (default) or Release Hacking ~~~~~~~ diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 1bfcac3..b3a1671 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -8,6 +8,10 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) add_compile_definitions(UNICODE _UNICODE) +if(NOT CMAKE_CONFIGURATION_TYPES MATCHES "Release") + add_compile_definitions(_DEBUG) +endif() + add_executable(EpisodeBrowser WIN32) target_sources(EpisodeBrowser PRIVATE data.cpp diff --git a/eb.el b/eb.el index b3691b1..c9877c9 100644 --- a/eb.el +++ b/eb.el @@ -4,6 +4,8 @@ ;;; Code: +(defgroup eb nil "Episode Browser development environment") + ;;;###autoload (defun eb-quit-or-bury () "Quit window or bury buffer." @@ -80,9 +82,14 @@ (call-interactively #'grep))) (defcustom eb-system "vs2019" - "Build system (mingw/vs2019)." + "Build system." + :group 'eb + :type '(radio (const "mingw") (const "vs2019"))) + +(defcustom eb-config "Debug" + "Build configuration type." :group 'eb - :type 'string) + :type '(radio (const "Debug") (const "Release"))) (defcustom eb-cwd "b" "Working directory for executable." @@ -97,8 +104,10 @@ (let ((buf (get-buffer-create "*eb-run*")) (exe (concat (projectile-project-root) "/b/" - eb-system - (if (not (string-equal eb-system "mingw")) "/Debug/" "") + eb-system "/" + (if (not (string-equal eb-system "mingw")) + (concat eb-config "/") + "") "EpisodeBrowser.exe")) (default-directory eb-cwd)) (with-current-buffer buf @@ -113,16 +122,24 @@ ;;;###autoload (defun eb-compile () - "Compile without prompt." + "Compile project without prompt. Use `eb-system'." (interactive) (require 'projectile) (when (and (eq major-mode 'compilation-mode) (window-parameter (selected-window) 'quit-restore)) (quit-window)) (if (projectile-project-p) - (let ((compilation-read-command nil)) - (call-interactively #'projectile-compile-project)) - (call-interactively #'compile))) + (let ((compilation-read-command nil) + (command (concat "make SYSTEM=" eb-system " CONFIG=" eb-config))) + (projectile--run-project-cmd command nil + :show-prompt nil + :prompt-prefix "Compile command: " + :save-buffers t + :use-comint-mode projectile-compile-use-comint-mode)) + (call-interactively #'compile)) + (with-current-buffer "*compilation*" + (when (eql (point) (point-min)) + (goto-char (point-max))))) ;;;###autoload (defun eb-check () @@ -146,6 +163,12 @@ (when eb--list-buffers (quit-window)) (projectile-vc (or (projectile-project-root) default-directory))) +;;;###autoload +(defun eb-customize () + "Customize group `eb'." + (interactive) + (customize-group 'eb)) + (defvar-local eb-tool-bar-mode--old-map nil) (defvar-local eb-tool-bar-mode--old-back-button-mode nil) (defvar-local eb-tool-bar-mode--old-back-button-show-toolbar-buttons nil) @@ -163,7 +186,8 @@ (back-button-mode 1) (setq-local back-button-show-toolbar-buttons nil)) (let ((map (make-sparse-keymap))) - ;; Windows, buffers and files + + ;; Windows, buffers and files. (tool-bar-local-item "cancel" #'eb-quit-or-bury 'quit-or-bury map :label "Bury" :help "Bury buffer or window") (define-key map [(shift quit-or-bury)] #'eb-exhume-buffer) @@ -177,7 +201,7 @@ (tool-bar-local-item "search-replace" #'eb-grep 'grep map :label "Grep" :help "Grep project") - ;; Compilation and version control + ;; Compilation and version control. (define-key-after map [separator-1] menu-bar-separator) (tool-bar-local-item "newsticker/next-item" #'eb-run 'run map :label "Run" :help "Run executable") @@ -190,6 +214,7 @@ (tool-bar-local-item "mail/inbox" #'eb-vc 'vc map :label "Version Control" :help "Open project version control") + ;; Mark control. (when (require 'back-button nil t) (define-key-after map [separator-2] menu-bar-separator) (tool-bar-local-item "left-arrow" #'back-button-global-backward 'previous-mark map @@ -202,6 +227,11 @@ :label "Next Mark" :help "Next Mark") (define-key map [(shift next-mark)] #'back-button-local-forward)) + ;; Miscellaneous. + (define-key-after map [separator-3] menu-bar-separator) + (tool-bar-local-item "preferences" #'eb-customize 'customize map + :label "Customize" :help "Customize user options") + (setq-local tool-bar-map map))) (setq-local tool-bar-map eb-tool-bar-mode--old-map) (when (require 'back-button nil t) -- cgit v1.2.3