summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <cdyer@vivace.clab.cs.cmu.edu>2015-03-04 22:46:33 -0500
committerChris Dyer <cdyer@vivace.clab.cs.cmu.edu>2015-03-04 22:46:33 -0500
commitd99c7b9593e5f0c4a408302b82e7bfeaeee665bc (patch)
tree45d90a199b40ed8e5bdb40cc2f1361b697c2fe79
parenta003126ab5a172ef6d1de2a857e8ccfb90688a68 (diff)
deal with libdl
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt1
-rw-r--r--cmake/FindLibDL.cmake30
-rw-r--r--decoder/CMakeLists.txt4
-rw-r--r--extractor/CMakeLists.txt10
-rw-r--r--training/crf/CMakeLists.txt22
-rw-r--r--training/dtrain/CMakeLists.txt2
-rw-r--r--training/latent_svm/CMakeLists.txt2
-rw-r--r--training/mira/CMakeLists.txt7
-rw-r--r--training/utils/CMakeLists.txt6
-rw-r--r--utils/CMakeLists.txt2
11 files changed, 59 insertions, 28 deletions
diff --git a/.gitignore b/.gitignore
index 81ede92e..07145db9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+example_extff/libff_example.so*
Testing/
*/Testing/
training/Testing/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21c2a230..934c69e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/cmake/FindLibDL.cmake b/cmake/FindLibDL.cmake
new file mode 100644
index 00000000..1689e4c7
--- /dev/null
+++ b/cmake/FindLibDL.cmake
@@ -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 )
diff --git a/decoder/CMakeLists.txt b/decoder/CMakeLists.txt
index 591ab7b3..f7683887 100644
--- a/decoder/CMakeLists.txt
+++ b/decoder/CMakeLists.txt
@@ -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)
@@ -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
diff --git a/extractor/CMakeLists.txt b/extractor/CMakeLists.txt
index 1cf8533b..93a524cc 100644
--- a/extractor/CMakeLists.txt
+++ b/extractor/CMakeLists.txt
@@ -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
@@ -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})
diff --git a/training/crf/CMakeLists.txt b/training/crf/CMakeLists.txt
index 4792983e..85fab7a0 100644
--- a/training/crf/CMakeLists.txt
+++ b/training/crf/CMakeLists.txt
@@ -9,7 +9,7 @@ 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 ###############
@@ -17,8 +17,7 @@ set(mpi_adagrad_optimize_SRCS mpi_adagrad_optimize.cc cllh_observer.cc cllh_obse
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 ###############
@@ -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 ###############
@@ -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 ###############
@@ -47,8 +44,7 @@ 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 ###############
@@ -56,8 +52,7 @@ 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 ###############
@@ -65,7 +60,7 @@ 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 ###############
@@ -73,6 +68,5 @@ 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})
diff --git a/training/dtrain/CMakeLists.txt b/training/dtrain/CMakeLists.txt
index 653cfe2b..72e80b6b 100644
--- a/training/dtrain/CMakeLists.txt
+++ b/training/dtrain/CMakeLists.txt
@@ -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})
diff --git a/training/latent_svm/CMakeLists.txt b/training/latent_svm/CMakeLists.txt
index ec48e02f..332b8d42 100644
--- a/training/latent_svm/CMakeLists.txt
+++ b/training/latent_svm/CMakeLists.txt
@@ -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})
diff --git a/training/mira/CMakeLists.txt b/training/mira/CMakeLists.txt
index 3a8fa516..bba9ef5f 100644
--- a/training/mira/CMakeLists.txt
+++ b/training/mira/CMakeLists.txt
@@ -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})
diff --git a/training/utils/CMakeLists.txt b/training/utils/CMakeLists.txt
index 1734ee73..2753b9f0 100644
--- a/training/utils/CMakeLists.txt
+++ b/training/utils/CMakeLists.txt
@@ -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
@@ -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})
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 59fb644d..58668254 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -1,4 +1,4 @@
-include_directories()
+set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(TEST_SRCS dict_test.cc
logval_test.cc