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

Set the system timer resolution to the minimum value for higher precision on Windows #907

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

GiulioRomualdi
Copy link
Member

No description provided.

@GiulioRomualdi
Copy link
Member Author

I need to add the following line in the cmake. However given how the cmake machinery is implemented I need to modify the cmake functions

if(WIN32)
    target_link_libraries(iFeelDriver PRIVATE Winmm)
endif()

@GiulioRomualdi
Copy link
Member Author

I need to add the following line in the cmake. However given how the cmake machinery is implemented I need to modify the cmake functions

if(WIN32)
    target_link_libraries(iFeelDriver PRIVATE Winmm)
endif()

Fixed in d5c9801

@GiulioRomualdi GiulioRomualdi changed the title Set the minimum resolution for Windows clock Set the system timer resolution to the minimum value for higher precision on Windows Oct 30, 2024
@GiulioRomualdi GiulioRomualdi merged commit 78bae85 into master Oct 30, 2024
11 of 12 checks passed
@GiulioRomualdi GiulioRomualdi deleted the windows_clock branch October 30, 2024 10:50
@GiulioRomualdi GiulioRomualdi restored the windows_clock branch October 30, 2024 10:50
@GiulioRomualdi GiulioRomualdi deleted the windows_clock branch October 30, 2024 10:50
@GiulioRomualdi GiulioRomualdi self-assigned this Oct 30, 2024
@traversaro
Copy link
Collaborator

traversaro commented Oct 30, 2024

However given how the cmake machinery is implemented I need to modify the cmake functions

Just as a general comment, an alternative is to also define a TARGET_NAME output variable in CMake, so that then you can call:

 add_bipedal_locomotion_library(
    NAME                   System
    PUBLIC_HEADERS         ${H_PREFIX}/InputPort.h ${H_PREFIX}/OutputPort.h
                           ${H_PREFIX}/Advanceable.h ${H_PREFIX}/Source.h ${H_PREFIX}/Sink.h
                           ${H_PREFIX}/Factory.h
                           ${H_PREFIX}/VariablesHandler.h ${H_PREFIX}/LinearTask.h ${H_PREFIX}/ILinearTaskSolver.h ${H_PREFIX}/ILinearTaskFactory.h ${H_PREFIX}/ITaskControllerManager.h
                           ${H_PREFIX}/IClock.h ${H_PREFIX}/StdClock.h ${H_PREFIX}/Clock.h
                           ${H_PREFIX}/SharedResource.h ${H_PREFIX}/AdvanceableRunner.h
                           ${H_PREFIX}/QuitHandler.h
                           ${H_PREFIX}/Barrier.h ${H_PREFIX}/TimeProfiler.h
                           ${H_PREFIX}/WeightProvider.h ${H_PREFIX}/ConstantWeightProvider.h
    SOURCES                src/VariablesHandler.cpp src/LinearTask.cpp
                           src/StdClock.cpp src/Clock.cpp src/QuitHandler.cpp src/Barrier.cpp
                           src/ConstantWeightProvider.cpp src/TimeProfiler.cpp
    PUBLIC_LINK_LIBRARIES  BipedalLocomotion::ParametersHandler Eigen3::Eigen
    SUBDIRECTORIES         tests YarpImplementation RosImplementation
    OUTPUT_TARGET_NAME_VARIABLE BLF_SYSTEM_TARGET_NAME)

if(WIN32)
    target_link_libraries(${BLF_SYSTEM_TARGET_NAME} PRIVATE Winmm)
endif()

to avoid adding a specfical handling the the function whenever you need to do something specific to a target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants