Author | Jamozed <[email protected]> |
Date | 2021-01-27 01:44:30 |
Commit | bd9fc8b8e4232cb8b8c57055c62f3f1ebf994b5b |
Parent | ae5acb7e62b376c050bba728ddea258160460cd9 |
meta: Restructure project
Diffstat
M | CMakeLists.txt | | | 23 | +++++++++++++---------- |
A | TestUNIX.sh | | | 2 | ++ |
R | src/lib/crypt.h -> src/crypt.h | | | 0 | |
R | src/lib/endian.h -> src/endian.h | | | 0 | |
R | src/lib/error.c -> src/error.c | | | 0 | |
R | src/lib/error.h -> src/error.h | | | 0 | |
R | src/lib/mode.c -> src/mode.c | | | 0 | |
R | src/lib/mode.h -> src/mode.h | | | 0 | |
R | src/lib/optget.c -> src/optget.c | | | 0 | |
R | src/lib/optget.h -> src/optget.h | | | 0 | |
R | src/test_crypt.c -> src/test/test_crypt.c | | | 2 | +- |
R | src/test_endian.c -> src/test/test_endian.c | | | 2 | +- |
R | src/test_error.c -> src/test/test_error.c | | | 2 | +- |
R | src/test_optget.c -> src/test/test_optget.c | | | 2 | +- |
R | src/unit.h -> src/test/unit.h | | | 0 |
15 files changed, 19 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 752ade5..eaec185 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,23 @@ -# CMakeLists.txt -# CMakeLists file for OMKOV lib - CMAKE_MINIMUM_REQUIRED(VERSION 3.12) -PROJECT(lib C) +PROJECT(lib VERSION 0.0.0 LANGUAGES C) SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) SET(CMAKE_STATIC_LIBRARY_PREFIX "") -FILE(GLOB LIBSRC ${PROJECT_SOURCE_DIR}/src/lib/*) +FILE(GLOB SOURCES ${PROJECT_SOURCE_DIR}/src/*) -ADD_LIBRARY(lib STATIC ${LIBSRC}) +ADD_LIBRARY(lib STATIC ${SOURCES}) LINK_LIBRARIES(lib) -ADD_EXECUTABLE(test_crypt ${PROJECT_SOURCE_DIR}/src/test_crypt.c) -ADD_EXECUTABLE(test_endian ${PROJECT_SOURCE_DIR}/src/test_endian.c) -ADD_EXECUTABLE(test_error ${PROJECT_SOURCE_DIR}/src/test_error.c) -ADD_EXECUTABLE(test_optget ${PROJECT_SOURCE_DIR}/src/test_optget.c) +ADD_EXECUTABLE(test_crypt ${PROJECT_SOURCE_DIR}/src/test/test_crypt.c) +ADD_EXECUTABLE(test_endian ${PROJECT_SOURCE_DIR}/src/test/test_endian.c) +ADD_EXECUTABLE(test_error ${PROJECT_SOURCE_DIR}/src/test/test_error.c) +ADD_EXECUTABLE(test_optget ${PROJECT_SOURCE_DIR}/src/test/test_optget.c) + +ENABLE_TESTING() +ADD_TEST(NAME test_crypt COMMAND test_crypt) +ADD_TEST(NAME test_endian COMMAND test_endian) +ADD_TEST(NAME test_error COMMAND test_error) +ADD_TEST(NAME test_optget COMMAND test_optget) diff --git a/TestUNIX.sh b/TestUNIX.sh new file mode 100755 index 0000000..e2c621d --- /dev/null +++ b/TestUNIX.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +(cd "$(dirname $(realpath "$0"))/build"; ctest) diff --git a/src/lib/crypt.h b/src/crypt.h similarity index 100% rename from src/lib/crypt.h rename to src/crypt.h diff --git a/src/lib/endian.h b/src/endian.h similarity index 100% rename from src/lib/endian.h rename to src/endian.h diff --git a/src/lib/error.c b/src/error.c similarity index 100% rename from src/lib/error.c rename to src/error.c diff --git a/src/lib/error.h b/src/error.h similarity index 100% rename from src/lib/error.h rename to src/error.h diff --git a/src/lib/mode.c b/src/mode.c similarity index 100% rename from src/lib/mode.c rename to src/mode.c diff --git a/src/lib/mode.h b/src/mode.h similarity index 100% rename from src/lib/mode.h rename to src/mode.h diff --git a/src/lib/optget.c b/src/optget.c similarity index 100% rename from src/lib/optget.c rename to src/optget.c diff --git a/src/lib/optget.h b/src/optget.h similarity index 100% rename from src/lib/optget.h rename to src/optget.h diff --git a/src/test_crypt.c b/src/test/test_crypt.c similarity index 98% rename from src/test_crypt.c rename to src/test/test_crypt.c index 1b99cef..8d476cb 100644 --- a/src/test_crypt.c +++ b/src/test/test_crypt.c @@ -17,7 +17,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. */ -#include "lib/crypt.h" +#include "../crypt.h" #include "unit.h" #include <stdint.h> diff --git a/src/test_endian.c b/src/test/test_endian.c similarity index 99% rename from src/test_endian.c rename to src/test/test_endian.c index bba612d..d26476b 100644 --- a/src/test_endian.c +++ b/src/test/test_endian.c @@ -17,7 +17,7 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. */ -#include "lib/endian.h" +#include "../endian.h" #include "unit.h" #include <stdint.h> diff --git a/src/test_error.c b/src/test/test_error.c similarity index 91% rename from src/test_error.c rename to src/test/test_error.c index 38f5070..e3f5975 100644 --- a/src/test_error.c +++ b/src/test/test_error.c @@ -3,7 +3,7 @@ // Copyright (C) 2020, Jakob Wakeling // All rights reserved. -#include "lib/error.h" +#include "../error.h" int main(int ac, char *av[]) { A0 = av[0]; warn("%s: %s", "warn", serr()); diff --git a/src/test_optget.c b/src/test/test_optget.c similarity index 99% rename from src/test_optget.c rename to src/test/test_optget.c index 9fbb1eb..b54bf91 100644 --- a/src/test_optget.c +++ b/src/test/test_optget.c @@ -3,7 +3,7 @@ // Copyright (C) 2020, Jakob Wakeling // All rights reserved. -#include "lib/optget.h" +#include "../optget.h" #include "unit.h" #include <stdbool.h> diff --git a/src/unit.h b/src/test/unit.h similarity index 100% rename from src/unit.h rename to src/test/unit.h