From d454895327e86d0940bff75d6a63cdf94e8cf025 Mon Sep 17 00:00:00 2001 From: Marc Ransome Date: Sat, 30 Sep 2023 11:17:24 +0100 Subject: [PATCH 1/5] Remove CMake build files --- CMakeLists.txt | 17 ----------------- cmake/add_cmocka_test.cmake | 15 --------------- src/CMakeLists.txt | 9 --------- test/CMakeLists.txt | 7 ------- 4 files changed, 48 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 cmake/add_cmocka_test.cmake delete mode 100644 src/CMakeLists.txt delete mode 100644 test/CMakeLists.txt 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/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) From 64030ee9ebe615d5b92fd9b44a8bf771cfa529fe Mon Sep 17 00:00:00 2001 From: Marc Ransome Date: Sat, 30 Sep 2023 11:17:44 +0100 Subject: [PATCH 2/5] Add basic Meson build configuration --- src/meson.build | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/meson.build 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) From 387b3b0660d33609e9a49a863045dcc74b6f93b8 Mon Sep 17 00:00:00 2001 From: Marc Ransome Date: Sat, 23 Dec 2023 21:22:15 +0000 Subject: [PATCH 3/5] Update CodeQL workflow --- .github/workflows/codeql-analysis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d5a222a..8eb755b 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -30,7 +30,8 @@ jobs: source-root: src - 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@v2 From bad3dc99f37f57e18b95794018f33e1c23b4af14 Mon Sep 17 00:00:00 2001 From: Marc Ransome Date: Sat, 23 Dec 2023 21:29:18 +0000 Subject: [PATCH 4/5] Add build tools to CodeQL workflow --- .github/workflows/codeql-analysis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 8eb755b..2f904b9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -28,6 +28,9 @@ jobs: languages: cpp queries: security-and-quality source-root: src + - name: Install build tools + run: | + brew install meson ninja - name: Build sources run: | cd src From 8167402f8685e258a33b608c2043b63de65e5b00 Mon Sep 17 00:00:00 2001 From: Marc Ransome Date: Sat, 23 Dec 2023 21:36:50 +0000 Subject: [PATCH 5/5] Update CodeQL convenience script --- tool/codeql-create-database | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"