diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d609107..3bbc8ed 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -29,9 +29,13 @@ jobs: languages: cpp queries: security-and-quality source-root: src + - name: Install build tools + run: | + brew install meson ninja - name: Build sources run: | - cmake -S . -B build - cmake --build build + cd src + meson setup build + ninja -C build - name: Perform CodeQL analysis uses: github/codeql-action/analyze@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7 diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index ff87af8..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 3.22) -project(flog C) - -set(CMAKE_C_STANDARD 17) -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) - -find_package(PkgConfig REQUIRED) -pkg_check_modules(POPT REQUIRED popt>=1.19) - -if (NOT UNIT_TESTING) - message(STATUS "Building program target") - add_subdirectory(src) -else() - message(STATUS "Building unit test targets") - enable_testing() - add_subdirectory(test) -endif() diff --git a/cmake/add_cmocka_test.cmake b/cmake/add_cmocka_test.cmake deleted file mode 100644 index 534d0bc..0000000 --- a/cmake/add_cmocka_test.cmake +++ /dev/null @@ -1,15 +0,0 @@ -function(add_cmocka_test unit) - set(test_target test_${unit}) - - add_executable(${test_target} test_${unit}.c ${CMAKE_SOURCE_DIR}/src/${unit}.c) - - target_link_libraries(${test_target} PRIVATE ${CMOCKA_LINK_LIBRARIES} PRIVATE ${POPT_LINK_LIBRARIES}) - target_include_directories(${test_target} PRIVATE ${CMOCKA_INCLUDE_DIRS} PRIVATE ${POPT_INCLUDE_DIRS}) - - target_include_directories(${test_target} PRIVATE ${CMAKE_SOURCE_DIR}/src) - - target_compile_options(${test_target} PRIVATE ${CMOCKA_CFLAGS} PRIVATE ${POPT_CFLAGS}) - target_compile_definitions(${test_target} PRIVATE UNIT_TESTING) - - add_test(NAME ${test_target} COMMAND ${test_target}) -endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 14c9213..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(target flog) - -add_executable(flog main.c flog.c flog.h config.c config.h defs.h utils.c utils.h) - -target_link_libraries(${target} PRIVATE ${POPT_LINK_LIBRARIES}) -target_include_directories(${target} PRIVATE ${POPT_INCLUDE_DIRS}) -target_compile_options(${target} PRIVATE ${POPT_CFLAGS}) - -install(TARGETS flog DESTINATION bin) diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..6532fa2 --- /dev/null +++ b/src/meson.build @@ -0,0 +1,13 @@ +project('flog', 'c', + version : '1.5.0', + default_options : ['warning_level=3']) + +poptdep = dependency('popt', version : '>=1.19') + +executable('flog', + 'utils.c', + 'flog.c', + 'main.c', + 'config.c', + dependencies : poptdep, + install : true) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index f1ba59f..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -include(CTest) - -pkg_check_modules(CMOCKA REQUIRED cmocka>=1.1.7) - -include(add_cmocka_test) - -add_cmocka_test(config) diff --git a/tool/codeql-create-database b/tool/codeql-create-database index ee65263..c3f3a0b 100755 --- a/tool/codeql-create-database +++ b/tool/codeql-create-database @@ -9,4 +9,4 @@ cd "${parent_dir}/.." [[ -d "${build_dir}" ]] && rm -rf "${build_dir}" [[ -d "${codeql_db_dir}" ]] && rm -rf "${codeql_db_dir}" -codeql database create "${codeql_db_dir}" --source-root="./src" --language="cpp" --command="cmake -S .. -B ../${build_dir}" --command="cmake --build ../build" +codeql database create "${codeql_db_dir}" --source-root="./src" --language="cpp" --command="meson setup build" --command="ninja -C build"