Skip to content

Commit

Permalink
Merge branch 'main' into fix-cmake-prebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 authored Oct 16, 2024
2 parents 996b001 + 0e08256 commit e992ff8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
17 changes: 11 additions & 6 deletions cmake/AwsPrebuildDependency.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ function(aws_prebuild_dependency)
set(depInstallDir ${depBinaryDir}/install)
file(MAKE_DIRECTORY ${depBinaryDir})

# Convert prefix path from list to escaped string, to be passed on command line
string(REPLACE ";" "\\\\;" ESCAPED_PREFIX_PATH "${CMAKE_PREFIX_PATH}")
# For execute_process to accept a dynamically constructed command, it should be passed in a list format.
set(cmakeCommand "COMMAND" "${CMAKE_COMMAND}")

set(cmakeCommand "${CMAKE_COMMAND}")
list(APPEND cmakeCommand ${AWS_PREBUILD_SOURCE_DIR})
list(APPEND cmakeCommand -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
list(APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH})
list(APPEND cmakeCommand -DCMAKE_PREFIX_PATH=${ESCAPED_PREFIX_PATH})
list(APPEND cmakeCommand -DCMAKE_INSTALL_PREFIX=${depInstallDir})
list(APPEND cmakeCommand -DCMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH})
list(APPEND cmakeCommand -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS})
Expand All @@ -39,11 +42,13 @@ function(aws_prebuild_dependency)
list(APPEND cmakeCommand ${AWS_PREBUILD_CMAKE_ARGUMENTS})
endif()

list(APPEND cmakeCommand WORKING_DIRECTORY ${depBinaryDir})
list(APPEND cmakeCommand RESULT_VARIABLE result)

# Configure dependency project.
execute_process(${cmakeCommand})
execute_process(
COMMAND ${cmakeCommand}
WORKING_DIRECTORY ${depBinaryDir}
RESULT_VARIABLE result
)

if (NOT ${result} EQUAL 0)
message(FATAL_ERROR "Configuration failed for dependency project ${AWS_PREBUILD_DEPENDENCY_NAME}")
endif()
Expand Down
3 changes: 2 additions & 1 deletion cmake/AwsSIMD.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ else()
set(AWS_CLMUL_FLAG "-mpclmul")
set(AWS_SSE4_2_FLAG "-msse4.2")

# AWS Graviton3 processors use neoverse-v1
check_c_compiler_flag("-mtune=neoverse-v1" HAVE_MTUNE_NEOVERSE_V1)
if (HAVE_MTUNE_NEOVERSE_V1)
set(AWS_ARMv8_1_FLAG "-march=armv8-a+crc+crypto -mtune=neoverse-v1")
Expand Down Expand Up @@ -58,7 +59,7 @@ if (USE_CPU_EXTENSIONS)
_mm256_permutevar8x32_epi32(vec, vec);
return 0;
}" AWS_HAVE_AVX2_INTRINSICS)
}" AWS_HAVE_AVX2_INTRINSICS)

check_c_source_compiles("
#include <immintrin.h>
Expand Down
13 changes: 9 additions & 4 deletions include/aws/common/condition_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ AWS_COMMON_API
int aws_condition_variable_notify_all(struct aws_condition_variable *condition_variable);

/**
* Waits the calling thread on a notification from another thread.
* Waits the calling thread on a notification from another thread. This function must be called with the mutex locked
* by the calling thread otherwise the behavior is undefined. Spurious wakeups can occur and to avoid this causing
* any problems use the _pred version of this function.
*/
AWS_COMMON_API
int aws_condition_variable_wait(struct aws_condition_variable *condition_variable, struct aws_mutex *mutex);

/**
* Waits the calling thread on a notification from another thread. If predicate returns false, the wait is reentered,
* otherwise control returns to the caller.
* otherwise control returns to the caller. This function must be called with the mutex locked by the calling thread
* otherwise the behavior is undefined.
*/
AWS_COMMON_API
int aws_condition_variable_wait_pred(
Expand All @@ -87,7 +90,8 @@ int aws_condition_variable_wait_pred(

/**
* Waits the calling thread on a notification from another thread. Times out after time_to_wait. time_to_wait is in
* nanoseconds.
* nanoseconds. This function must be called with the mutex locked by the calling thread otherwise the behavior is
* undefined. Spurious wakeups can occur and to avoid this causing any problems use the _pred version of this function.
*/
AWS_COMMON_API
int aws_condition_variable_wait_for(
Expand All @@ -97,7 +101,8 @@ int aws_condition_variable_wait_for(

/**
* Waits the calling thread on a notification from another thread. Times out after time_to_wait. time_to_wait is in
* nanoseconds. If predicate returns false, the wait is reentered, otherwise control returns to the caller.
* nanoseconds. If predicate returns false, the wait is reentered, otherwise control returns to the caller. This
* function must be called with the mutex locked by the calling thread otherwise the behavior is undefined.
*/
AWS_COMMON_API
int aws_condition_variable_wait_for_pred(
Expand Down

0 comments on commit e992ff8

Please sign in to comment.