Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 25 additions & 0 deletions cmake/Darwin.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#********************************************************************
# _ _ _
# _ __ | |_ _ | | __ _ | |__ ___
# | '__|| __|(_)| | / _` || '_ \ / __|
# | | | |_ _ | || (_| || |_) |\__ \
# |_| \__|(_)|_| \__,_||_.__/ |___/
#
# www.rt-labs.com
# Copyright 2026 rt-labs AB, Sweden.
#
# This software is licensed under the terms of the BSD 3-clause
# license. See the file LICENSE distributed with this software for
# full license information.
#*******************************************************************/
find_package(Threads)

add_subdirectory(src/darwin)

if (BUILD_TESTING)
set(GOOGLE_TEST_INDIVIDUAL TRUE)
endif()

set (OSAL_DEFAULT_SYSTEM
osal-darwin
CACHE STRING ${OSAL_DEFAULT_SYSTEM_HELP_STRING})
2 changes: 1 addition & 1 deletion cmake/OsalConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
find_package(Threads REQUIRED)
endif()

Expand Down
60 changes: 60 additions & 0 deletions src/darwin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#********************************************************************
# _ _ _
# _ __ | |_ _ | | __ _ | |__ ___
# | '__|| __|(_)| | / _` || '_ \ / __|
# | | | |_ _ | || (_| || |_) |\__ \
# |_| \__|(_)|_| \__,_||_.__/ |___/
#
# www.rt-labs.com
# Copyright 2026 rt-labs AB, Sweden.
#
# This software is licensed under the terms of the BSD 3-clause
# license. See the file LICENSE distributed with this software for
# full license information.
#*******************************************************************/


find_package(Threads)

set(_osal_sys osal-darwin)
add_library(${_osal_sys})

target_compile_features(${_osal_sys}
PUBLIC
c_std_99
)

# Use position independent code if platform supports shared libraries
get_property(SUPPORTS_SHARED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
if (SUPPORTS_SHARED)
set_property(TARGET ${_osal_sys} PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()

target_sources(${_osal_sys}
PRIVATE
osal.c
osal_log.c
)

target_compile_options(${_osal_sys}
PRIVATE
-Wall
-Wextra
-Werror
-Wno-unused-parameter
)

target_include_directories(${_osal_sys} PRIVATE
sys
)

target_link_libraries(${_osal_sys}
PUBLIC
osal-interface
Threads::Threads
)

install(
TARGETS ${_osal_sys}
EXPORT OsalTargets
)
Loading
Loading