Skip to content
Merged
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
10 changes: 5 additions & 5 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ environment:
TEST_TARGET: check
matrix:
- TARGET: cmake
CMAKE_OPTIONS: -DBUILD_SHARED_LIBS=ON -Dbuild_tests=ON -Werror=deprecated
CMAKE_OPTIONS: -DAO_BUILD_SHARED_LIBS=ON -Werror=deprecated
- TARGET: cmake
CFLAGS_EXTRA: -DAO_CMPXCHG16B_AVAILABLE
CMAKE_OPTIONS: -Dbuild_tests=ON -Denable_assertions=ON -Dinstall_headers=OFF
CMAKE_OPTIONS: -Denable_assertions=ON -Dinstall_headers=OFF
- TARGET: cmake
CMAKE_CONFIG: Release
CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -Dbuild_tests=ON -Denable_gpl=OFF
CMAKE_OPTIONS: -DCMAKE_BUILD_TYPE=Release -Denable_gpl=OFF
- TARGET: cmake
CMAKE_OPTIONS: -A Win32 -Dbuild_tests=ON -Denable_assertions=ON -Denable_docs=OFF
CMAKE_OPTIONS: -A Win32 -Denable_assertions=ON -Denable_docs=OFF
- TARGET: cmake
CMAKE_CONFIG: Release
CMAKE_OPTIONS: -A ARM64 -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=ON
CMAKE_OPTIONS: -A ARM64 -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=MinSizeRel -DAO_BUILD_SHARED_LIBS=ON
- TARGET: nmake
ARCH: x86
CFLAGS_EXTRA: /J
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/cmake-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ jobs:
fail-fast: false

