use shared linking and install rules

This commit is contained in:
c9s 2014-05-16 20:30:31 +08:00
parent 9567cb7947
commit b34aa75924
3 changed files with 11 additions and 3 deletions

View file

@ -30,6 +30,10 @@ enable_testing()
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(tests) add_subdirectory(tests)
install (FILES include/r3.h DESTINATION include)
install (FILES include/r3_define.h DESTINATION include)
install (FILES include/r3_str.h DESTINATION include)
add_test(test_r3 ${CMAKE_CURRENT_BINARY_DIR}/tests/test_r3) add_test(test_r3 ${CMAKE_CURRENT_BINARY_DIR}/tests/test_r3)
add_executable(demo demo.c) add_executable(demo demo.c)

View file

@ -1,14 +1,16 @@
cmake_minimum_required(VERSION 2.8)
include_directories("${PROJECT_SOURCE_DIR}/include") include_directories("${PROJECT_SOURCE_DIR}/include")
# install(TARGETS swiftnav-static DESTINATION lib${LIB_SUFFIX}) # install(TARGETS swiftnav-static DESTINATION lib${LIB_SUFFIX})
set(libr3_SRCS node.c str.c list.c token.c) set(R3_SRCS node.c str.c list.c token.c)
set(CMAKE_CFLAGS "-Wall -pipe -g3 -funroll-loops") set(CMAKE_CFLAGS "-Wall -pipe -g3 -funroll-loops")
set(LIBS ${LIBS} ${PCRE_LIBRARIES} ${Judy_LIBRARIES} ${Jemalloc_LIBRARIES} r3) set(LIBS ${LIBS} ${PCRE_LIBRARIES} ${Judy_LIBRARIES} ${Jemalloc_LIBRARIES} r3)
# add_library(r3-static STATIC ${libr3_SRCS}) # add_library(r3-static STATIC ${libr3_SRCS})
add_library(r3 SHARED ${libr3_SRCS}) add_library(r3 SHARED ${R3_SRCS})
# add_library(r3 STATIC ${R3_SRCS})
target_link_libraries(r3 ${LIBS}) target_link_libraries(r3 ${LIBS})
install (TARGETS r3 DESTINATION lib)
# target_link_libraries(r3 cblas) # target_link_libraries(r3 cblas)
# install(FILES ${libswiftnav_HEADERS} DESTINATION include/libswiftnav) # install(FILES ${libswiftnav_HEADERS} DESTINATION include/libswiftnav)

View file

@ -3,3 +3,5 @@
1400242814,5653481.02 1400242814,5653481.02
1400242868,5857187.70 1400242868,5857187.70
1400242938,5732228.92 1400242938,5732228.92
1400243193,5959689.05
1400243423,5717292.34

1 1400242718 5649455.80
3 1400242814 5653481.02
4 1400242868 5857187.70
5 1400242938 5732228.92
6 1400243193 5959689.05
7 1400243423 5717292.34