Skip to content

Commit

Permalink
deal with libdl
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dyer committed Mar 5, 2015
1 parent 3d2a607 commit 42e6a28
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
example_extff/libff_example.so*
Testing/
*/Testing/
training/Testing/
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
#### packages
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
find_package(LibDL REQUIRED)

# for pycdec
find_package(PythonInterp 2.7 REQUIRED)
Expand Down
30 changes: 30 additions & 0 deletions cmake/FindLibDL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# - Find libdl
# Find the native LIBDL includes and library
#
# LIBDL_INCLUDE_DIR - where to find dlfcn.h, etc.
# LIBDL_LIBRARIES - List of libraries when using libdl.
# LIBDL_FOUND - True if libdl found.


IF (LIBDL_INCLUDE_DIR)
# Already in cache, be silent
SET(LIBDL_FIND_QUIETLY TRUE)
ENDIF (LIBDL_INCLUDE_DIR)

FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h)

SET(LIBDL_NAMES dl libdl ltdl libltdl)
FIND_LIBRARY(LIBDL_LIBRARY NAMES ${LIBDL_NAMES} )

# handle the QUIETLY and REQUIRED arguments and set LIBDL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG LIBDL_LIBRARY LIBDL_INCLUDE_DIR)

IF(LIBDL_FOUND)
SET( LIBDL_LIBRARIES ${LIBDL_LIBRARY} )
ELSE(LIBDL_FOUND)
SET( LIBDL_LIBRARIES )
ENDIF(LIBDL_FOUND)

MARK_AS_ADVANCED( LIBDL_LIBRARY LIBDL_INCLUDE_DIR )
4 changes: 3 additions & 1 deletion decoder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mteval)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../klm)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

PROJECT(decoder C CXX)

find_package(FLEX REQUIRED)
Expand Down Expand Up @@ -145,7 +147,7 @@ add_library(libcdec STATIC ${libcdec_SRCS})

set(cdec_SRCS cdec.cc)
add_executable(cdec ${cdec_SRCS})
target_link_libraries(cdec libcdec mteval utils ksearch klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
target_link_libraries(cdec libcdec mteval utils ksearch klm klm_util klm_util_double ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBDL_LIBRARIES})

set(TEST_SRCS
grammar_test.cc
Expand Down
10 changes: 6 additions & 4 deletions extractor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

find_package(GTest REQUIRED)
find_package(GMock REQUIRED)
if(GMOCK_FOUND)
find_package(GTest)
find_package(GMock)
if(GTEST_FOUND)
if(GMOCK_FOUND)
#rule_factory_test.cc
set(TEST_SRCS alignment_test.cc
data_array_test.cc
Expand Down Expand Up @@ -50,7 +51,8 @@ if(GMOCK_FOUND)
add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach(testSrc)
endif(GMOCK_FOUND)
endif(GMOCK_FOUND)
endif(GTEST_FOUND)

set(sacompile_SRCS sacompile.cc)
add_executable(sacompile ${sacompile_SRCS})
Expand Down
22 changes: 8 additions & 14 deletions training/crf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)

set(mpi_batch_optimize_SRCS mpi_batch_optimize.cc cllh_observer.cc cllh_observer.h)
add_executable(mpi_batch_optimize ${mpi_batch_optimize_SRCS})
target_link_libraries(mpi_batch_optimize training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
target_link_libraries(mpi_batch_optimize training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})

########### next target ###############

set(mpi_adagrad_optimize_SRCS mpi_adagrad_optimize.cc cllh_observer.cc cllh_observer.h)

add_executable(mpi_adagrad_optimize ${mpi_adagrad_optimize_SRCS})

target_link_libraries(mpi_adagrad_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)

target_link_libraries(mpi_adagrad_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})


########### next target ###############
Expand All @@ -27,8 +26,7 @@ set(mpi_compute_cllh_SRCS mpi_compute_cllh.cc cllh_observer.cc cllh_observer.h)

add_executable(mpi_compute_cllh ${mpi_compute_cllh_SRCS})

target_link_libraries(mpi_compute_cllh ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)

target_link_libraries(mpi_compute_cllh ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})


