mirror of https://github.com/vitalif/grive2
Major refactor
Since we've decided to keep the two projects separated it's necessary that if some one wants to clone the repository he has a clear idea of what's going on here: in src/lib folder there are the three main components of the library libgrive (drive, protocol and util); while in the src/cli folder there's the command line interface tool that uses the library. The CLI is called in the same way as the library (grive). In this way, we can keep multiple clients using the same library in just one repo..pull/40/head
parent
e7ab019c5f
commit
cfca4513e4
|
@ -9,78 +9,16 @@ find_package(JSONC REQUIRED)
|
|||
find_package(CURL REQUIRED)
|
||||
find_package(CppUnit)
|
||||
|
||||
# Common include
|
||||
include_directories( ${grive_SOURCE_DIR}/src/lib
|
||||
${OPT_INCS}
|
||||
)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
IF ( CPPUNIT_FOUND )
|
||||
message("-- Building unitary tests along with the library and the binary")
|
||||
set( OPT_INCS ${CPPUNIT_INCLUDE_DIR} )
|
||||
add_subdirectory(test)
|
||||
ENDIF ( CPPUNIT_FOUND )
|
||||
|
||||
include_directories(
|
||||
${grive_SOURCE_DIR}/src
|
||||
${OPT_INCS}
|
||||
)
|
||||
|
||||
file(GLOB DRIVE_HEADERS
|
||||
${grive_SOURCE_DIR}/src/drive/*.hh
|
||||
)
|
||||
|
||||
file (GLOB PROTOCOL_HEADERS
|
||||
${grive_SOURCE_DIR}/src/protocol/*.hh
|
||||
)
|
||||
|
||||
file (GLOB UTIL_HEADERS
|
||||
${grive_SOURCE_DIR}/src/util/*.hh
|
||||
)
|
||||
|
||||
add_library( fgrive SHARED
|
||||
src/drive/Collection.cc
|
||||
src/drive/Drive.cc
|
||||
src/protocol/Download.cc
|
||||
src/protocol/HTTP.cc
|
||||
src/protocol/Json.cc
|
||||
src/protocol/OAuth2.cc
|
||||
src/util/Crypt.cc
|
||||
src/util/DateTime.cc
|
||||
src/util/OS.cc
|
||||
src/util/Path.cc
|
||||
)
|
||||
|
||||
add_executable( grive
|
||||
src/main.cc
|
||||
)
|
||||
|
||||
target_link_libraries( fgrive
|
||||
${CURL_LIBRARIES}
|
||||
${JSONC_LIBRARY}
|
||||
${OPENSSL_LIBRARIES}
|
||||
)
|
||||
|
||||
target_link_libraries( grive
|
||||
fgrive
|
||||
)
|
||||
|
||||
set_target_properties(fgrive PROPERTIES
|
||||
SOVERSION 0 VERSION 0.0.1
|
||||
)
|
||||
|
||||
IF ( CPPUNIT_FOUND )
|
||||
add_executable( unittest
|
||||
test/UnitTest.cc
|
||||
test/util/DateTimeTest.cc
|
||||
test/util/FunctionTest.cc
|
||||
test/util/PathTest.cc
|
||||
)
|
||||
|
||||
target_link_libraries( unittest
|
||||
fgrive
|
||||
${CPPUNIT_LIBRARY}
|
||||
)
|
||||
else ( CPPUNIT_FOUND )
|
||||
message( STATUS "skip building unittest" )
|
||||
endif ( CPPUNIT_FOUND )
|
||||
|
||||
|
||||
## Install targets
|
||||
install(TARGETS fgrive LIBRARY DESTINATION lib)
|
||||
install(TARGETS grive RUNTIME DESTINATION bin)
|
||||
install(FILES ${DRIVE_HEADERS} DESTINATION include/grive/drive)
|
||||
install(FILES ${PROTOCOL_HEADERS} DESTINATION include/grive/protocol)
|
||||
install(FILES ${UTIL_HEADERS} DESTINATION include/grive/util)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
# Keep the order right
|
||||
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(cli)
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
add_executable( grive_executable
|
||||
main.cc
|
||||
)
|
||||
|
||||
target_link_libraries( grive_executable
|
||||
grive
|
||||
)
|
||||
|
||||
set_target_properties( grive_executable
|
||||
PROPERTIES OUTPUT_NAME grive
|
||||
)
|
||||
|
||||
install(TARGETS grive_executable RUNTIME DESTINATION bin)
|
|
@ -0,0 +1,46 @@
|
|||
# lib subproject
|
||||
|
||||
file(GLOB DRIVE_SOURCES
|
||||
drive/*.cc
|
||||
)
|
||||
|
||||
file(GLOB PROTOCOL_SOURCES
|
||||
protocol/*.cc
|
||||
)
|
||||
|
||||
file(GLOB UTIL_SOURCES
|
||||
util/*.cc
|
||||
)
|
||||
|
||||
file(GLOB DRIVE_HEADERS
|
||||
drive/*.hh
|
||||
)
|
||||
|
||||
file (GLOB PROTOCOL_HEADERS
|
||||
protocol/*.hh
|
||||
)
|
||||
|
||||
file (GLOB UTIL_HEADERS
|
||||
util/*.hh
|
||||
)
|
||||
|
||||
add_library( grive SHARED
|
||||
${DRIVE_SOURCES}
|
||||
${PROTOCOL_SOURCES}
|
||||
${UTIL_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries( grive
|
||||
${CURL_LIBRARIES}
|
||||
${JSONC_LIBRARY}
|
||||
${OPENSSL_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties(grive PROPERTIES
|
||||
SOVERSION 0 VERSION 0.0.1
|
||||
)
|
||||
|
||||
install(TARGETS grive LIBRARY DESTINATION lib)
|
||||
install(FILES ${DRIVE_HEADERS} DESTINATION include/grive/drive)
|
||||
install(FILES ${PROTOCOL_HEADERS} DESTINATION include/grive/protocol)
|
||||
install(FILES ${UTIL_HEADERS} DESTINATION include/grive/util)
|
|
@ -0,0 +1,14 @@
|
|||
# test subfolder
|
||||
|
||||
file(GLOB UTIL_TESTS util/*.cc)
|
||||
|
||||
|
||||
add_executable( unittest
|
||||
UnitTest.cc
|
||||
${UTIL_TESTS}
|
||||
)
|
||||
|
||||
target_link_libraries(unittest
|
||||
grive
|
||||
${CPPUNIT_LIBRARY}
|
||||
)
|
Loading…
Reference in New Issue