Skip to content

Conversation

theartful
Copy link
Contributor

Building the python wheel on windows using msvc fails otherwise.

@pablospe
Copy link
Collaborator

Are all the target_compile_options failing?

target_compile_options(pyposelib PRIVATE -march=native -Wall -Werror -fPIC -Wno-ignored-optimization-argument)

@theartful
Copy link
Contributor Author

@pablospe Windows doesn't have an equivalent to march=native as far as I know. Instead it has specific cpu feature flags. -Wall and -Werror has their equivalents: /Wall and /WX, see https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170
As for -fPIC there is no equivalent in MSVC.

So I think we're left with /Wall and /WX, and maybe we can check for CPU features and add /arch:SSE2, /arch:AVX, etc.

@theartful
Copy link
Contributor Author

theartful commented Jan 22, 2025

Btw, I didn't bother to further investigate since this same pattern was used here, where PoseLib is built:

PoseLib/CMakeLists.txt

Lines 23 to 40 in 56d158f

# Compilation options
option(MARCH_NATIVE "Enable CPU specific optimizations" OFF)
if(MSVC)
target_compile_options(${LIBRARY_NAME} PRIVATE /bigobj /fp:fast)
else()
# If you change this, make sure to update the corresponding line in the pybind CMakeLists
if (MARCH_NATIVE)
target_compile_options(${LIBRARY_NAME} PRIVATE
-march=native -Wall -Werror -fPIC -Wno-ignored-optimization-argument)
else()
target_compile_options(${LIBRARY_NAME} PRIVATE
-Wall -Werror -fPIC)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${LIBRARY_NAME} PRIVATE
-Wno-maybe-uninitialized)
endif()
endif()

@pablospe
Copy link
Collaborator

pablospe commented Apr 9, 2025

@vlarsson Should we merge this?

@vlarsson
Copy link
Collaborator

vlarsson commented Jul 4, 2025

LGTM.

@vlarsson vlarsson merged commit 0b57c55 into PoseLib:master Jul 4, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants