Change directory structure
This commit is contained in:
parent
275f46226d
commit
7630ecfdcf
@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.12)
|
||||
set(PROJECT_NAME libguf)
|
||||
project(${PROJECT_NAME})
|
||||
|
||||
# set(SOURCES src/guf_str.c)
|
||||
# add_library(${PROJECT_NAME} STATIC ${SOURCES})
|
||||
# target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}}/lib/guf)
|
||||
# target_include_directories(${PROJECT_NAME} PRIVATE src)
|
||||
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
@ -18,11 +13,9 @@ if (NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin)
|
||||
endif ()
|
||||
|
||||
add_executable(libguf_example src/test/example.c src/test/guf_str_impl.c src/test/guf_dict_impl.c src/test/guf_linalg_impl.c)
|
||||
target_include_directories(libguf_example PRIVATE src src/test)
|
||||
|
||||
add_executable(libguf_test src/test/test.cpp src/test/guf_init_impl.c src/test/guf_dbuf_impl.c src/test/guf_str_impl.c src/test/guf_dict_impl.c src/test/guf_rand_impl.c src/test/guf_sort_impl.c src/test/guf_linalg_impl.c)
|
||||
target_include_directories(libguf_test PRIVATE src src/test)
|
||||
if (NOT DEFINED CMAKE_DEBUG_POSTFIX)
|
||||
set(CMAKE_DEBUG_POSTFIX _dbg)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED MSVC)
|
||||
set(WARNING_FLAGS_C -Wall -Wextra -Wpedantic -Wvla -Wshadow -Wundef -Wmisleading-indentation -Wnull-dereference -Wswitch-default -Wconversion -Wno-sign-conversion -Wdouble-promotion -Wno-unused-function)
|
||||
@ -34,15 +27,14 @@ else ()
|
||||
set(DBG_FLAGS /fsanitize=address)
|
||||
endif ()
|
||||
|
||||
if (NOT DEFINED CMAKE_DEBUG_POSTFIX)
|
||||
set(CMAKE_DEBUG_POSTFIX _dbg)
|
||||
endif ()
|
||||
add_executable(libguf_example src/test/example.c src/test/impls/str_impl.c src/test/impls/dict_impl.c src/test/impls/linalg_impl.c)
|
||||
target_include_directories(libguf_example PRIVATE src src/test)
|
||||
|
||||
add_executable(libguf_test src/test/test.cpp src/test/impls/init_impl.c src/test/impls/dbuf_impl.c src/test/impls/str_impl.c src/test/impls/dict_impl.c src/test/impls/rand_impl.c src/test/impls/sort_impl.c src/test/impls/linalg_impl.c)
|
||||
target_include_directories(libguf_test PRIVATE src src/test)
|
||||
|
||||
set_target_properties(libguf_example libguf_test PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
||||
|
||||
target_compile_definitions(libguf_test PUBLIC TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/src/test/data/")
|
||||
|
||||
|
||||
include(CheckIPOSupported)
|
||||
check_ipo_supported(RESULT ipo_available)
|
||||
if (ipo_available AND (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
|
||||
@ -52,21 +44,13 @@ else()
|
||||
message(STATUS "LTO disabled")
|
||||
endif()
|
||||
|
||||
if (TARGET libguf_test)
|
||||
message(STATUS "Configure libguf_test...")
|
||||
target_compile_definitions(libguf_test PUBLIC TEST_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/src/test/data/")
|
||||
target_compile_options(libguf_test PRIVATE ${WARNING_FLAGS_CXX} $<$<CONFIG:Debug>: ${DBG_FLAGS}>)
|
||||
target_link_options(libguf_test PRIVATE ${WARNING_FLAGS_CXX} $<$<CONFIG:Debug>: ${DBG_FLAGS}>)
|
||||
|
||||
message(STATUS "Configured libguf_test")
|
||||
endif()
|
||||
|
||||
if (TARGET libguf_example)
|
||||
message(STATUS "Configure libguf_example...")
|
||||
|
||||
target_compile_options(libguf_example PRIVATE ${WARNING_FLAGS_C} $<$<CONFIG:Debug>: ${DBG_FLAGS}>)
|
||||
target_link_options(libguf_example PRIVATE ${WARNING_FLAGS_C} $<$<CONFIG:Debug>: ${DBG_FLAGS}>)
|
||||
|
||||
message(STATUS "Configured libguf_example")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
@ -109,10 +109,7 @@ GUF_STR_KWRDS guf_str *guf_str_append(guf_str *str, guf_str_view sv);
|
||||
GUF_STR_KWRDS guf_str *guf_str_try_append_cstr(guf_str *str, const char *c_str, guf_err *err);
|
||||
GUF_STR_KWRDS guf_str *guf_str_append_cstr(guf_str *str, const char *c_str);
|
||||
|
||||
|
||||
GUF_STR_KWRDS guf_str *guf_str_substr(guf_str* str, size_t pos, size_t count);
|
||||
|
||||
// DONE
|
||||
// DONE:
|
||||
GUF_STR_KWRDS guf_str *guf_str_try_reserve(guf_str *str, ptrdiff_t min_capacity, guf_err *err);
|
||||
GUF_STR_KWRDS guf_str *guf_str_reserve(guf_str *str, ptrdiff_t min_capacity);
|
||||
|
||||
@ -144,7 +141,6 @@ GUF_STR_KWRDS bool guf_str_is_valid(const guf_str *str);
|
||||
GUF_STR_KWRDS guf_str guf_str_new_uninitialised(void);
|
||||
GUF_STR_KWRDS bool guf_str_is_uninit(const guf_str *str);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// #define GUF_STR_IMPL_STATIC /* debug */
|
||||
|
||||
@ -48,7 +48,7 @@
|
||||
#define GUF_RAND_IMPL_STATIC
|
||||
#include "guf_rand.h"
|
||||
|
||||
#include "guf_dict_impl.h"
|
||||
#include "impls/dict_impl.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "guf_dbuf_impl.h"
|
||||
#include "dbuf_impl.h"
|
||||
|
||||
#define GUF_DBUF_NAME dbuf_int
|
||||
#define GUF_T int
|
||||
@ -1,4 +1,4 @@
|
||||
#include "guf_dict_impl.h"
|
||||
#include "dict_impl.h"
|
||||
|
||||
#define GUF_DICT_KEY_T guf_cstr_const
|
||||
#define GUF_DICT_KEY_T_EQ guf_cstr_const_eq
|
||||
@ -1,4 +1,4 @@
|
||||
#include "guf_sort_impl.h"
|
||||
#include "sort_impl.h"
|
||||
|
||||
#define GUF_T float
|
||||
#define GUF_SORT_IMPL
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef TEST_HPP
|
||||
#define TEST_HPP
|
||||
#ifndef GUF_TEST_HPP
|
||||
#define GUF_TEST_HPP
|
||||
|
||||
#include <stack>
|
||||
#include <string>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "guf_alloc_libc.h"
|
||||
#include "guf_dbuf_impl.h"
|
||||
#include "impls/dbuf_impl.h"
|
||||
}
|
||||
|
||||
struct DbufIntTest : public Test
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "guf_alloc_libc.h"
|
||||
#include "guf_dict_impl.h"
|
||||
#include "guf_str.h"
|
||||
#include "impls/dict_impl.h"
|
||||
}
|
||||
|
||||
struct DictSvToIntTest : public Test
|
||||
@ -15,7 +15,6 @@ struct DictSvToIntTest : public Test
|
||||
DictSvToIntTest(const std::string& name) : Test(name) {};
|
||||
|
||||
private:
|
||||
|
||||
dbuf_char text_buf {};
|
||||
std::vector<char> text_vec {};
|
||||
|
||||
@ -340,7 +339,6 @@ struct DictSvToIntTest : public Test
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
bool run() override
|
||||
{
|
||||
if (done) {
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "test.hpp"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "guf_alloc_libc.h"
|
||||
#include "guf_dict_impl.h"
|
||||
#include "guf_dbuf_impl.h"
|
||||
#include "guf_str.h"
|
||||
#include "impls/dict_impl.h"
|
||||
#include "impls/dbuf_impl.h"
|
||||
}
|
||||
|
||||
struct UTF8Test : public Test
|
||||
{
|
||||
|
||||
UTF8Test(const std::string& name) : Test(name) {};
|
||||
|
||||
private:
|
||||
@ -162,7 +162,6 @@ struct UTF8Test : public Test
|
||||
free_text();
|
||||
}
|
||||
|
||||
|
||||
void encode_decode()
|
||||
{
|
||||
guf_utf8_char utf8 = {0};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user