From 309c180400675053e911057a2fc9ecdcc59b7257 Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Tue, 2 Jan 2024 17:43:09 +0000 Subject: [PATCH 1/3] fix build: android/termux/clang-17.0 --- include/crow/json.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/crow/json.h b/include/crow/json.h index 3359a9cc0..d0a2138c0 100644 --- a/include/crow/json.h +++ b/include/crow/json.h @@ -1675,7 +1675,7 @@ namespace crow } else { -#if defined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) +#if defined(__APPLE__) || defined(__MACH__) || defined(__FreeBSD__) || defined(__ANDROID__) o = std::unique_ptr(new object(value)); #else (*o) = value; From 9c03767a4b50b8dfc41b80ce32d04523cb25c490 Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Wed, 3 Jan 2024 08:21:45 +0000 Subject: [PATCH 2/3] Android build links with liblog in places --- tests/CMakeLists.txt | 4 ++++ tests/ssl/CMakeLists.txt | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b895a79a6..41c9b2aa8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,6 +11,10 @@ add_executable(unittest ${TEST_SRCS}) target_link_libraries(unittest Crow::Crow) add_warnings_optimizations(unittest) +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Android") + target_link_libraries(unittest log) +endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set_target_properties(unittest PROPERTIES COMPILE_FLAGS "--coverage -fprofile-arcs -ftest-coverage") target_link_libraries(unittest gcov) diff --git a/tests/ssl/CMakeLists.txt b/tests/ssl/CMakeLists.txt index 07c6c5e36..5c240ad78 100644 --- a/tests/ssl/CMakeLists.txt +++ b/tests/ssl/CMakeLists.txt @@ -11,6 +11,10 @@ add_executable(ssltest ${TEST_SRCS}) target_link_libraries(ssltest Crow::Crow) add_warnings_optimizations(ssltest) +if("${CMAKE_SYSTEM_NAME}" STREQUAL "Android") + target_link_libraries(ssltest log) +endif() + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") set_target_properties(ssltest PROPERTIES COMPILE_FLAGS "--coverage -fprofile-arcs -ftest-coverage") target_link_libraries(ssltest gcov) From 6a52860cfa3d97df28710bf9d4d308874ec215a2 Mon Sep 17 00:00:00 2001 From: Keith Williams Date: Thu, 11 Jan 2024 03:21:42 +0000 Subject: [PATCH 3/3] Fix clang debug build (Android and FreeBSD) --- cmake/compiler_options.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmake/compiler_options.cmake b/cmake/compiler_options.cmake index ffe1d017c..133ee1461 100644 --- a/cmake/compiler_options.cmake +++ b/cmake/compiler_options.cmake @@ -11,6 +11,27 @@ function(add_warnings_optimizations target_name) $<$:/Zi /O2 /Ob1> $<$:/Zi /Ob0 /Od /RTC1> ) + elseif(NOT CMAKE_COMPILER_IS_GNU AND + "${CMAKE_SYSTEM_NAME}" STREQUAL "Android") + # clang on Android, no prof/gprof + target_compile_options(${target_name} + PRIVATE + -Wall + -Wextra + -Wpedantic + $<$:-O2> + $<$:-O0 -g> + ) + elseif(NOT CMAKE_COMPILER_IS_GNU) + # clang, no prof + target_compile_options(${target_name} + PRIVATE + -Wall + -Wextra + -Wpedantic + $<$:-O2> + $<$:-O0 -g -pg> + ) else() target_compile_options(${target_name} PRIVATE