Skip to content

Commit

Permalink
Use MariaDB instead of MySQL for techempower benchmarks
Browse files Browse the repository at this point in the history
(This will enable us to use some MariaDB-specific APIs in the future,
such as its async APIs!)
  • Loading branch information
lpereira committed Aug 5, 2024
1 parent b40a19d commit e5a6b6c
Showing 1 changed file with 28 additions and 48 deletions.
76 changes: 28 additions & 48 deletions src/samples/techempower/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,52 +1,32 @@
include(FindPkgConfig)
pkg_check_modules(SQLITE sqlite3>=3.6.20)

find_path(MYSQL_INCLUDE_DIR mysql.h
/usr/local/include/mysql
/usr/include/mysql
/usr/local/include/mariadb
/usr/include/mariadb
)

if (MYSQL_INCLUDE_DIR AND SQLITE_FOUND)
message(STATUS "Found MySQL includes at ${MYSQL_INCLUDE_DIR}")
include_directories(AFTER ${MYSQL_INCLUDE_DIR})

set(MYSQL_NAMES mysqlclient mysqlclient_r)
find_library(MYSQL_LIBRARY
NAMES ${MYSQL_NAMES}
PATH_SUFFIXES mysql
)

if (MYSQL_LIBRARY)
message(STATUS "Found MySQL client library at ${MYSQL_LIBRARY}")

add_executable(techempower
techempower.c
json.c
database.c
)

target_link_libraries(techempower
${LWAN_COMMON_LIBS}
${ADDITIONAL_LIBRARIES}
${SQLITE_LIBRARIES}
${SQLITE_LDFLAGS}
${MYSQL_LIBRARY}
)
include_directories(${SQLITE_INCLUDE_DIRS})
include_directories(BEFORE ${CMAKE_BINARY_DIR})

if (${CMAKE_BUILD_TYPE} MATCHES "Coverage")
find_package(PythonInterp 3)

if (PYTHONINTERP_FOUND)
add_dependencies(generate-coverage techempower)
endif()
endif ()
endif ()
endif ()

if (NOT MYSQL_LIBRARY)
pkg_check_modules(MARIADB mariadb>=3.3)

if (MARIADB_FOUND AND SQLITE_FOUND)
add_executable(techempower
techempower.c
json.c
database.c
)

target_link_libraries(techempower
${LWAN_COMMON_LIBS}
${ADDITIONAL_LIBRARIES}
${SQLITE_LIBRARIES}
${SQLITE_LDFLAGS}
${MARIADB_LDFLAGS}
${MARIADB_LIBRARIES}
)
include_directories(${SQLITE_INCLUDE_DIRS} ${MARIADB_INCLUDE_DIRS})
include_directories(BEFORE ${CMAKE_BINARY_DIR})

if (${CMAKE_BUILD_TYPE} MATCHES "Coverage")
find_package(PythonInterp 3)

if (PYTHONINTERP_FOUND)
add_dependencies(generate-coverage techempower)
endif()
endif ()
else ()
message(STATUS "Not building benchmark suite: database libraries not found.")
endif ()

0 comments on commit e5a6b6c

Please sign in to comment.