build: (fixes #799) export ns-3 build profile names in version.cache

This commit is contained in:
Gabriel Ferreira
2022-10-31 10:18:42 -03:00
parent 8a9b096aef
commit 4185406a42
2 changed files with 12 additions and 4 deletions

View File

@@ -139,7 +139,14 @@ function(configure_embedded_version)
if(${NS3_VERSION_RELEASE_CANDIDATE} STREQUAL " ")
set(NS3_VERSION_RELEASE_CANDIDATE \"\")
endif()
set(NS3_VERSION_BUILD_PROFILE ${cmakeBuildType})
if(${cmakeBuildType} STREQUAL relwithdebinfo)
set(NS3_VERSION_BUILD_PROFILE default)
elseif((${cmakeBuildType} STREQUAL release) AND ${NS3_NATIVE_OPTIMIZATIONS})
set(NS3_VERSION_BUILD_PROFILE optimized)
else()
set(NS3_VERSION_BUILD_PROFILE ${cmakeBuildType})
endif()
set(version_cache_file_template
${PROJECT_SOURCE_DIR}/build-support/version.cache.in

7
ns3
View File

@@ -110,7 +110,7 @@ def parse_args(argv):
parser_configure.add_argument('-d', '--build-profile',
help='Build profile',
dest='build_profile',
choices=["debug", "default", "release", "optimized"],
choices=["debug", "default", "release", "optimized", "minsizerel"],
action="store", type=str, default=None)
parser_configure.add_argument('-G',
@@ -552,7 +552,7 @@ def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_gener
# Build type
if args.build_profile is not None:
args.build_profile = args.build_profile.lower()
if args.build_profile not in ["debug", "default", "release", "optimized"]:
if args.build_profile not in ["debug", "default", "release", "optimized", "minsizerel"]:
raise Exception("Unknown build type")
else:
if args.build_profile == "debug":
@@ -563,7 +563,8 @@ def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_gener
"-DCMAKE_BUILD_TYPE=default -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=OFF".split())
else:
cmake_args.extend(
"-DCMAKE_BUILD_TYPE=release -DNS3_ASSERT=OFF -DNS3_LOG=OFF -DNS3_WARNINGS_AS_ERRORS=OFF".split()
f"-DCMAKE_BUILD_TYPE={args.build_profile} -DNS3_ASSERT=OFF -DNS3_LOG=OFF "
f"-DNS3_WARNINGS_AS_ERRORS=OFF".split()
)
cmake_args.append("-DNS3_NATIVE_OPTIMIZATIONS=%s" % on_off((args.build_profile == "optimized")))