Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can specific cmake generator to use when building #97

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions libgit.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
(unless module-file-suffix
(error "Module support not detected, libgit can't work"))

(defcustom libgit-cmake-generator nil
"CMake generator to use."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone who is not familiar with cmake (like me), should still be able to understand what this is all about. As I understand it, this creates build instructions that can later be used by cmake --build instead of creating a Makefile later to be used by make.

:type 'string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can, and by default is, nil. Also what would be a good non-nil value? Is there more than one non-nil value that even makes sense. Either way, a good non-nil value should be provided as a choice, that the user can select without having to learn more about Cmake first.

:group 'libgit)

(defvar libgit--root
(file-name-directory (or load-file-name buffer-file-name))
"Directory where libgit is installed.")
Expand All @@ -51,7 +56,9 @@ On successful exit, pass control on to the build step."
(make-directory libgit--build-dir 'parents)
(let ((default-directory libgit--build-dir))
(set-process-sentinel
(start-process "libgit-cmake" "*libgit build*" "cmake" "..")
(if libgit-cmake-generator
(start-process "libgit-cmake" "*libgit build*" "cmake" ".." "-G" libgit-cmake-generator)
(start-process "libgit-cmake" "*libgit build*" "cmake" ".."))
(lambda (proc _event)
(when (eq 'exit (process-status proc))
(if (= 0 (process-exit-status proc))
Expand All @@ -65,7 +72,7 @@ On successful exit, pass control on to the build step."
On successful exit, pass control on to the load step."
(let ((default-directory libgit--build-dir))
(set-process-sentinel
(start-process "libgit-cmake" "*libgit build*" "make")
(start-process "libgit-cmake" "*libgit build*" "cmake" "--build" ".")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will cmake --build . fallback to calling make if we didn't specify a generator above?

Copy link
Contributor

@Thaodan Thaodan Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cmake will default to the platforms default.

It could also make sense to pass -S to cmake to avoid changing the directory to the source directory.

E.g. cmake -B buildir -S sources.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback, but I have decided to close this until @vconcat gets back to this and makes the requested change and provides all the necessary information in the commit message.

(lambda (proc _event)
(when (eq 'exit (process-status proc))
(if (= 0 (process-exit-status proc))
Expand Down