From 5803dc0fdb911a67ad9ca1ef9600edc58331d55a Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 2 Jul 2020 10:53:55 -0400 Subject: Add basic test framework and a few tests --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index ea12358..5287d06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,5 +5,11 @@ set(CMAKE_C_STANDARD 99) add_executable(splitfits splitfits.c) +file(GLOB TEST_FRAMEWORK "tests") +file(COPY "test.sh" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +file(COPY ${TEST_FRAMEWORK} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +add_custom_target(check "${CMAKE_CURRENT_BINARY_DIR}/test.sh") + install(TARGETS splitfits RUNTIME) -- cgit From 19416faaede8cbbb4802417de858e9d7563c9e7d Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 2 Jul 2020 10:54:36 -0400 Subject: Add circleci config --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 5287d06..0f3a91d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.1...3.16) project(splitfits C) set(CMAKE_C_STANDARD 99) @@ -12,4 +12,4 @@ file(COPY ${TEST_FRAMEWORK} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) add_custom_target(check "${CMAKE_CURRENT_BINARY_DIR}/test.sh") install(TARGETS splitfits - RUNTIME) + RUNTIME DESTINATION bin) -- cgit From 5dd87260434756f3c974a6c75d373645d84f7b30 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 2 Jul 2020 12:37:28 -0400 Subject: Break up configuration from test script --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f3a91d..db56622 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,9 @@ set(CMAKE_C_STANDARD 99) add_executable(splitfits splitfits.c) +file(GLOB TEST_RUNNER "test*.sh") +file(COPY ${TEST_RUNNER} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(GLOB TEST_FRAMEWORK "tests") -file(COPY "test.sh" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(COPY ${TEST_FRAMEWORK} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) add_custom_target(check "${CMAKE_CURRENT_BINARY_DIR}/test.sh") -- cgit From 0c6b6035c3318e95e5d417639a3d7854cce72464 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 2 Jul 2020 14:22:11 -0400 Subject: Add version information --- CMakeLists.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index db56622..43f002c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,28 @@ cmake_minimum_required(VERSION 3.1...3.16) project(splitfits C) - set(CMAKE_C_STANDARD 99) +find_package(Git) +if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") + execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --long --tags --dirty + OUTPUT_VARIABLE GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) +else() + message(WARNING "git not found or directory is not a repository") + set(GIT_VERSION, "unknown") +endif() + add_executable(splitfits splitfits.c) +include_directories("${CMAKE_CURRENT_BINARY_DIR}") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/version.h" @ONLY) file(GLOB TEST_RUNNER "test*.sh") file(COPY ${TEST_RUNNER} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(GLOB TEST_FRAMEWORK "tests") file(COPY ${TEST_FRAMEWORK} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + add_custom_target(check "${CMAKE_CURRENT_BINARY_DIR}/test.sh") install(TARGETS splitfits -- cgit