Skip to content

Commit

Permalink
Fixing cmake files for Linux build and module.
Browse files Browse the repository at this point in the history
  • Loading branch information
mppf committed Sep 30, 2014
1 parent 4c26934 commit 8dd9996
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 31 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8)
project(FEMTO)
project(FEMTO C CXX)

set(FEMTO_VERSION "femto 1.2.9.2 from http://github.com/femto-dev/femto")

Expand All @@ -24,6 +24,7 @@ else(NO_FLEX_BISON)
find_package(BISON)
endif(NO_FLEX_BISON)

find_package(Threads REQUIRED)
find_package(MPI)

#if(NOT ${BISON_VERSION} EQUAL:
Expand Down Expand Up @@ -70,6 +71,12 @@ enable_testing()

set(CMAKE_CXX_FLAGS "-g -Wall")

# Add libaries used everywhere
set(DEFAULT_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
if( DEFINED HAVE_CLOCK_GETTIME_RT OR DEFINED HAS_POSIX_AIO_RT)
set(DEFAULT_LIBRARIES "${DEFAULT_LIBRARIES} -lrt")
endif()

# Emulate make check
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})

Expand Down
32 changes: 21 additions & 11 deletions cmake/FindAPXS.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
FIND_PROGRAM(APXS_BIN NAMES apxs apxs2
PATH_SUFFIXES httpd apache apache2)

if(APXS_BIN)
EXECUTE_PROCESS(COMMAND ${APXS_BIN} -q INCLUDEDIR OUTPUT_VARIABLE APXS_INCLUDE_DIR)
EXECUTE_PROCESS(COMMAND ${APXS_BIN} -q LIBEXECDIR OUTPUT_VARIABLE APXS_MODULE_DIR )
#message(WARNING "APXS was found ${AXPS_INCLUDE_DIR}")
else(APXS_BIN)
# message(WARNING "APXS not found")

endif(APXS_BIN)


set(APACHE_INCLUDE_DIRS ${APXS_INCLUDE_DIR})
set(APACHE_MODULE_DIRS ${APXS_MODULE_DIR})


include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(APXS DEFAULT_MSG APXS_BIN APXS_INCLUDE_DIR APXS_MODULE_DIR)
mark_as_advanced(APXS_BIN APXS_INCLUDE_DIR APXS_MODULE_DIR)


if(NOT DEFINED APACHE_MODULE_DIR)
find_program(APXS_BIN NAMES apxs apxs2
PATH_SUFFIXES httpd apache apache2
)

if(APXS_BIN)
EXEC_PROGRAM(${APXS_BIN}
ARGS -q LIBEXECDIR
OUTPUT_VARIABLE APACHE_MODULE_DIR )
endif(APXS_BIN)
endif(NOT DEFINED APACHE_MODULE_DIR)

