aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-09-02 00:07:36 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-09-02 00:07:36 +0200
commita26488497cc765890dd5dff122a1f08ca6c5ca95 (patch)
tree43b54bcae1f509e4c84aadf99cc61a4d6b42dcbe
parent2c9fa6ec14966321ab04da35d587eb99612f0cd8 (diff)
downloadEpisodeBrowser-a26488497cc765890dd5dff122a1f08ca6c5ca95.tar.gz
Improve build system.
-rw-r--r--Makefile51
-rw-r--r--c/CMakeLists.txt2
-rw-r--r--eb.el50
3 files changed, 64 insertions, 39 deletions
diff --git a/Makefile b/Makefile
index 9c63d23..cba8b06 100644
--- a/Makefile
+++ b/Makefile
@@ -1,37 +1,40 @@
-SYSTEM ?= vs2019
-CONFIG ?= Debug
MAKEFLAGS += --no-print-directory
+SHELL = sh
+
+SYSTEM ?= vs2019
+VS_CONFIG ?= Debug
+VS_TOOLSET ?= v142
+VS_PLATFORM ?= x64
-EXE = b/$(SYSTEM)/EpisodeBrowser.exe
-ifneq ($(SYSTEM), mingw)
-EXE = b/$(SYSTEM)/Debug/EpisodeBrowser.exe
+ifeq ($(SYSTEM), mingw)
+DIR = $(DIR)
+OUT = $(DIR)
+else ifeq ($(SYSTEM), vs2019)
+DIR = b/vs2019-$(VS_TOOLSET)-$(VS_PLATFORM)
+OUT = $(DIR)/$(VS_CONFIG)
+else
+$(error SYSTEM=$(SYSTEM) is not supported)
endif
all:
ifeq ($(SYSTEM), mingw)
- cd b/$(SYSTEM) && cmake -DCMAKE_CONFIGURATION_TYPES=$(CONFIG) -G "Unix Makefiles" ../../c
- cd b/$(SYSTEM) && cmake --build . -j
-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)
+ mkdir -p $(DIR)
+ cd $(DIR) && cmake -DCMAKE_CONFIGURATION_TYPES=$(VS_CONFIG) -G "Unix Makefiles" ../../c
+ cd $(DIR) && cmake --build . -j
+else ifeq ($(SYSTEM), vs2019)
+ mkdir -p $(DIR)
+ cd $(DIR) && cmake -DCMAKE_CONFIGURATION_TYPES=$(VS_CONFIG) \
+ -G "Visual Studio 16 2019" -T "$(VS_TOOLSET)" -A "$(VS_PLATFORM)" ../../c
+ cd $(DIR) && cmake --build . -j --config $(VS_CONFIG)
+ cp x/l/$(VS_PLATFORM)/libxml2.dll $(DIR)/$(VS_CONFIG)
+ cp $(OUT)/libxml2.dll "C:\Users\John\Desktop\Delat"
+ cp $(OUT)/libxml2.dll "C:\Users\John\Desktop\XP"
endif
- cp $(EXE) "C:\Users\John\Desktop\Delat"
+ cp $(OUT)/EpisodeBrowser.exe "C:\Users\John\Desktop\Delat"
+ cp $(OUT)/EpisodeBrowser.exe "C:\Users\John\Desktop\XP"
clean:
cd b/$(SYSTEM) && cmake --build . --target clean
TAGS: c/*.cpp c/*.h
etags --declarations -lc++ c/*.cpp c/*.h
-
-.PHONY: mingw vs2019
-b:
- mkdir b
-b/mingw: b
- mkdir b/mingw
-b/vs2019: b
- mkdir b/vs2019
-mingw: b/mingw
- cd b/mingw && cmake -G "Unix Makefiles" ../../c
-vs2019: b/vs2019
- cd b/vs2019 && cmake -G "Visual Studio 16 2019" ../../c
diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt
index da411b2..d8c3ce5 100644
--- a/c/CMakeLists.txt
+++ b/c/CMakeLists.txt
@@ -44,7 +44,7 @@ if (CMAKE_GENERATOR MATCHES "Visual Studio")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO")
target_compile_options(EpisodeBrowser PRIVATE /wd26451 /wd6385)
target_include_directories(EpisodeBrowser PUBLIC ${MSVC_EXT_INCLUDE_DIR})
- find_library(LIBXML2 libxml2 HINTS ${MSVC_EXT_LINK_DIR})
+ find_library(LIBXML2 libxml2 HINTS ${MSVC_EXT_LINK_DIR}/${CMAKE_GENERATOR_PLATFORM})
target_link_libraries(EpisodeBrowser comctl32 wininet ${LIBXML2})
else()
target_include_directories(EpisodeBrowser PUBLIC C:/msys64/mingw64/include/libxml2)
diff --git a/eb.el b/eb.el
index ec9557e..904da3a 100644
--- a/eb.el
+++ b/eb.el
@@ -29,7 +29,6 @@
(2 (list 'face dired-header-face)))))
(font-lock-add-keywords 'dired-mode eb--truncate-dired-headers--keywords)
-;; (font-lock-remove-keywords 'dired-mode eb--truncate-dired-headers--keywords)
;;;###autoload
(define-minor-mode eb--dired-truncate-headers-mode
@@ -78,7 +77,6 @@
(setq eb--fleeting--close ',close)
,open
(eb--fleeting-minor-mode 1)
- (message "%s" eb--fleeting-minor-mode)
(setq eb--fleeting--direction ',dir))
window)))))
@@ -98,8 +96,6 @@
(setq eb--fleeting--window (and eb--fleeting-minor-mode (get-buffer-window))))
(add-hook 'pre-command-hook #'eb--fleeting--pre-command-hook)
-(define-key global-map [f12] (lambda () (interactive) (message "%s" eb--fleeting--buffer)))
-
(defun eb--fleeting--window-hook (&rest r)
(let ((fleeting-buffer eb--fleeting--buffer)
(fleeting-window eb--fleeting--window)
@@ -232,8 +228,20 @@
:type '(radio (const "mingw") (const "vs2019")))
;;;###autoload
-(defcustom eb-config "Debug"
- "Build configuration type."
+(defcustom eb-vs-toolset "v142"
+ "Visual Studio toolset."
+ :group 'eb
+ :type '(radio (const "v142") (const "v141_xp")))
+
+;;;###autoload
+(defcustom eb-vs-platform "x64"
+ "Visual Studio platform."
+ :group 'eb
+ :type '(radio (const "Win32") (const "x64")))
+
+;;;###autoload
+(defcustom eb-vs-config "Debug"
+ "Visual Studio configuration."
:group 'eb
:type '(radio (const "Debug") (const "Release")))
@@ -243,19 +251,30 @@
:group 'eb
:type 'directory)
+(defun eb--cmake-path ()
+ (require 'projectile)
+ (cond
+ ((string-equal eb-system "mingw")
+ (concat (projectile-project-root) "/b/mingw/"))
+ ((string-equal eb-system "vs2019")
+ (concat (projectile-project-root) "/b/vs2019-" eb-vs-toolset "-" eb-vs-platform "/"))
+ (t (error "eb-system `%s' not supported" eb-system))))
+
+(defun eb--exe ()
+ (cond
+ ((string-equal eb-system "mingw")
+ (concat (eb--cmake-path) "b/mingw/EpisodeBrowser.exe"))
+ ((string-equal eb-system "vs2019")
+ (concat (eb--cmake-path) eb-vs-config "/EpisodeBrowser.exe"))
+ (t (error "eb-system `%s' not supported" eb-system))))
+
;;;###autoload
(defun eb-run ()
"Launch built executable, displaying its output in a buffer."
(interactive)
(require 'projectile)
(let ((buf (get-buffer-create "*eb-run*"))
- (exe (concat (projectile-project-root)
- "/b/"
- eb-system "/"
- (if (not (string-equal eb-system "mingw"))
- (concat eb-config "/")
- "")
- "EpisodeBrowser.exe"))
+ (exe (eb--exe))
(default-directory eb-cwd))
(with-current-buffer buf
(compilation-mode))
@@ -275,7 +294,10 @@
(quit-window))
(if (projectile-project-p)
(let ((compilation-read-command nil)
- (command (concat "make SYSTEM=" eb-system " CONFIG=" eb-config)))
+ (command (concat "make SYSTEM=" eb-system
+ " VS_CONFIG=" eb-vs-config
+ " VS_TOOLSET=" eb-vs-toolset
+ " VS_PLATFORM=" eb-vs-platform)))
(projectile--run-project-cmd command nil
:show-prompt nil
:prompt-prefix "Compile command: "