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

[vcpkg/scripts] Add a way to get cmake compiler settings/flags #12936

Merged
merged 46 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
0673870
add function get_cmake_vars
Neumann-A Aug 16, 2020
b5f28f7
fine tuning.
Neumann-A Aug 16, 2020
deae3fe
apply to make based ports.
Neumann-A Aug 16, 2020
d4d7e21
add log suffix on not windows platforms
Neumann-A Aug 16, 2020
d47399d
fix c&p error
Neumann-A Aug 16, 2020
6ccbae5
add previous LINK env
Neumann-A Aug 16, 2020
0f2004b
setup env on windows and extract cpp flags correctly.
Neumann-A Aug 16, 2020
f811525
Apply suggestions from code review
Neumann-A Aug 17, 2020
eb2ef40
commit changes from fontconfig PR
Neumann-A Aug 20, 2020
3d2ba81
Merge branch 'add_get_cmake_vars' of https://github.com/Neumann-A/vcp…
Neumann-A Aug 20, 2020
74ca7a3
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Aug 20, 2020
b26f186
Apply suggestions from code review
Neumann-A Aug 20, 2020
ec357c2
cleanup docs
Neumann-A Aug 20, 2020
7c440bd
add conversion from somelib.lib to -lsomelib
Neumann-A Aug 21, 2020
8b20a58
add missing ar-lib wrapper
Neumann-A Aug 22, 2020
8e27695
small but important regex correction
Neumann-A Aug 22, 2020
7b40bf3
add latest changes from update_fontconfig PR
Neumann-A Aug 24, 2020
7ff721b
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Sep 3, 2020
2a70444
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Sep 14, 2020
c70ed33
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Sep 24, 2020
c249d19
Apply suggestions from code review
Neumann-A Oct 2, 2020
b457f4a
Apply suggestions from code review
Neumann-A Oct 2, 2020
9f8efbe
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Oct 12, 2020
7b28101
[x264] set env AS
Neumann-A Oct 13, 2020
3a9a28c
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Oct 15, 2020
c040246
fix bugs due to refactor
Neumann-A Oct 15, 2020
28a4b38
use subpath everywhere
Neumann-A Oct 15, 2020
ae93df4
apply changes from CR
Neumann-A Oct 15, 2020
fead091
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Oct 16, 2020
bb12126
remove unnecessary lines 41 & 44
Neumann-A Oct 16, 2020
65e71b1
remove flag transformation
Neumann-A Oct 18, 2020
723b9d7
reintroduce the flag / to - transformation for MSVC
Neumann-A Oct 18, 2020
afb500b
Apply suggestions from code review
Neumann-A Oct 23, 2020
0c5c993
rename the function
Neumann-A Oct 23, 2020
ade6596
rename function/variables
Neumann-A Oct 23, 2020
d484980
transform flags list
Neumann-A Oct 23, 2020
c5e9724
Apply suggestions from code review
Neumann-A Oct 23, 2020
2ac0ca2
fix vcpkg_build_make due to the variable name change
Neumann-A Oct 23, 2020
cebc141
Merge branch 'add_get_cmake_vars' of https://github.com/Neumann-A/vcp…
Neumann-A Oct 23, 2020
a40e9a4
fix another case of function renaming regressions
Neumann-A Oct 23, 2020
acc8810
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Oct 23, 2020
d857367
only rename config.log if it exists
Neumann-A Oct 23, 2020
a6213b3
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Nov 2, 2020
7e24707
actually add the script after vcpkg_common_functions was deleted.
Neumann-A Nov 2, 2020
cf144ce
Merge remote-tracking branch 'upstream/master' into add_get_cmake_vars
Neumann-A Nov 9, 2020
21d09b9
remove setting of ldflags if path contains spaces
Neumann-A Nov 9, 2020
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
20 changes: 19 additions & 1 deletion scripts/cmake/vcpkg_build_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
## * [libosip2](https://github.com/Microsoft/vcpkg/blob/master/ports/libosip2/portfile.cmake)
function(vcpkg_build_make)
cmake_parse_arguments(_bc "ADD_BIN_TO_PATH;ENABLE_INSTALL" "LOGFILE_ROOT;BUILD_TARGET" "" ${ARGN})
include("${CMAKE_VARS_FILE}")