7 changes: 6 additions & 1 deletion src/dcx_cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ set(FEMTO_DCX_CC_SRCS

add_library(femto_dcx_cc STATIC ${FEMTO_DCX_CC_SRCS})

set(DCX_LIBS femto_dcx_cc femto_seq femto femto_bwt femto_mpi_cc femto_util_cc femto_util ssl crypto)
set(DCX_LIBS femto_dcx_cc femto_seq femto femto_bwt femto_mpi_cc femto_util_cc femto_util ssl crypto ${DEFAULT_LIBRARIES})

if(HAS_LINUX_LIBAIO)
set(DCX_LIBS "${DCX_LIBS} -laio")
endif()


set(DCX_TESTS dcover_test suffix_sort_test)

Expand Down
14 changes: 7 additions & 7 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ add_library(femto_bwt STATIC ${FEMTO_BWT_SRCS})
add_library(femto_seq STATIC ${FEMTO_SEQ_SRCS})

add_executable(femto_multiquery query_tool.c)
target_link_libraries(femto_multiquery femto femto_bwt femto_util)
target_link_libraries(femto_multiquery femto femto_bwt femto_util ${DEFAULT_LIBRARIES})
add_executable(femto_flatten flatten_tool.c)
target_link_libraries(femto_flatten femto femto_bwt femto_util)
target_link_libraries(femto_flatten femto femto_bwt femto_util ${DEFAULT_LIBRARIES})
add_executable(femto_handle_request handle_request.c)
target_link_libraries(femto_handle_request femto femto_bwt femto_util)
target_link_libraries(femto_handle_request femto femto_bwt femto_util ${DEFAULT_LIBRARIES})
add_executable(femto_info info_tool.c)
target_link_libraries(femto_info femto femto_bwt femto_util)
target_link_libraries(femto_info femto femto_bwt femto_util ${DEFAULT_LIBRARIES})
add_executable(femto_common common_tool.c)
target_link_libraries(femto_common femto femto_bwt femto_util)
target_link_libraries(femto_common femto femto_bwt femto_util ${DEFAULT_LIBRARIES})
install(TARGETS femto_flatten femto_handle_request femto_info femto_common
${INSTALL_TARGETS_DEFAULT_ARGS})

Expand All @@ -112,7 +112,7 @@ set(FEMTO_TESTS
foreach(test ${FEMTO_TESTS})
add_executable(${test} EXCLUDE_FROM_ALL ${test}.c)
add_test(${test} ${test})
target_link_libraries(${test} femto femto_bwt femto_util)
target_link_libraries(${test} femto femto_bwt femto_util ${DEFAULT_LIBRARIES})
add_dependencies(check ${test})
endforeach(test)

Expand All @@ -124,7 +124,7 @@ set(BWT_TESTS
foreach(test ${BWT_TESTS})
add_executable(${test} EXCLUDE_FROM_ALL ${test}.c bwt_creator.h bwt_creator.c bwt_qsufsort.c)
add_test(${test} ${test})
target_link_libraries(${test} femto femto_bwt femto_util)
target_link_libraries(${test} femto femto_bwt femto_util ${DEFAULT_LIBRARIES})
add_dependencies(check ${test})
endforeach(test)

Expand Down
2 changes: 1 addition & 1 deletion src/main_cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include_directories(${CMAKE_SOURCE_DIR}/src/re2/re2)
add_executable(femto_search search_tool.cc)
#link_directories(${RE2_LIB_DIR})
#target_link_libraries(femto_search re2 femto_seq femto femto_util)
target_link_libraries(femto_search ${RE2_LIB} femto_seq femto femto_util)
target_link_libraries(femto_search ${RE2_LIB} femto_seq femto femto_util ${DEFAULT_LIBRARIES})
add_dependencies(femto_search make_re2)

install(TARGETS femto_search
Expand Down
18 changes: 14 additions & 4 deletions src/mod_femto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# include ../util
include_directories(${CMAKE_SOURCE_DIR}/src/utils)
# include ../util_cc
#include_directories(${CMAKE_SOURCE_DIR}/src/utils_cc)
# include ../main
include_directories(${CMAKE_SOURCE_DIR}/src/main)
# include ../mpi
#include_directories(${CMAKE_SOURCE_DIR}/src/mpi)
# include ../re2
#include_directories(${CMAKE_SOURCE_DIR}/src/re2/re2/)

find_package(APR)
find_package(APXS)
Expand All @@ -16,18 +26,18 @@ if(APR_FOUND)
#apxs-install:
# ${APXS} -i -a -n femto libmod_femto.la
#
execute_process(COMMAND ${APXS} -q INCLUDEDIR OUTPUT_VARIABLE APXS_INCLUDE)
include_directories(${APXS_INCLUDE})
# execute_process(COMMAND ${APXS} -q INCLUDEDIR OUTPUT_VARIABLE APXS_INCLUDE)
#include_directories(${APXS_INCLUDE})

add_library(libmod_femto mod_femto.c)
target_link_libraries(libmod_femto ${APR_LIBRARY} ${APU_LIBRARY})
include_directories(${APR_INCLUDE_DIR} ${APU_INCLUDE_DIR})
include_directories(${APXS_INCLUDE_DIR} ${APR_INCLUDE_DIR} ${APU_INCLUDE_DIR})
if(DEFINED APR_CPPFLAGS)
add_definitions("${APR_CPPFLAGS}")
endif(DEFINED APR_CPPFLAGS)

add_definitions(-D_LARGEFILE64_SOURCE -D_GNU_SOURCE)
#building just a library.
add_library(libmod_femto mod_femto.c)
target_link_libraries(libmod_femto libfemto libfemto_util -module)
endif(APXS_FOUND)
endif(APR_FOUND)
Expand Down
4 changes: 2 additions & 2 deletions src/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(MPI_CC_TESTS mpi_utils_test)
foreach(test ${MPI_CC_TESTS})
add_executable(${test} EXCLUDE_FROM_ALL ${test}.cc)
add_test(${test} ${test})
target_link_libraries(${test} femto_mpi_cc femto_util_cc femto_util)
target_link_libraries(${test} femto_mpi_cc femto_util_cc femto_util ${DEFAULT_LIBRARIES})
add_dependencies(check ${test})
endforeach(test)

Expand All @@ -25,7 +25,7 @@ install(TARGETS femto_hello_mpi ${INSTALL_TARGETS_DEFAULT_ARGS})

add_executable(femto_mpi_cp mpi_cp.cc)

target_link_libraries(femto_mpi_cp femto_mpi_cc femto_util_cc femto_util)
target_link_libraries(femto_mpi_cp femto_mpi_cc femto_util_cc femto_util ${DEFAULT_LIBRARIES})

install(TARGETS femto_mpi_cp ${INSTALL_TARGETS_DEFAULT_ARGS})

Expand Down
10 changes: 6 additions & 4 deletions src/utils_cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ set(FEMTO_UTIL_CC_SRCS
io_pipe.hh
io_pipe.cc)

#if( DEFINED ${HAS_POSIX_AIO_RT} OR DEFINED ${HAS_POSIX_AIO_C})
# Add libaries used everywhere
set(LOCAL_DEFAULT_LIBRARIES "${DEFAULT_LIBRARIES}")

if( DEFINED HAS_POSIX_AIO_RT OR DEFINED HAS_POSIX_AIO_C)
#if(${HAS_POSIX_AIO_RT} or ${HAS_POSIX_AIO_C})
set(FEMTO_UTIL_CC_SRCS ${FEMTO_UTIL_CC_SRCS} aio_pipe.hh aio_pipe.cc)
endif()

if(HAS_LINUX_LIBAIO)
set(FEMTO_UTIL_CC_SRCS ${FEMTO_UTIL_CC_SRCS} kaio_pipe.hh kaio_pipe.cc)
set(LOCAL_DEFAULT_LIBRARIES "${LOCAL_DEFAULT_LIBRARIES} -laio")
endif()

# include ../util
Expand All @@ -68,14 +70,14 @@ set(UTIL_CC_TESTS
foreach(test ${UTIL_CC_TESTS})
add_executable(${test} EXCLUDE_FROM_ALL ${test}.cc example_record.hh)
add_test(${test} ${test})
target_link_libraries(${test} femto_util_cc femto_util)
target_link_libraries(${test} femto_util_cc femto_util ${LOCAL_DEFAULT_LIBRARIES})
add_dependencies(check ${test})
endforeach(test)


add_executable(femto_sort_tests sort_tests.hh sort_tests.cc)

target_link_libraries(femto_sort_tests femto_util_cc femto_util)
target_link_libraries(femto_sort_tests femto_util_cc femto_util ${LOCAL_DEFAULT_LIBRARIES})

install(TARGETS femto_sort_tests ${INSTALL_TARGETS_DEFAULT_ARGS})

Expand Down

0 comments on commit 8dd9996

Please sign in to comment.