2018-02-21 12:03:23 +00:00
|
|
|
function(build_fio)
|
|
|
|
# we use an external project and copy the sources to bin directory to ensure
|
|
|
|
# that object files are built outside of the source tree.
|
|
|
|
include(ExternalProject)
|
2022-05-02 03:42:17 +00:00
|
|
|
if(ALLOC_LIBS)
|
|
|
|
get_target_property(alloc_lib_path
|
|
|
|
${ALLOC_LIBS} IMPORTED_LOCATION)
|
|
|
|
get_filename_component(alloc_lib_dir
|
|
|
|
${alloc_lib_path} DIRECTORY)
|
|
|
|
get_filename_component(alloc_lib_name
|
|
|
|
${alloc_lib_path} NAME)
|
|
|
|
set(FIO_EXTLIBS "EXTLIBS='-L${alloc_lib_dir} -l:${alloc_lib_name}'")
|
2018-09-06 13:49:01 +00:00
|
|
|
endif()
|
2020-11-09 07:34:55 +00:00
|
|
|
|
|
|
|
include(FindMake)
|
|
|
|
find_make("MAKE_EXECUTABLE" "make_cmd")
|
|
|
|
|
2021-03-23 07:16:04 +00:00
|
|
|
set(source_dir ${CMAKE_BINARY_DIR}/src/fio)
|
|
|
|
file(MAKE_DIRECTORY ${source_dir})
|
2018-02-21 12:03:23 +00:00
|
|
|
ExternalProject_Add(fio_ext
|
|
|
|
UPDATE_COMMAND "" # this disables rebuild on each run
|
2021-08-27 16:14:55 +00:00
|
|
|
GIT_REPOSITORY "https://github.com/ceph/fio.git"
|
2020-08-25 04:34:15 +00:00
|
|
|
GIT_CONFIG advice.detachedHead=false
|
|
|
|
GIT_SHALLOW 1
|
2021-08-27 16:14:55 +00:00
|
|
|
GIT_TAG "fio-3.27-cxx"
|
2021-03-23 07:16:04 +00:00
|
|
|
SOURCE_DIR ${source_dir}
|
2018-02-21 12:03:23 +00:00
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
CONFIGURE_COMMAND <SOURCE_DIR>/configure
|
2022-05-02 03:42:17 +00:00
|
|
|
BUILD_COMMAND ${make_cmd} fio EXTFLAGS=-Wno-format-truncation "${FIO_EXTLIBS}"
|
2021-08-16 10:42:18 +00:00
|
|
|
INSTALL_COMMAND cp <BINARY_DIR>/fio ${CMAKE_BINARY_DIR}/bin
|
|
|
|
LOG_CONFIGURE ON
|
|
|
|
LOG_BUILD ON
|
|
|
|
LOG_INSTALL ON
|
|
|
|
LOG_MERGED_STDOUTERR ON
|
|
|
|
LOG_OUTPUT_ON_FAILURE ON)
|
2020-11-09 07:47:41 +00:00
|
|
|
|
|
|
|
add_library(fio INTERFACE IMPORTED)
|
|
|
|
add_dependencies(fio fio_ext)
|
|
|
|
set_target_properties(fio PROPERTIES
|
2021-03-23 07:16:04 +00:00
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${source_dir}
|
|
|
|
INTERFACE_COMPILE_OPTIONS "-include;${source_dir}/config-host.h;$<$<COMPILE_LANGUAGE:C>:-std=gnu99>$<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17>")
|
2018-02-21 12:03:23 +00:00
|
|
|
endfunction()
|