if(NOT _bc_LOGFILE_ROOT)
set(_bc_LOGFILE_ROOT "build")
Expand Down Expand Up @@ -106,11 +107,28 @@ function(vcpkg_build_make)

message(STATUS "Building ${TARGET_TRIPLET}${SHORT_BUILDTYPE}")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(LINKER_FLAGS_${CMAKE_BUILDTYPE} "${VCPKG_DETECTED_STATIC_LINKERFLAGS_${CMAKE_BUILDTYPE}}")
else() # dynamic
set(LINKER_FLAGS_${CMAKE_BUILDTYPE} "${VCPKG_DETECTED_SHARED_LINKERFLAGS_${CMAKE_BUILDTYPE}}")
endif()
if (CMAKE_HOST_WIN32 AND VCPKG_DETECTED_C_COMPILER MATCHES "cl.exe")
set(LDFLAGS_${CMAKE_BUILDTYPE} "-L${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/ -L${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/manual-link/")
set(LINK_ENV_${CMAKE_BUILDTYPE} "$ENV{_LINK_} ${LINKER_FLAGS_${CMAKE_BUILDTYPE}}")
else()
set(LDFLAGS_${CMAKE_BUILDTYPE} "-L${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/ -L${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/manual-link/ ${LINKER_FLAGS_${CMAKE_BUILDTYPE}}")
endif()

set(ENV{LIB} "${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/manual-link/${LIB_PATHLIKE_CONCAT}")
set(ENV{LIBPATH} "${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/manual-link/${LIBPATH_PATHLIKE_CONCAT}")
set(ENV{LIBRARY_PATH} "${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}${PATH_SUFFIX}/lib/manual-link/${LIBRARY_PATH_PATHLIKE_CONCAT}")
#set(ENV{LD_LIBRARY_PATH} "${_VCPKG_INSTALLED}${PATH_SUFFIX_${BUILDTYPE}}/lib/${VCPKG_HOST_PATH_SEPARATOR}${_VCPKG_INSTALLED}${PATH_SUFFIX_${BUILDTYPE}}/lib/manual-link/${LD_LIBRARY_PATH_PATHLIKE_CONCAT}")

if(LINK_ENV_${_VAR_SUFFIX})
_vcpkg_backup_env_variables(_LINK_)
set(ENV{_LINK_} "$ENV{_LINK_} ${LINK_ENV_${_VAR_SUFFIX}}")
endif()

if(_bc_ADD_BIN_TO_PATH)
set(_BACKUP_ENV_PATH "$ENV{PATH}")
vcpkg_add_to_path(PREPEND "${CURRENT_INSTALLED_DIR}${PATH_SUFFIX}/bin")
Expand All @@ -126,7 +144,7 @@ function(vcpkg_build_make)
WORKING_DIRECTORY "${WORKING_DIRECTORY}"
LOGNAME "${_bc_LOGFILE_ROOT}-${TARGET_TRIPLET}${SHORT_BUILDTYPE}"
)

_vcpkg_restore_env_variables(_LINK_)
if(_bc_ADD_BIN_TO_PATH)
set(ENV{PATH} "${_BACKUP_ENV_PATH}")
endif()
Expand Down
1 change: 1 addition & 0 deletions scripts/cmake/vcpkg_common_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ include(vcpkg_apply_patches)
include(vcpkg_copy_pdbs)
include(vcpkg_copy_tool_dependencies)
include(vcpkg_copy_tools)
include(vcpkg_get_cmake_vars)
Neumann-A marked this conversation as resolved.
Show resolved Hide resolved
include(vcpkg_get_program_files_platform_bitness)
include(vcpkg_get_windows_sdk)
include(vcpkg_replace_string)
Expand Down
Loading