diff options
-rw-r--r-- | CMakeLists.txt | 30 | ||||
-rw-r--r-- | ChangeLog | 3 |
2 files changed, 26 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7cd2a5e..1556b20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,30 +12,48 @@ set(VERSION_MAJOR "2") set(VERSION_MINOR "0") set(VERSION_RELEASE "3") set(VERSION_STR "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}") + +# pass macros to perprocessor add_definitions(-DO3000_VERSION="${VERSION_STR}") +# library name +set(LIB_NAME o3000) + # find libusb library (version 1.0.19 or higher is needed!) find_package(LibUSB REQUIRED) include_directories(.) include_directories(${LIBUSB_INCLUDE_DIRS}) -add_library( o3000 SHARED +add_library( ${LIB_NAME} SHARED o3000.c o3000_private.h o3000_xfer_handler.c o3000_xfer_handler.h ) -set_target_properties ( o3000 PROPERTIES - OUTPUT_NAME "o3000" +set_target_properties ( ${LIB_NAME} PROPERTIES + OUTPUT_NAME "${LIB_NAME}" VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}" SOVERSION ${VERSION_MAJOR} LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" ) -target_compile_options(o3000 PRIVATE -Wall -g -ggdb -O3 -fPIC) -target_link_libraries(o3000 pthread ${LIBUSB_LIBRARIES}) +target_compile_options(${LIB_NAME} PRIVATE -Wall -g -ggdb -O3 -fPIC) +target_link_libraries(${LIB_NAME} pthread ${LIBUSB_LIBRARIES}) -install(TARGETS o3000 DESTINATION lib) +install(TARGETS ${LIB_NAME} DESTINATION lib) install(FILES "o3000.h" "o3000_portable.h" "image_header.h" DESTINATION "include/o3000") + +add_custom_target(release_mingw64 DEPENDS ${LIB_NAME}) +add_custom_command( + TARGET release_mingw64 + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/libo3000-${VERSION_STR}/include + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/libo3000-${VERSION_STR}/MinGW64 + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/o3000.h ${CMAKE_CURRENT_BINARY_DIR}/libo3000-${VERSION_STR}/include + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/o3000_portable.h ${CMAKE_CURRENT_BINARY_DIR}/libo3000-${VERSION_STR}/include + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/image_header.h ${CMAKE_CURRENT_BINARY_DIR}/libo3000-${VERSION_STR}/include + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<TARGET_FILE_NAME:${LIB_NAME}>* ${CMAKE_CURRENT_BINARY_DIR}/libo3000-${VERSION_STR}/MinGW64 + COMMAND ${CMAKE_COMMAND} -E tar "cfv" "libo3000-${VERSION_STR}.zip" --format=zip libo3000-${VERSION_STR} + COMMAND ${CMAKE_COMMAND} -E remove_directory libo3000-${VERSION_STR} +)
\ No newline at end of file @@ -7,7 +7,8 @@ Version 2.0.3 * Added "paranoia check" for wraparound_chunk_size check in handle_transfer(). * Moved macro definition of MAX_IMAGE_SIZE from o3000.c to o3000_private.h. 2019-10-22 PR - * Library version defined in CMakeLists.txt. + * Library version defined in CMakeLists.txt and passed to preprocessor. + * MinGW64 relasing target added (see "make release_minGW64") Version 2.0.2 2018-04-11 PR |