Update CI
All checks were successful
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Successful in 11s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Successful in 17s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Successful in 12s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 10s
All checks were successful
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=OFF (push) Successful in 11s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=OFF (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=OFF, posix=ON (push) Successful in 17s
CMake / ubuntu-latest - shared=ON, pthread=OFF, posix=ON (push) Successful in 15s
CMake / ubuntu-latest - shared=OFF, pthread=ON, posix=ON (push) Successful in 12s
CMake / ubuntu-latest - shared=ON, pthread=ON, posix=ON (push) Successful in 10s
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
@@ -16,21 +16,24 @@ jobs:
|
|||||||
shared: ["ON", "OFF"]
|
shared: ["ON", "OFF"]
|
||||||
pthread_support: ["ON", "OFF"]
|
pthread_support: ["ON", "OFF"]
|
||||||
posix_support: ["ON", "OFF"]
|
posix_support: ["ON", "OFF"]
|
||||||
|
exclude:
|
||||||
|
- posix_support: "OFF"
|
||||||
|
pthread_support: "ON"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
name: ${{ matrix.os }} - shared=${{ matrix.shared }}
|
name: ${{ matrix.os }} - shared=${{ matrix.shared }}, pthread=${{ matrix.pthread_support }}, posix=${{ matrix.posix_support }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
apt-get update
|
||||||
sudo apt-get install -y cmake build-essential
|
apt-get install -y cmake build-essential
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: |
|
run: |
|
||||||
cmake -Bbuild -S . \
|
cmake -Bbuild -S . \
|
||||||
-DDCFG_BUILD_SHARED=${{ matrix.shared }} \
|
-DDCFG_BUILD_SHARED=${{ matrix.shared }} \
|
||||||
-DDCFG_PTHREAD_SUPPORT=${{ matrix.pthread_support }} \
|
-DDCFG_PTHREAD_SUPPORT=${{ matrix.pthread_support }} \
|
||||||
-DDCFG_POSIX_SUPPORT=${{ matrix.posix_support }}
|
-DDCFG_POSIX_SUPPORT=${{ matrix.posix_support }}
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
cmake --build build
|
cmake --build build
|
||||||
|
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.30)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(DCFG C)
|
project(DCFG C)
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 23) # Would've done C99 but I need typeof (for now)
|
set(CMAKE_C_STANDARD 99)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_C_EXTENSIONS OFF)
|
set(CMAKE_C_EXTENSIONS ON) # Would've done OFF but I need typeof (for now)
|
||||||
|
|
||||||
option(DCFG_BUILD_SHARED "Build DCFG as a shared library" ON)
|
option(DCFG_BUILD_SHARED "Build DCFG as a shared library" ON)
|
||||||
option(DCFG_PTHREAD_SUPPORT "Enable pthreads support" ON)
|
option(DCFG_PTHREAD_SUPPORT "Enable pthreads support" ON)
|
||||||
@@ -31,20 +31,20 @@ if(DCFG_BUILD_SHARED)
|
|||||||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "dcfg")
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "dcfg")
|
||||||
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
|
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
|
||||||
else()
|
else()
|
||||||
add_library(${PROJECT_NAME}_static STATIC ${SRC_DIR}/dcfg.c)
|
add_library(${PROJECT_NAME} STATIC ${SRC_DIR}/dcfg.c)
|
||||||
target_include_directories(${PROJECT_NAME}_static PUBLIC ${INCLUDE_DIR})
|
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIR})
|
||||||
|
|
||||||
if(DCFG_PTHREAD_SUPPORT)
|
if(DCFG_PTHREAD_SUPPORT)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(${PROJECT_NAME}_static PRIVATE Threads::Threads)
|
target_link_libraries(${PROJECT_NAME} PRIVATE Threads::Threads)
|
||||||
target_compile_definitions(${PROJECT_NAME}_static PRIVATE DCFG_PTHREAD_SUPPORT)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE DCFG_PTHREAD_SUPPORT)
|
||||||
endif()
|
endif()
|
||||||
if (DCFG_POSIX_SUPPORT)
|
if (DCFG_POSIX_SUPPORT)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE DCFG_POSIX_SUPPORT)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE DCFG_POSIX_SUPPORT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(${PROJECT_NAME}_static PROPERTIES OUTPUT_NAME "dcfg")
|
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "dcfg")
|
||||||
install(TARGETS ${PROJECT_NAME}_static DESTINATION lib)
|
install(TARGETS ${PROJECT_NAME} DESTINATION lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(DIRECTORY ${INCLUDE_DIR}/ DESTINATION include)
|
install(DIRECTORY ${INCLUDE_DIR}/ DESTINATION include)
|
||||||
@@ -52,5 +52,5 @@ install(DIRECTORY ${INCLUDE_DIR}/ DESTINATION include)
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /permissive-)
|
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /permissive-)
|
||||||
else()
|
else()
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic -Werror -Wno-newline-eof)
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic -Werror -Wno-newline-eof -Wno-language-extension-token)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -11,6 +11,9 @@
|
|||||||
# endif
|
# endif
|
||||||
# define _XOPEN_SOURCE 200809L
|
# define _XOPEN_SOURCE 200809L
|
||||||
#else
|
#else
|
||||||
|
# ifdef _POSIX_C_SOURCE
|
||||||
|
# undef _POSIX_C_SOURCE
|
||||||
|
# endif
|
||||||
# define _POSIX_C_SOURCE 0L
|
# define _POSIX_C_SOURCE 0L
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -23,9 +26,12 @@
|
|||||||
#ifdef DCFG_PTHREAD_SUPPORT
|
#ifdef DCFG_PTHREAD_SUPPORT
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
#else
|
#else
|
||||||
|
# if defined __USE_POSIX199506 || defined __USE_UNIX98
|
||||||
|
# else
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int unused;
|
int unused;
|
||||||
} pthread_mutex_t;
|
} pthread_mutex_t;
|
||||||
|
# endif
|
||||||
|
|
||||||
void pthread_mutex_init(pthread_mutex_t *, void *);
|
void pthread_mutex_init(pthread_mutex_t *, void *);
|
||||||
void pthread_mutex_destroy(pthread_mutex_t *);
|
void pthread_mutex_destroy(pthread_mutex_t *);
|
||||||
@@ -1064,7 +1070,8 @@ Value *ast_to_value(dcfg_Instance *instance, AST *root)
|
|||||||
|
|
||||||
dcfg_Value *dcfg_parse(dcfg_Instance *instance, dcfg_StringView const file_path)
|
dcfg_Value *dcfg_parse(dcfg_Instance *instance, dcfg_StringView const file_path)
|
||||||
{
|
{
|
||||||
char path_buf[file_path.size + 1] = {};
|
char path_buf[file_path.size + 1];
|
||||||
|
memset(path_buf, 0, sizeof(path_buf));
|
||||||
memcpy(path_buf, file_path.data, file_path.size);
|
memcpy(path_buf, file_path.data, file_path.size);
|
||||||
|
|
||||||
char *abs = instance->realpath(path_buf);
|
char *abs = instance->realpath(path_buf);
|
||||||
|
Reference in New Issue
Block a user