# HG changeset patch # User Mike Becker # Date 1576848581 -3600 # Node ID 460c0258bb5b8a9bd51a76c175134e89f6c231ba # Parent be77fb2da242d115855cbefc49ce2f1a2ca00e6c adds proper cmake build targets diff -r be77fb2da242 -r 460c0258bb5b CMakeLists.txt --- a/CMakeLists.txt Thu Dec 19 19:58:41 2019 +0100 +++ b/CMakeLists.txt Fri Dec 20 14:29:41 2019 +0100 @@ -1,33 +1,17 @@ cmake_minimum_required(VERSION 3.15) -project(ucx) +project(ucx VERSION 2.1 DESCRIPTION "UAP Common Extensions") -# Autotools Buildsystem -add_custom_command( - OUTPUT ${CMAKE_SOURCE_DIR}/configure - MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/configure.ac - COMMAND ${CMAKE_SOURCE_DIR}/autogen.sh - COMMENT "Generating configure script.") +# Configuration +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED 99) -add_custom_command( - OUTPUT ${CMAKE_SOURCE_DIR}/Makefile - DEPENDS ${CMAKE_SOURCE_DIR}/configure - COMMAND ${CMAKE_SOURCE_DIR}/configure - COMMENT "Configuring project.") +# Library +add_subdirectory(src) -add_custom_target(libucx-build - DEPENDS ${CMAKE_SOURCE_DIR}/Makefile - COMMAND $(MAKE) -f ${CMAKE_SOURCE_DIR}/Makefile - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - -add_custom_target(libucx-clean - DEPENDS ${CMAKE_SOURCE_DIR}/Makefile - COMMAND $(MAKE) -f ${CMAKE_SOURCE_DIR}/Makefile clean - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) - -add_custom_target(libucx-check - DEPENDS ${CMAKE_SOURCE_DIR}/Makefile - COMMAND $(MAKE) ${CMAKE_SOURCE_DIR}/Makefile check - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +# Tests +enable_testing() +add_subdirectory(test) +add_test(NAME test COMMAND ucxtest WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test") # Web Documentation add_subdirectory(docs/src) @@ -54,5 +38,3 @@ endif() add_custom_target(docs-all DEPENDS docs-html docs-api) - -add_custom_target(build-all DEPENDS docs-all libucx-check) diff -r be77fb2da242 -r 460c0258bb5b src/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CMakeLists.txt Fri Dec 20 14:29:41 2019 +0100 @@ -0,0 +1,25 @@ +set(sources + allocator.c + array.c + avl.c + buffer.c + list.c + logging.c + map.c + mempool.c + properties.c + stack.c + string.c + test.c + ucx.c + utils.c +) + +add_library(ucx SHARED ${sources}) +add_library(ucx_static STATIC ${sources}) + +target_include_directories(ucx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(ucx_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +set_target_properties(ucx PROPERTIES SOVERSION 3 VERSION 3.1.0) +set_target_properties(ucx_static PROPERTIES VERSION ${CMAKE_PROJECT_VERSION}) diff -r be77fb2da242 -r 460c0258bb5b test/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/CMakeLists.txt Fri Dec 20 14:29:41 2019 +0100 @@ -0,0 +1,17 @@ +add_executable(ucxtest + allocator_tests.c + array_tests.c + avl_tests.c + buffer_tests.c + list_tests.c + logging_tests.c + main.c + map_tests.c + mpool_tests.c + prop_tests.c + stack_tests.c + string_tests.c + utils_tests.c +) + +target_link_libraries(ucxtest PRIVATE ucx_static)