########### next target ###############
Expand All @@ -37,8 +35,7 @@ set(mpi_extract_features_SRCS mpi_extract_features.cc)

add_executable(mpi_extract_features ${mpi_extract_features_SRCS})

target_link_libraries(mpi_extract_features ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)

target_link_libraries(mpi_extract_features ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})


########### next target ###############
Expand All @@ -47,32 +44,29 @@ set(mpi_extract_reachable_SRCS mpi_extract_reachable.cc)

add_executable(mpi_extract_reachable ${mpi_extract_reachable_SRCS})

target_link_libraries(mpi_extract_reachable ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)

target_link_libraries(mpi_extract_reachable ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})

########### next target ###############

set(mpi_flex_optimize_SRCS mpi_flex_optimize.cc)

add_executable(mpi_flex_optimize ${mpi_flex_optimize_SRCS})

target_link_libraries(mpi_flex_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)

target_link_libraries(mpi_flex_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})

########### next target ###############

set(mpi_online_optimize_SRCS mpi_online_optimize.cc)

add_executable(mpi_online_optimize ${mpi_online_optimize_SRCS})

target_link_libraries(mpi_online_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
target_link_libraries(mpi_online_optimize ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})

########### next target ###############

set(mpi_baum_welch_SRCS mpi_baum_welch.cc)

add_executable(mpi_baum_welch ${mpi_baum_welch_SRCS})

target_link_libraries(mpi_baum_welch ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)

target_link_libraries(mpi_baum_welch ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})

2 changes: 1 addition & 1 deletion training/dtrain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ set(dtrain_SRCS
pairsampling.h
score.h)
add_executable(dtrain ${dtrain_SRCS})
target_link_libraries(dtrain libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
target_link_libraries(dtrain libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
2 changes: 1 addition & 1 deletion training/latent_svm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)

set(latent_svm_SRCS latent_svm.cc)
add_executable(latent_svm ${latent_svm_SRCS})
target_link_libraries(latent_svm libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
target_link_libraries(latent_svm libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
7 changes: 3 additions & 4 deletions training/mira/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)

set(kbest_mira_SRCS kbest_mira.cc)
add_executable(kbest_mira ${kbest_mira_SRCS})
target_link_libraries(kbest_mira ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
target_link_libraries(kbest_mira libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})

set(kbest_cut_mira_SRCS kbest_cut_mira.cc)
add_executable(kbest_cut_mira ${kbest_cut_mira_SRCS})
target_link_libraries(kbest_cut_mira ${KDE4_KDECORE_LIBS} libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)
target_link_libraries(kbest_cut_mira libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})

set(ada_opt_sm_SRCS ada_opt_sm.cc)
add_executable(ada_opt_sm ${ada_opt_sm_SRCS})
target_link_libraries(ada_opt_sm ${KDE4_KDECORE_LIBS} training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z)

target_link_libraries(ada_opt_sm training_utils libcdec ksearch mteval utils klm klm_util klm_util_double ${Boost_LIBRARIES} z ${LIBDL_LIBRARIES})
6 changes: 4 additions & 2 deletions training/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../utils)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../mteval)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../decoder)

find_package(Threads REQUIRED)

set(training_utils_STAT_SRCS
candidate_set.h
entropy.h
Expand All @@ -21,11 +23,11 @@ add_library(training_utils STATIC ${training_utils_STAT_SRCS})

set(sentserver_SRCS sentserver.cc)
add_executable(sentserver ${sentserver_SRCS})
target_link_libraries(sentserver)
target_link_libraries(sentserver ${CMAKE_THREAD_LIBS_INIT})

set(sentclient_SRCS sentclient.cc)
add_executable(sentclient ${sentclient_SRCS})
target_link_libraries(sentclient)
target_link_libraries(sentclient ${CMAKE_THREAD_LIBS_INIT})

set(grammar_convert_SRCS grammar_convert.cc)
add_executable(grammar_convert ${grammar_convert_SRCS})
Expand Down
2 changes: 1 addition & 1 deletion utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include_directories()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(TEST_SRCS dict_test.cc
logval_test.cc
Expand Down

0 comments on commit 42e6a28

Please sign in to comment.