mirror of
https://github.com/pybind/pybind11.git
synced 2024-12-01 17:37:15 +00:00
minor cmake improvements on windows
This commit is contained in:
parent
6fb48490ef
commit
bdd11030c2
@ -148,17 +148,19 @@ endforeach()
|
|||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# /bigobj is needed for bigger binding projects due to the limit to 64k
|
# /MP enables multithreaded builds (relevant when there are many files), /bigobj is
|
||||||
# addressable sections. /MP enables multithreaded builds (relevant when
|
# needed for bigger binding projects due to the limit to 64k addressable sections
|
||||||
# there are many files).
|
set_property(TARGET example APPEND PROPERTY COMPILE_OPTIONS /MP /bigobj)
|
||||||
set_target_properties(example PROPERTIES COMPILE_FLAGS "/MP /bigobj ")
|
# Enforce size-based optimization and link time code generation on MSVC
|
||||||
|
# (~30% smaller binaries in experiments); do nothing in debug mode.
|
||||||
if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
|
set_property(TARGET example APPEND PROPERTY COMPILE_OPTIONS
|
||||||
# Enforce size-based optimization and link time code generation on MSVC
|
"$<$<CONFIG:Release>:/Os>" "$<$<CONFIG:Release>:/GL>"
|
||||||
# (~30% smaller binaries in experiments).
|
"$<$<CONFIG:MinSizeRel>:/Os>" "$<$<CONFIG:MinSizeRel>:/GL>"
|
||||||
set_target_properties(example APPEND_STRING PROPERTY COMPILE_FLAGS "/Os /GL ")
|
"$<$<CONFIG:RelWithDebInfo>:/Os>" "$<$<CONFIG:RelWithDebInfo>:/GL>"
|
||||||
set_target_properties(example APPEND_STRING PROPERTY LINK_FLAGS "/LTCG ")
|
)
|
||||||
endif()
|
set_property(TARGET example APPEND_STRING PROPERTY LINK_FLAGS_RELEASE "/LTCG ")
|
||||||
|
set_property(TARGET example APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL "/LTCG ")
|
||||||
|
set_property(TARGET example APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO "/LTCG ")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# .PYD file extension on Windows
|
# .PYD file extension on Windows
|
||||||
|
@ -106,17 +106,19 @@ subdirectory named :file:`pybind11`.
|
|||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# /bigobj is needed for bigger binding projects due to the limit to 64k
|
# /MP enables multithreaded builds (relevant when there are many files), /bigobj is
|
||||||
# addressable sections. /MP enables multithreaded builds (relevant when
|
# needed for bigger binding projects due to the limit to 64k addressable sections
|
||||||
# there are many files).
|
set_property(TARGET example APPEND PROPERTY COMPILE_OPTIONS /MP /bigobj)
|
||||||
set_target_properties(example PROPERTIES COMPILE_FLAGS "/MP /bigobj ")
|
# Enforce size-based optimization and link time code generation on MSVC
|
||||||
|
# (~30% smaller binaries in experiments); do nothing in debug mode.
|
||||||
if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
|
set_property(TARGET example APPEND PROPERTY COMPILE_OPTIONS
|
||||||
# Enforce size-based optimization and link time code generation on MSVC
|
"$<$<CONFIG:Release>:/Os>" "$<$<CONFIG:Release>:/GL>"
|
||||||
# (~30% smaller binaries in experiments).
|
"$<$<CONFIG:MinSizeRel>:/Os>" "$<$<CONFIG:MinSizeRel>:/GL>"
|
||||||
set_target_properties(example APPEND_STRING PROPERTY COMPILE_FLAGS "/Os /GL ")
|
"$<$<CONFIG:RelWithDebInfo>:/Os>" "$<$<CONFIG:RelWithDebInfo>:/GL>"
|
||||||
set_target_properties(example APPEND_STRING PROPERTY LINK_FLAGS "/LTCG ")
|
)
|
||||||
endif()
|
set_property(TARGET example APPEND_STRING PROPERTY LINK_FLAGS_RELEASE "/LTCG ")
|
||||||
|
set_property(TARGET example APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL "/LTCG ")
|
||||||
|
set_property(TARGET example APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO "/LTCG ")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# .PYD file extension on Windows
|
# .PYD file extension on Windows
|
||||||
|
Loading…
Reference in New Issue
Block a user