time OS-specific implementation chosen by CMakeLists.txt (#124)

This commit is contained in:
Loïc Dauphin 2017-04-18 08:54:54 +02:00 committed by William Woodall
parent 08d9763ce7
commit 415612f8af
2 changed files with 11 additions and 6 deletions

View file

@ -16,6 +16,12 @@ if(NOT WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra")
endif() endif()
if(WIN32)
set(time_impl_c src/rcl/time_win32.c)
else()
set(time_impl_c src/rcl/time_unix.c)
endif()
set(${PROJECT_NAME}_sources set(${PROJECT_NAME}_sources
src/rcl/allocator.c src/rcl/allocator.c
src/rcl/client.c src/rcl/client.c
@ -29,6 +35,7 @@ set(${PROJECT_NAME}_sources
src/rcl/service.c src/rcl/service.c
src/rcl/subscription.c src/rcl/subscription.c
src/rcl/time.c src/rcl/time.c
${time_impl_c}
src/rcl/timer.c src/rcl/timer.c
src/rcl/wait.c src/rcl/wait.c
) )

View file

@ -12,16 +12,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "rcl/time.h"
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#if defined(WIN32) #include "./common.h"
#include "./time_win32.c"
#else // defined(WIN32)
#include "./time_unix.c"
#endif // defined(WIN32)
#include "./stdatomic_helper.h" #include "./stdatomic_helper.h"
#include "rcl/error_handling.h"
// Process default ROS time sources // Process default ROS time sources
static rcl_time_source_t * rcl_default_ros_time_source; static rcl_time_source_t * rcl_default_ros_time_source;