Fri, 20 Dec 2019 14:29:41 +0100
adds proper cmake build targets
CMakeLists.txt | file | annotate | diff | comparison | revisions | |
src/CMakeLists.txt | file | annotate | diff | comparison | revisions | |
test/CMakeLists.txt | file | annotate | diff | comparison | revisions |
1.1 --- a/CMakeLists.txt Thu Dec 19 19:58:41 2019 +0100 1.2 +++ b/CMakeLists.txt Fri Dec 20 14:29:41 2019 +0100 1.3 @@ -1,33 +1,17 @@ 1.4 cmake_minimum_required(VERSION 3.15) 1.5 -project(ucx) 1.6 +project(ucx VERSION 2.1 DESCRIPTION "UAP Common Extensions") 1.7 1.8 -# Autotools Buildsystem 1.9 -add_custom_command( 1.10 - OUTPUT ${CMAKE_SOURCE_DIR}/configure 1.11 - MAIN_DEPENDENCY ${CMAKE_SOURCE_DIR}/configure.ac 1.12 - COMMAND ${CMAKE_SOURCE_DIR}/autogen.sh 1.13 - COMMENT "Generating configure script.") 1.14 +# Configuration 1.15 +set(CMAKE_C_STANDARD 11) 1.16 +set(CMAKE_C_STANDARD_REQUIRED 99) 1.17 1.18 -add_custom_command( 1.19 - OUTPUT ${CMAKE_SOURCE_DIR}/Makefile 1.20 - DEPENDS ${CMAKE_SOURCE_DIR}/configure 1.21 - COMMAND ${CMAKE_SOURCE_DIR}/configure 1.22 - COMMENT "Configuring project.") 1.23 +# Library 1.24 +add_subdirectory(src) 1.25 1.26 -add_custom_target(libucx-build 1.27 - DEPENDS ${CMAKE_SOURCE_DIR}/Makefile 1.28 - COMMAND $(MAKE) -f ${CMAKE_SOURCE_DIR}/Makefile 1.29 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 1.30 - 1.31 -add_custom_target(libucx-clean 1.32 - DEPENDS ${CMAKE_SOURCE_DIR}/Makefile 1.33 - COMMAND $(MAKE) -f ${CMAKE_SOURCE_DIR}/Makefile clean 1.34 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 1.35 - 1.36 -add_custom_target(libucx-check 1.37 - DEPENDS ${CMAKE_SOURCE_DIR}/Makefile 1.38 - COMMAND $(MAKE) ${CMAKE_SOURCE_DIR}/Makefile check 1.39 - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) 1.40 +# Tests 1.41 +enable_testing() 1.42 +add_subdirectory(test) 1.43 +add_test(NAME test COMMAND ucxtest WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/test") 1.44 1.45 # Web Documentation 1.46 add_subdirectory(docs/src) 1.47 @@ -54,5 +38,3 @@ 1.48 endif() 1.49 1.50 add_custom_target(docs-all DEPENDS docs-html docs-api) 1.51 - 1.52 -add_custom_target(build-all DEPENDS docs-all libucx-check)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/src/CMakeLists.txt Fri Dec 20 14:29:41 2019 +0100 2.3 @@ -0,0 +1,25 @@ 2.4 +set(sources 2.5 + allocator.c 2.6 + array.c 2.7 + avl.c 2.8 + buffer.c 2.9 + list.c 2.10 + logging.c 2.11 + map.c 2.12 + mempool.c 2.13 + properties.c 2.14 + stack.c 2.15 + string.c 2.16 + test.c 2.17 + ucx.c 2.18 + utils.c 2.19 +) 2.20 + 2.21 +add_library(ucx SHARED ${sources}) 2.22 +add_library(ucx_static STATIC ${sources}) 2.23 + 2.24 +target_include_directories(ucx PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2.25 +target_include_directories(ucx_static PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 2.26 + 2.27 +set_target_properties(ucx PROPERTIES SOVERSION 3 VERSION 3.1.0) 2.28 +set_target_properties(ucx_static PROPERTIES VERSION ${CMAKE_PROJECT_VERSION})
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/CMakeLists.txt Fri Dec 20 14:29:41 2019 +0100 3.3 @@ -0,0 +1,17 @@ 3.4 +add_executable(ucxtest 3.5 + allocator_tests.c 3.6 + array_tests.c 3.7 + avl_tests.c 3.8 + buffer_tests.c 3.9 + list_tests.c 3.10 + logging_tests.c 3.11 + main.c 3.12 + map_tests.c 3.13 + mpool_tests.c 3.14 + prop_tests.c 3.15 + stack_tests.c 3.16 + string_tests.c 3.17 + utils_tests.c 3.18 +) 3.19 + 3.20 +target_link_libraries(ucxtest PRIVATE ucx_static)