Skip to content

Commit

Permalink
[vcpkg-cmake|cmake buildsystem] synchronize and sanitize scripts. (#2…
Browse files Browse the repository at this point in the history
…3259)

* synchronize cmake build scripts.

* version stuff

* fix REMOVE_ITEM and add license

* format manifest

* update version

* use LOGFILE_BASE

* version update

* readd PREFER_NINJA and print a warning that it is deprecated for vcpkg_cmake_configure

* version stuff

* sync build_cmake

* only turn off ninja on windows

* add Z_VCPKG_CHAINLOAD_TOOLCHAIN_FILE

* use z_vcpkg_select_default_vcpkg_chainload_toolchain in meson

* remove VCPKG_CMAKE_GENERATOR

* version stuff

* reduce error to warning

* remove VCPKG_CMAKE_GENERATOR form configure_cmake

* version stuff

* version stuff

* use build_dir_<config>

* version stuff

* use ninja variable insead of pure ninja cmd

* version bump

* use ninja variable instead of calling ninja directly

* acquire ninja

* move the acquire.

* remove setting of cmake_prefix_path

* version stuff

* bump version date

* version stuff

* bump ashes baseline

* remove VCPKG_CMAKE_GENERATOR reference

* fix wrong variable reference due to refactor

* version stuff

Co-authored-by: Alexander Neumann <you@example.com>
Co-authored-by: Billy Robert O'Neal <bion@microsoft.com>
  • Loading branch information
