<commit_before>cmake_minimum_required( VERSION 3.12...3.16 )

project( threadsafe
         LANGUAGES C CXX
         DESCRIPTION "Threading utilities: object oriented (read/write) locking and more" )

include( AICxxProject )

#==============================================================================
# BUILD PROJECT
#

# This project is an OBJECT-library, used by other git submodules and the main project.
add_library( threadsafe_ObjLib OBJECT )

# Set SOURCE_DIR to the current directory.
set_property(
    TARGET     threadsafe_ObjLib
    PROPERTY   SOURCE_DIR       "${CMAKE_CURRENT_SOURCE_DIR}"
)

# The list of source files.
target_sources( threadsafe_ObjLib
    PRIVATE
        "aithreadid.cxx"
        "Semaphore.cxx"
        "SpinSemaphore.cxx"

        "AIMutex.h"
        "AIReadWriteMutex.h"
        "AIReadWriteSpinLock.h"
        "aithreadid.h"
        "aithreadsafe.h"
        "ConditionVariable.h"
        "Futex.h"
        "Gate.h"
        "Semaphore.h"
        "SpinSemaphore.h"
        "StartingGate.h"
)

# Required include search-paths.
get_target_property( CWDS_INTERFACE_INCLUDE_DIRECTORIES AICxx::cwds INTERFACE_INCLUDE_DIRECTORIES )
target_include_directories( threadsafe_ObjLib
    PUBLIC
        "${CWDS_INTERFACE_INCLUDE_DIRECTORIES}" # For sys.h and debug.h.
        "${CMAKE_CURRENT_BINARY_DIR}"           # For generated files like config.h.
)

# Require support for C++17.
target_compile_features( threadsafe_ObjLib
    PUBLIC cxx_std_17
)

# Set link dependencies.
target_link_libraries( threadsafe_ObjLib
    PUBLIC
        #Boost::boost
        Threads::Threads
)

if ( OptionEnableLibcwd )
  target_link_libraries( threadsafe_ObjLib
      PUBLIC
          PkgConfig::Libcwd_r
)
endif ()

# Create an ALIAS target.
add_library( AICxx::threadsafe ALIAS threadsafe_ObjLib )

# Prepend this object library to list.
set( AICXX_OBJECTS_LIST AICxx::threadsafe ${AICXX_OBJECTS_LIST} CACHE INTERNAL "List of OBJECT libaries that this project uses." )<commit_msg>W.I.P.<commit_after>cmake_minimum_required( VERSION 3.12...3.16 )

project( threadsafe
         LANGUAGES C CXX
         DESCRIPTION "Threading utilities: object oriented (read/write) locking and more" )

include( AICxxProject )

#==============================================================================
# DEPENDENCIES
#

# This project uses header-only boost libraries:
# aithreadsafe.h: #include <boost/math/common_factor.hpp>
find_package( Boost REQUIRED )

#==============================================================================
# BUILD PROJECT
#

# This project is an OBJECT-library, used by other git submodules and the main project.
add_library( threadsafe_ObjLib OBJECT )

# Set SOURCE_DIR to the current directory.
set_property(
    TARGET     threadsafe_ObjLib
    PROPERTY   SOURCE_DIR       "${CMAKE_CURRENT_SOURCE_DIR}"
)

# The list of source files.
target_sources( threadsafe_ObjLib
    PRIVATE
        "aithreadid.cxx"
        "Semaphore.cxx"
        "SpinSemaphore.cxx"

        "AIMutex.h"
        "AIReadWriteMutex.h"
        "AIReadWriteSpinLock.h"
        "aithreadid.h"
        "aithreadsafe.h"
        "ConditionVariable.h"
        "Futex.h"
        "Gate.h"
        "Semaphore.h"
        "SpinSemaphore.h"
        "StartingGate.h"
)

# Required include search-paths.
get_target_property( CWDS_INTERFACE_INCLUDE_DIRECTORIES AICxx::cwds INTERFACE_INCLUDE_DIRECTORIES )
target_include_directories( threadsafe_ObjLib
    PUBLIC
        "${CWDS_INTERFACE_INCLUDE_DIRECTORIES}" # For sys.h and debug.h.
)

# Require support for C++17.
target_compile_features( threadsafe_ObjLib
    PUBLIC cxx_std_17
)

# Set link dependencies.
target_link_libraries( threadsafe_ObjLib
    PUBLIC
        Boost::boost
        Threads::Threads
)

if ( OptionEnableLibcwd )
  target_link_libraries( threadsafe_ObjLib
      PUBLIC
          PkgConfig::Libcwd_r
)
endif ()

# Create an ALIAS target.
add_library( AICxx::threadsafe ALIAS threadsafe_ObjLib )

# Prepend this object library to the list.
set( AICXX_OBJECTS_LIST AICxx::threadsafe ${AICXX_OBJECTS_LIST} CACHE INTERNAL "List of OBJECT libaries that this project uses." )
{'fraction_non_alphanumeric': 0.13225338491295938, 'fraction_numerical': 0.004835589941972921, 'mean_word_length': 3.606904231625835, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6222274', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1329, 'n_words': 296}