diff options
author | Chris Dyer <redpony@gmail.com> | 2015-04-02 00:50:04 -0400 |
---|---|---|
committer | Chris Dyer <redpony@gmail.com> | 2015-04-02 00:50:04 -0400 |
commit | 5ee02ce1602f2fce6d5af5db93c2278fe6c9ede5 (patch) | |
tree | 7ebad8dd99e38d190c579f425c3eb959363e96e5 /training/liblbfgs | |
parent | e7d77de8a9b9929b22fc6562f88f3668900f9662 (diff) | |
parent | 737ed7a7f932b1a7e40d2755bcdee6bc0aa2de63 (diff) |
Merge pull request #70 from redpony/cmake
Cmake
Diffstat (limited to 'training/liblbfgs')
-rw-r--r-- | training/liblbfgs/CMakeLists.txt | 37 | ||||
-rw-r--r-- | training/liblbfgs/Makefile.am | 21 |
2 files changed, 37 insertions, 21 deletions
diff --git a/training/liblbfgs/CMakeLists.txt b/training/liblbfgs/CMakeLists.txt new file mode 100644 index 00000000..d936c0ab --- /dev/null +++ b/training/liblbfgs/CMakeLists.txt @@ -0,0 +1,37 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/..) + + +set(lbfgs_STAT_SRCS + lbfgs.c + arithmetic_ansi.h + arithmetic_sse_double.h + arithmetic_sse_float.h + lbfgs++.h + lbfgs.h) + +add_library(lbfgs STATIC ${lbfgs_STAT_SRCS}) + +set(TEST_SRCS ll_test.cc) + +foreach(testSrc ${TEST_SRCS}) + #Extract the filename without an extension (NAME_WE) + get_filename_component(testName ${testSrc} NAME_WE) + + #Add compile target + set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"") + add_executable(${testName} ${testSrc}) + + #link to Boost libraries AND your targets and dependencies + target_link_libraries(${testName} lbfgs ${Boost_LIBRARIES} ${ZLIB_LIBRARIES}) + + #I like to move testing binaries into a testBin directory + set_target_properties(${testName} PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + + #Finally add it to test execution - + #Notice the WORKING_DIRECTORY and COMMAND + add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +endforeach(testSrc) + + diff --git a/training/liblbfgs/Makefile.am b/training/liblbfgs/Makefile.am deleted file mode 100644 index aa3af377..00000000 --- a/training/liblbfgs/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -noinst_LIBRARIES = liblbfgs.a - -noinst_PROGRAMS = ll_test -ll_test_SOURCES = ll_test.cc -ll_test_LDADD = liblbfgs.a -lz -TESTS = ll_test - -liblbfgs_a_SOURCES = \ - lbfgs.c \ - arithmetic_ansi.h \ - arithmetic_sse_double.h \ - arithmetic_sse_float.h \ - lbfgs++.h \ - lbfgs.h - -################################################################ -# do NOT NOT NOT add any other -I includes NO NO NO NO NO ###### -AM_LDFLAGS = liblbfgs.a -lz -AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wall -I$(top_srcdir)/training -I$(top_srcdir)/training/liblbfgs -################################################################ - |