3 people committed May 6, 2022
1 parent aec505b commit f7866c6
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 137 deletions.
1 change: 0 additions & 1 deletion ports/ashes/portfile.cmake
Expand Up @@ -22,7 +22,6 @@ file(COPY "${CMAKE_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/CMake")
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DCMAKE_INSTALL_PREFIX=${CURRENT_INSTALLED_DIR}
-DVCPKG_PACKAGE_BUILD=ON
-DASHES_BUILD_TEMPLATES=OFF
-DASHES_BUILD_TESTS=OFF
Expand Down
1 change: 1 addition & 0 deletions ports/ashes/vcpkg.json
@@ -1,6 +1,7 @@
{
"name": "ashes",
"version-date": "2022-04-03",
"port-version": 1,
"description": "Drop-in replacement to Vulkan's shared library, allowing the use of OpenGL or Direct3D11 in addition to Vulkan.",
"homepage": "https://github.com/DragonJoker/Ashes",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion ports/vcpkg-cmake/vcpkg.json
@@ -1,5 +1,5 @@
{
"name": "vcpkg-cmake",
"version-date": "2022-04-21",
"version-date": "2022-05-05",
"license": "MIT"
}
85 changes: 45 additions & 40 deletions ports/vcpkg-cmake/vcpkg_cmake_build.cmake
Expand Up @@ -47,77 +47,82 @@ function(vcpkg_cmake_build)
if(NOT DEFINED arg_LOGFILE_BASE)
set(arg_LOGFILE_BASE "build")
endif()

set(build_args "")
set(target_args "")
set(parallel_args "")
set(no_parallel_args "")

if(Z_VCPKG_CMAKE_GENERATOR STREQUAL "Ninja")
set(build_args "-v") # verbose output
set(parallel_args "-j${VCPKG_CONCURRENCY}")
set(no_parallel_args "-j1")
elseif(Z_VCPKG_CMAKE_GENERATOR MATCHES "^Visual Studio")
set(build_args
vcpkg_list(SET build_param)
vcpkg_list(SET parallel_param)
vcpkg_list(SET no_parallel_param)

if("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "Ninja")
vcpkg_list(SET build_param "-v") # verbose output
vcpkg_list(SET parallel_param "-j${VCPKG_CONCURRENCY}")
vcpkg_list(SET no_parallel_param "-j1")
elseif("${Z_VCPKG_CMAKE_GENERATOR}" MATCHES "^Visual Studio")
vcpkg_list(SET build_param
"/p:VCPkgLocalAppDataDisabled=true"
"/p:UseIntelMKL=No"
)
set(parallel_args "/m")
elseif(Z_VCPKG_CMAKE_GENERATOR STREQUAL "NMake Makefiles")
vcpkg_list(SET parallel_param "/m")
elseif("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "NMake Makefiles")
# No options are currently added for nmake builds
elseif(Z_VCPKG_CMAKE_GENERATOR STREQUAL "Unix Makefiles")
set(build_args "VERBOSE=1")
set(parallel_args "-j${VCPKG_CONCURRENCY}")
set(no_parallel_args "")
vcpkg_list(SET build_args "VERBOSE=1")
vcpkg_list(SET parallel_args "-j${VCPKG_CONCURRENCY}")
vcpkg_list(SET no_parallel_args "")
elseif(Z_VCPKG_CMAKE_GENERATOR STREQUAL "Xcode")
list(APPEND parallel_args -jobs "${VCPKG_CONCURRENCY}")
list(APPEND no_parallel_args -jobs 1)
vcpkg_list(SET parallel_args -jobs "${VCPKG_CONCURRENCY}")
vcpkg_list(SET no_parallel_args -jobs 1)
else()
message(WARNING "Unrecognized GENERATOR setting from vcpkg_cmake_configure().")
endif()

if(DEFINED arg_TARGET)
set(target_args "--target" "${arg_TARGET}")
vcpkg_list(SET target_param)
if(arg_TARGET)
vcpkg_list(SET target_param "--target" "${arg_TARGET}")
endif()

foreach(buildtype IN ITEMS debug release)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL buildtype)
if(buildtype STREQUAL "debug")
set(short_buildtype "dbg")
set(cmake_config "Debug")
foreach(build_type IN ITEMS debug release)
if(NOT DEFINED VCPKG_BUILD_TYPE OR "${VCPKG_BUILD_TYPE}" STREQUAL "${build_type}")
if("${build_type}" STREQUAL "debug")
set(short_build_type "dbg")
set(config "Debug")
else()
set(short_buildtype "rel")
set(cmake_config "Release")
set(short_build_type "rel")
set(config "Release")
endif()

message(STATUS "Building ${TARGET_TRIPLET}-${short_buildtype}")
message(STATUS "Building ${TARGET_TRIPLET}-${short_build_type}")

if(arg_ADD_BIN_TO_PATH)
set(env_path_backup "$ENV{PATH}")
if(buildtype STREQUAL "debug")
vcpkg_backup_env_variables(VARS PATH)
if("${build_type}" STREQUAL "debug")
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/debug/bin")
else()
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}/bin")
endif()
endif()

if (arg_DISABLE_PARALLEL)
if(arg_DISABLE_PARALLEL)
vcpkg_execute_build_process(
COMMAND "${CMAKE_COMMAND}" --build . --config "${cmake_config}" ${target_args} -- ${build_args} ${no_parallel_args}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_buildtype}"
LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}-${short_buildtype}"
COMMAND
"${CMAKE_COMMAND}" --build . --config "${config}" ${target_param}
-- ${build_param} ${no_parallel_param}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_build_type}"
LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}-${short_build_type}"
)
else()
vcpkg_execute_build_process(
COMMAND "${CMAKE_COMMAND}" --build . --config "${cmake_config}" ${target_args} -- ${build_args} ${parallel_args}
NO_PARALLEL_COMMAND "${CMAKE_COMMAND}" --build . --config "${cmake_config}" ${target_args} -- ${build_args} ${no_parallel_args}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_buildtype}"
LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}-${short_buildtype}"
COMMAND
"${CMAKE_COMMAND}" --build . --config "${config}" ${target_param}
-- ${build_param} ${parallel_param}
NO_PARALLEL_COMMAND
"${CMAKE_COMMAND}" --build . --config "${config}" ${target_param}
-- ${build_param} ${no_parallel_param}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${short_build_type}"
LOGNAME "${arg_LOGFILE_BASE}-${TARGET_TRIPLET}-${short_build_type}"
)
endif()

if(arg_ADD_BIN_TO_PATH)
set(ENV{PATH} "${env_path_backup}")
vcpkg_restore_env_variables(VARS PATH)
endif()
endif()
endforeach()
Expand Down

0 comments on commit f7866c6

Please sign in to comment.