From f9826e1dff5f1ac8212ca55a847c872c426142db Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 3 Feb 2023 00:00:15 +0100 Subject: build: stop relying on CMAKE_BUILD_TYPE to determine the build type (#22051) Any logic involving CMAKE_BUILD_TYPE is automatically broken as it won't work with multi-config generators. The only exception is if we explicitly check whether the current generator is single-config as well. Instead, use generator expressions or cmake variables that allows to set options for certain build types only such as INTERPROCEDURAL_OPTIMIZATION_. Opt to generate all headers with optimization level O2 with no debug information for all build types as that is the simplest way to make it behave the same for all generators. --- cmake.config/versiondef.h.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cmake.config/versiondef.h.in') diff --git a/cmake.config/versiondef.h.in b/cmake.config/versiondef.h.in index 22cad87249..480399142b 100644 --- a/cmake.config/versiondef.h.in +++ b/cmake.config/versiondef.h.in @@ -15,7 +15,7 @@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@ -#define NVIM_VERSION_CFLAGS "@NVIM_VERSION_CFLAGS@" -#define NVIM_VERSION_BUILD_TYPE "@NVIM_VERSION_BUILD_TYPE@" +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $, > -D$, -D> -I$>, -I>" +#define NVIM_VERSION_BUILD_TYPE "$" #endif // AUTO_VERSIONDEF_H -- cgit From 964ae205a583807127eda75d9876fb6dfda6065c Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 3 Feb 2023 10:53:57 +0100 Subject: build: unbreak building neovim with multi-config generators (#22104) file(GENERATE) has surprising behavior as it doesn't allow different file contents for configurations with the same file name. This results in an error when building neovim with a multi-config generator. Use a workaround for now where we set the build type for multi-config generators to "Unknown". --- cmake.config/versiondef.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake.config/versiondef.h.in') diff --git a/cmake.config/versiondef.h.in b/cmake.config/versiondef.h.in index 480399142b..2bfd4e0b53 100644 --- a/cmake.config/versiondef.h.in +++ b/cmake.config/versiondef.h.in @@ -15,7 +15,7 @@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@ -#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $, > -D$, -D> -I$>, -I>" +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $, > -D$, -D> -I$, -I>" #define NVIM_VERSION_BUILD_TYPE "$" #endif // AUTO_VERSIONDEF_H -- cgit From 7100a80253a353341893e1f6397cc9e07dadbc9d Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 4 Mar 2023 20:04:01 +0100 Subject: build: show build type specific compiler flags when using --version The build type specific flags are defined in the variables CMAKE_C_FLAGS_, where can be DEBUG, RELEASE, RELWITHDEBINFO and MINSIZEREL. --- cmake.config/versiondef.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake.config/versiondef.h.in') diff --git a/cmake.config/versiondef.h.in b/cmake.config/versiondef.h.in index 2bfd4e0b53..a4c0cfa2d9 100644 --- a/cmake.config/versiondef.h.in +++ b/cmake.config/versiondef.h.in @@ -15,7 +15,7 @@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@ -#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $, > -D$, -D> -I$, -I>" +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$:${CMAKE_C_FLAGS_DEBUG}>$<$:${CMAKE_C_FLAGS_RELEASE}>$<$:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$:${CMAKE_C_FLAGS_MINSIZEREL}> $, > -D$, -D> -I$, -I>" #define NVIM_VERSION_BUILD_TYPE "$" #endif // AUTO_VERSIONDEF_H -- cgit From c40872acbddb61fd084203af60a86c7ec404d716 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 18 May 2023 16:27:05 +0200 Subject: build: remove duplicate include directories in --version output Having the same directory listed multiple times makes the --version output needlessly complicated to visualize. This deduplication will only work for cmake version 3.15 and above, which should be the majority of neovim builds by now. For older cmake versions we default to the previous behavior of listing duplicate include directories. --- cmake.config/versiondef.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake.config/versiondef.h.in') diff --git a/cmake.config/versiondef.h.in b/cmake.config/versiondef.h.in index a4c0cfa2d9..b328c1fa00 100644 --- a/cmake.config/versiondef.h.in +++ b/cmake.config/versiondef.h.in @@ -15,7 +15,7 @@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@ -#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$:${CMAKE_C_FLAGS_DEBUG}>$<$:${CMAKE_C_FLAGS_RELEASE}>$<$:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$:${CMAKE_C_FLAGS_MINSIZEREL}> $, > -D$, -D> -I$, -I>" +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$:${CMAKE_C_FLAGS_DEBUG}>$<$:${CMAKE_C_FLAGS_RELEASE}>$<$:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$:${CMAKE_C_FLAGS_MINSIZEREL}> $, > -D$, -D> -I$>, -I>" #define NVIM_VERSION_BUILD_TYPE "$" #endif // AUTO_VERSIONDEF_H -- cgit From 1094d0c0dbd0f37ccc0f1d18c73c6066e5690664 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 23 Oct 2023 22:32:32 +0200 Subject: build: add CMAKE_C_FLAGS to --version output Closes https://github.com/neovim/neovim/issues/25754. --- cmake.config/versiondef.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmake.config/versiondef.h.in') diff --git a/cmake.config/versiondef.h.in b/cmake.config/versiondef.h.in index b328c1fa00..bda21b27ec 100644 --- a/cmake.config/versiondef.h.in +++ b/cmake.config/versiondef.h.in @@ -15,7 +15,7 @@ #define NVIM_API_LEVEL_COMPAT @NVIM_API_LEVEL_COMPAT@ #define NVIM_API_PRERELEASE @NVIM_API_PRERELEASE@ -#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER} $<$:${CMAKE_C_FLAGS_DEBUG}>$<$:${CMAKE_C_FLAGS_RELEASE}>$<$:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$:${CMAKE_C_FLAGS_MINSIZEREL}> $, > -D$, -D> -I$>, -I>" +#define NVIM_VERSION_CFLAGS "${CMAKE_C_COMPILER}${C_FLAGS_VERSION_OUTPUT} $<$:${CMAKE_C_FLAGS_DEBUG}>$<$:${CMAKE_C_FLAGS_RELEASE}>$<$:${CMAKE_C_FLAGS_RELWITHDEBINFO}>$<$:${CMAKE_C_FLAGS_MINSIZEREL}> $, > -D$, -D> -I$>, -I>" #define NVIM_VERSION_BUILD_TYPE "$" #endif // AUTO_VERSIONDEF_H -- cgit