matrix:
os: [ macos-13, macos-latest, ubuntu-24.04-arm, ubuntu-latest, windows-11-arm, windows-latest ]
os: [ macos-15-intel, macos-latest, ubuntu-24.04-arm, ubuntu-latest, windows-11-arm, windows-latest ]
c_compiler: [ cl, clang, gcc ]
build_type: [ Release, Debug, MinSizeRel ]
shared_libs: [ off, on ]
assertions: [ off, on ]
atomic_intrinsics: [ on, off ]
exclude:
- c_compiler: gcc
os: macos-13
os: macos-15-intel
- c_compiler: gcc
os: macos-latest
- c_compiler: cl
os: macos-13
os: macos-15-intel
- c_compiler: cl
os: macos-latest
- c_compiler: cl
Expand Down Expand Up @@ -86,9 +86,8 @@ jobs:
${{ matrix.cmake_generator_opt }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-Dbuild_tests=ON
-Denable_werror=ON
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-DAO_BUILD_SHARED_LIBS=${{ matrix.shared_libs }}
-Denable_assertions=${{ matrix.assertions }}
-Denable_atomic_intrinsics=${{ matrix.atomic_intrinsics }}
${{ matrix.disable_docs_opt }}
Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ jobs:
- arch: ppc64le
compiler: clang
env:
- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=ON -Denable_assertions=ON -Denable_docs=OFF"
- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DAO_BUILD_SHARED_LIBS=ON -Denable_assertions=ON -Denable_docs=OFF"
- arch: ppc64le
compiler: gcc
env:
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -Denable_atomic_intrinsics=OFF"
- compiler: gcc
env:
- CMAKE_OPTIONS="-DBUILD_SHARED_LIBS=ON -Dinstall_headers=OFF"
- CMAKE_OPTIONS="-DAO_BUILD_SHARED_LIBS=ON -Dinstall_headers=OFF"
- compiler: clang
env:
- CFLAGS_EXTRA="-O3 -march=native -funsigned-char"
Expand Down Expand Up @@ -515,9 +515,9 @@ jobs:
- env:
- MAKEFILE_TARGET=distcheck
- AUTOCONF_VER=2.72
- AUTOMAKE_VER=1.17
- AUTOMAKE_VER=1.18.1
- LIBTOOL_VER=2.5.4
- M4_VER=1.4.19
- M4_VER=1.4.20
- if: type != pull_request
addons:
coverity_scan:
Expand Down Expand Up @@ -603,7 +603,7 @@ script:
LDFLAGS="$LDFLAGS";
fi
- if [[ "$CMAKE_OPTIONS" != "" ]]; then
cmake $CMAKE_OPTIONS -Dbuild_tests=ON -Denable_werror=ON -Werror=dev . &&
cmake $CMAKE_OPTIONS -Denable_werror=ON -Werror=dev . &&
cmake --build . $CMAKE_BUILD_OPTIONS --parallel;
fi
- if [[ "$CMAKE_OPTIONS" != "" ]]; then
Expand Down
34 changes: 21 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ if (NOT (${CMAKE_VERSION} VERSION_LESS "3.18.0"))
endif()

# Customize the build by passing "-D<option_name>=ON|OFF" in the command line.
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
option(build_tests "Build tests" OFF)
option(AO_BUILD_SHARED_LIBS "Build shared libraries" OFF)
# option(BUILD_TESTING "Build tests" ON) - the standard one
option(enable_assertions "Enable assertion checking" OFF)
option(enable_werror "Treat warnings as errors" OFF)
option(enable_atomic_intrinsics "Use GCC atomic intrinsics" ON)
Expand All @@ -68,7 +68,7 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
endif()

# Convert VER_INFO values to [SO]VERSION ones.
if (BUILD_SHARED_LIBS)
if (AO_BUILD_SHARED_LIBS)
# atomic_ops:
string(REGEX REPLACE "(.+):.+:.+" "\\1" ao_cur ${LIBATOMIC_OPS_VER_INFO})
string(REGEX REPLACE ".+:(.+):.+" "\\1" ao_rev ${LIBATOMIC_OPS_VER_INFO})
Expand All @@ -86,7 +86,7 @@ if (BUILD_SHARED_LIBS)
math(EXPR AO_GPL_SOVERSION "${ao_gpl_cur} - ${ao_gpl_age}")
set(AO_GPL_VERSION_PROP "${AO_GPL_SOVERSION}.${ao_gpl_age}.${ao_gpl_rev}")
message(STATUS "AO_GPL_VERSION_PROP = ${AO_GPL_VERSION_PROP}")
endif(BUILD_SHARED_LIBS)
endif(AO_BUILD_SHARED_LIBS)

# Output all warnings.
if (MSVC)
Expand Down Expand Up @@ -124,7 +124,7 @@ if (NOT enable_atomic_intrinsics)
endif()

# AO API symbols export control.
if (BUILD_SHARED_LIBS)
if (AO_BUILD_SHARED_LIBS)
add_compile_options(-DAO_DLL)
endif()

Expand All @@ -150,15 +150,23 @@ if (CMAKE_C_COMPILER_ID STREQUAL "SunPro")
set(SRC ${SRC} src/atomic_ops_sysdeps.S)
endif()

add_library(atomic_ops ${SRC})
if (AO_BUILD_SHARED_LIBS)
add_library(atomic_ops SHARED ${SRC})
else()
add_library(atomic_ops STATIC ${SRC})
endif()
target_link_libraries(atomic_ops PRIVATE ${THREADDLLIBS_LIST})
target_include_directories(atomic_ops
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
INTERFACE "$<INSTALL_INTERFACE:include>")

if (enable_gpl)
set(AO_GPL_SRC src/atomic_ops_malloc.c src/atomic_ops_stack.c)
add_library(atomic_ops_gpl ${AO_GPL_SRC})
if (AO_BUILD_SHARED_LIBS)
add_library(atomic_ops_gpl SHARED ${AO_GPL_SRC})
else()
add_library(atomic_ops_gpl STATIC ${AO_GPL_SRC})
endif()
check_function_exists(mmap HAVE_MMAP)
if (HAVE_MMAP)
target_compile_definitions(atomic_ops_gpl PRIVATE HAVE_MMAP)
Expand All @@ -167,7 +175,7 @@ if (enable_gpl)
target_include_directories(atomic_ops_gpl
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
INTERFACE "$<INSTALL_INTERFACE:include>")
if (BUILD_SHARED_LIBS)
if (AO_BUILD_SHARED_LIBS)
set_property(TARGET atomic_ops_gpl PROPERTY VERSION ${AO_GPL_VERSION_PROP})
set_property(TARGET atomic_ops_gpl PROPERTY SOVERSION ${AO_GPL_SOVERSION})
endif()
Expand All @@ -178,7 +186,7 @@ if (enable_gpl)
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
endif(enable_gpl)

if (BUILD_SHARED_LIBS)
if (AO_BUILD_SHARED_LIBS)
if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "BSD"))
if (${CMAKE_VERSION} VERSION_LESS "3.18.0")
set(WL_NO_UNDEFINED_OPT "-Wl,--no-undefined")
Expand All @@ -204,7 +212,7 @@ if (BUILD_SHARED_LIBS)
endif()
set_property(TARGET atomic_ops PROPERTY VERSION ${AO_VERSION_PROP})
set_property(TARGET atomic_ops PROPERTY SOVERSION ${AO_SOVERSION})
endif(BUILD_SHARED_LIBS)
endif(AO_BUILD_SHARED_LIBS)

install(TARGETS atomic_ops EXPORT Atomic_opsTargets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
Expand Down Expand Up @@ -315,7 +323,7 @@ if (install_headers)
# TODO: handle atomic_ops-uninstalled.pc.in
endif(install_headers)

if (build_tests)
if (BUILD_TESTING)
add_executable(test_atomic tests/test_atomic.c)
target_link_libraries(test_atomic PRIVATE atomic_ops ${THREADDLLIBS_LIST})
add_test(NAME test_atomic COMMAND test_atomic)
Expand Down Expand Up @@ -346,8 +354,8 @@ if (build_tests)
target_link_libraries(test_malloc
PRIVATE atomic_ops atomic_ops_gpl ${THREADDLLIBS_LIST})
add_test(NAME test_malloc COMMAND test_malloc)
endif()
endif(build_tests)
endif(enable_gpl)
endif()

if (enable_docs)
install(FILES AUTHORS ChangeLog LICENSE README.md
Expand Down
2 changes: 1 addition & 1 deletion README_details.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Alternatively, the libraries could be built with CMake, even for Windows,
like this:
> mkdir out
> cd out
> cmake -Dbuild_tests=ON ..
> cmake ..
> cmake --build . --config Release
> ctest --build-config Release

Expand Down