From 20263758f6021acd1a447e2a1f9a4aea7d9d3663 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Tue, 23 Apr 2024 09:53:07 +0100 Subject: [PATCH 01/20] Moved from make to CMAKE --- CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..9d23cd6a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required (VERSION 2.9) +project (LINENOISE DESCRIPTION "A shell library") + +if(CMAKE_BUILD_TYPE) + message("Building ${CMAKE_BUILD_TYPE} build.") +elseif(NOT CMAKE_BUILD_TYPE) + message(FATAL_ERROR "No build type specified. Use -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] to specify.") +endif(CMAKE_BUILD_TYPE) + +# set the version of our library +# MAJOR, is significant breaking changes, MINOR, is when we might have changed signatures of existing functions, PATCH, is just bug fixes and no breaking changes +set(LINENOISE_VERSION_MAJOR 1) +set(LINENOISE_VERSION_MINOR 0) +set(LINENOISE_VERSION_PATCH 1) +set(LINENOISE_VERSION_STRING ${LINENOISE_VERSION_MAJOR}.${LINENOISE_VERSION_MINOR}.${LINENOISE_VERSION_PATCH}) + +file(GLOB LINENOISE_SOURCE_FILES "linenoise.c") +file(GLOB LINENOISE_HEADER_FILES "linenoise.h") + +set(LINENOISE_SOURCES ${LINENOISE_SOURCE_FILES}) +set(LINENOISE_HEADERS ${LINENOISE_HEADER_FILES}) + +# where the library will be built to +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/libs) + +add_library(linenoise SHARED ${LINENOISE_SOURCES} ${LINENOISE_HEADERS}) +target_link_libraries(linenoise) + +target_include_directories(linenoise PUBLIC ".") +# sets the shared library version +# http://cmake.3232098.n2.nabble.com/Version-in-name-of-shared-library-td7581530.html +set_target_properties(linenoise PROPERTIES VERSION ${LINENOISE_VERSION_STRING} SOVERSION ${LINENOISE_VERSION_MAJOR}) +set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) From a14b0030bdd39dc3244b4c9feb62f3a3e30ced4e Mon Sep 17 00:00:00 2001 From: VSF1 Date: Tue, 23 Apr 2024 09:53:57 +0100 Subject: [PATCH 02/20] deleted Makefile --- Makefile | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index a2854106..00000000 --- a/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -linenoise_example: linenoise.h linenoise.c - -linenoise_example: linenoise.c example.c - $(CC) -Wall -W -Os -g -o linenoise_example linenoise.c example.c - -clean: - rm -f linenoise_example From 8555e0ba8c148f31a22997089ad83dc55ec7c314 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Wed, 15 May 2024 09:36:44 +0100 Subject: [PATCH 03/20] added build folder to ignore list --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7ab7825f..12429b38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ linenoise_example *.dSYM history.txt +build/ From 675b1b1619d38a18489c93c60ef4e88e6825aa2a Mon Sep 17 00:00:00 2001 From: VSF1 Date: Wed, 15 May 2024 09:46:50 +0100 Subject: [PATCH 04/20] updated ci/cd automation --- .github/workflows/build.yml | 77 +++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..131dfefb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,77 @@ +name: linenoise +# This workflow represents a set of basic End-to-End tests +on: + push: + branches: + - main + tags: + - 'v*' + pull_request: + branches: + - main +jobs: + build_release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + #- name: install cppunit + # run: sudo apt install -y libcppunit-dev + + - name: install doxygen + run: sudo apt install -y doxygen + + - name: install CxxTest + run: sudo apt install -y cxxtest + + - name: install CMake + run: sudo apt install -y cmake + +# - name: install dependencies +# run: sudo apt install -y + + - name: configure + run: ./cmake_release.sh + + - name: make + run: cd build/release && make + + create_release: + name: Release + runs-on: ubuntu-latest + needs: + - build_release + if: github.ref == 'refs/heads/releng' || startsWith(github.ref, 'refs/tags/') + steps: + - name: Define the release name + id: release_name + run: | + if [ ${GITHUB_REF/refs\/tags\//} != ${GITHUB_REF} ]; then + echo "RELEASE_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + elif [ ${GITHUB_REF/refs\/heads\//} = "releng" ]; then + echo "RELEASE_NAME=releng" >> $GITHUB_OUTPUT + else + echo "RELEASE_NAME=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_OUTPUT + fi + - name: Create release with releng image + if: github.ref == 'refs/heads/releng' + uses: "marvinpinto/action-automatic-releases@v1.2.1" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + draft: true + title: "Prerelease" + files: linenoise-${{ steps.release_name.outputs.RELEASE_NAME }}-*.zip + + - name: Create release with release image + if: startsWith(github.ref, 'refs/tags/') + uses: "marvinpinto/action-automatic-releases@v1.2.1" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: ${{ steps.release_name.outputs.RELEASE_NAME }} + prerelease: false + draft: true + title: ${{ steps.release_name.outputs.RELEASE_NAME }} + files: linenoise-${{ steps.release_name.outputs.RELEASE_NAME }}-*.zip \ No newline at end of file From d6f041069ccdde91358f2601ddbb39ddc999c486 Mon Sep 17 00:00:00 2001 From: Vitor Fonseca Date: Wed, 15 May 2024 09:49:08 +0100 Subject: [PATCH 05/20] Create cmake-single-platform.yml --- .github/workflows/cmake-single-platform.yml | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/cmake-single-platform.yml diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml new file mode 100644 index 00000000..4bd1c79b --- /dev/null +++ b/.github/workflows/cmake-single-platform.yml @@ -0,0 +1,39 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: CMake on a single platform + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Test + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C ${{env.BUILD_TYPE}} + From 43b3493b9b4b36748b83d29d231139785f5feedd Mon Sep 17 00:00:00 2001 From: VSF1 Date: Wed, 15 May 2024 10:34:45 +0100 Subject: [PATCH 06/20] added test suite --- CMakeLists.txt | 6 ++++++ Testing/Temporary/CTestCostData.txt | 1 + Testing/Temporary/LastTest.log | 3 +++ test/CMakeLists.txt | 7 +++++++ test/test_1.c | 5 +++++ 5 files changed, 22 insertions(+) create mode 100644 Testing/Temporary/CTestCostData.txt create mode 100644 Testing/Temporary/LastTest.log create mode 100644 test/CMakeLists.txt create mode 100644 test/test_1.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d23cd6a..d9d1c5b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required (VERSION 2.9) project (LINENOISE DESCRIPTION "A shell library") +enable_testing() if(CMAKE_BUILD_TYPE) message("Building ${CMAKE_BUILD_TYPE} build.") @@ -31,3 +32,8 @@ target_include_directories(linenoise PUBLIC ".") # http://cmake.3232098.n2.nabble.com/Version-in-name-of-shared-library-td7581530.html set_target_properties(linenoise PROPERTIES VERSION ${LINENOISE_VERSION_STRING} SOVERSION ${LINENOISE_VERSION_MAJOR}) set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) + +add_executable(example example.c) +target_link_libraries(example linenoise) + +add_subdirectory(test) \ No newline at end of file diff --git a/Testing/Temporary/CTestCostData.txt b/Testing/Temporary/CTestCostData.txt new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/Testing/Temporary/CTestCostData.txt @@ -0,0 +1 @@ +--- diff --git a/Testing/Temporary/LastTest.log b/Testing/Temporary/LastTest.log new file mode 100644 index 00000000..091c42a8 --- /dev/null +++ b/Testing/Temporary/LastTest.log @@ -0,0 +1,3 @@ +Start testing: May 15 10:03 WEST +---------------------------------------------------------- +End testing: May 15 10:03 WEST diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..9232c88d --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,7 @@ +enable_testing() + +# testing binary +add_executable(c_test_1 test_1.c) +target_link_libraries(c_test_1 linenoise) + +add_test (NAME c_test_1 COMMAND $) \ No newline at end of file diff --git a/test/test_1.c b/test/test_1.c new file mode 100644 index 00000000..81cf2236 --- /dev/null +++ b/test/test_1.c @@ -0,0 +1,5 @@ +#include + +int main() { + return 0; +} \ No newline at end of file From f8c9b451804b16664aa98c53c72a55f299cdde33 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Thu, 16 May 2024 09:42:45 +0100 Subject: [PATCH 07/20] updated github build action --- .github/workflows/build.yml | 77 --------------------- .github/workflows/cmake-single-platform.yml | 40 ++++++++++- 2 files changed, 39 insertions(+), 78 deletions(-) delete mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 131dfefb..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: linenoise -# This workflow represents a set of basic End-to-End tests -on: - push: - branches: - - main - tags: - - 'v*' - pull_request: - branches: - - main -jobs: - build_release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - #- name: install cppunit - # run: sudo apt install -y libcppunit-dev - - - name: install doxygen - run: sudo apt install -y doxygen - - - name: install CxxTest - run: sudo apt install -y cxxtest - - - name: install CMake - run: sudo apt install -y cmake - -# - name: install dependencies -# run: sudo apt install -y - - - name: configure - run: ./cmake_release.sh - - - name: make - run: cd build/release && make - - create_release: - name: Release - runs-on: ubuntu-latest - needs: - - build_release - if: github.ref == 'refs/heads/releng' || startsWith(github.ref, 'refs/tags/') - steps: - - name: Define the release name - id: release_name - run: | - if [ ${GITHUB_REF/refs\/tags\//} != ${GITHUB_REF} ]; then - echo "RELEASE_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - elif [ ${GITHUB_REF/refs\/heads\//} = "releng" ]; then - echo "RELEASE_NAME=releng" >> $GITHUB_OUTPUT - else - echo "RELEASE_NAME=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_OUTPUT - fi - - name: Create release with releng image - if: github.ref == 'refs/heads/releng' - uses: "marvinpinto/action-automatic-releases@v1.2.1" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: true - draft: true - title: "Prerelease" - files: linenoise-${{ steps.release_name.outputs.RELEASE_NAME }}-*.zip - - - name: Create release with release image - if: startsWith(github.ref, 'refs/tags/') - uses: "marvinpinto/action-automatic-releases@v1.2.1" - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: ${{ steps.release_name.outputs.RELEASE_NAME }} - prerelease: false - draft: true - title: ${{ steps.release_name.outputs.RELEASE_NAME }} - files: linenoise-${{ steps.release_name.outputs.RELEASE_NAME }}-*.zip \ No newline at end of file diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 4bd1c79b..1fb975bc 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -1,10 +1,11 @@ # This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. # See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml -name: CMake on a single platform +name: linenoise on: push: branches: [ "master" ] + tags: [ "v*" ] pull_request: branches: [ "master" ] @@ -37,3 +38,40 @@ jobs: # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail run: ctest -C ${{env.BUILD_TYPE}} + release: + # Creates binary packages + runs-on: ubuntu-latest + needs: [ build ] + if: github.ref == 'refs/heads/releng' || startsWith(github.ref, 'refs/tags/') + steps: + - name: Define the release name + id: release_name + run: | + if [ ${GITHUB_REF/refs\/tags\//} != ${GITHUB_REF} ]; then + echo "RELEASE_NAME=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + elif [ ${GITHUB_REF/refs\/heads\//} = "releng" ]; then + echo "RELEASE_NAME=releng" >> $GITHUB_OUTPUT + else + echo "RELEASE_NAME=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_OUTPUT + fi + - name: Create release with releng image + if: github.ref == 'refs/heads/releng' + uses: "marvinpinto/action-automatic-releases@v1.2.1" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + draft: true + title: "Prerelease" + files: linenoise-${{ steps.release_name.outputs.RELEASE_NAME }}-*.zip + + - name: Create release with release image + if: startsWith(github.ref, 'refs/tags/') + uses: "marvinpinto/action-automatic-releases@v1.2.1" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: ${{ steps.release_name.outputs.RELEASE_NAME }} + prerelease: false + draft: true + title: ${{ steps.release_name.outputs.RELEASE_NAME }} + files: linenoise-${{ steps.release_name.outputs.RELEASE_NAME }}-*.zip From 96d7804294a41515a581fe36681b9b774f15bc5c Mon Sep 17 00:00:00 2001 From: VSF1 Date: Thu, 16 May 2024 17:24:16 +0100 Subject: [PATCH 08/20] added to ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7ab7825f..cd59ce5c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ linenoise_example *.dSYM history.txt +*.pc.in From 2ede4b86bc55c9a43ff5eb45d8a485dc23a93143 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Thu, 16 May 2024 17:25:22 +0100 Subject: [PATCH 09/20] Merged --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d23cd6a..56822125 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,3 +31,17 @@ target_include_directories(linenoise PUBLIC ".") # http://cmake.3232098.n2.nabble.com/Version-in-name-of-shared-library-td7581530.html set_target_properties(linenoise PROPERTIES VERSION ${LINENOISE_VERSION_STRING} SOVERSION ${LINENOISE_VERSION_MAJOR}) set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) + +# create pkg-config files for configuration in non-cmake projects +configure_file(linenoise.pc.in linenoise.pc @ONLY) + +# only offer install option if they compiled with release mode +if(CMAKE_BUILD_TYPE MATCHES "RELEASE") + # adds the 'make install' targets to copy the shared library to /usr/local/lib/ directory + install( TARGETS linenoise DESTINATION ${CMAKE_INSTALL_LIBDIR} ) + # adds all the relevant headers to /usr/local/include/gphoto2pp when ``make install`` is executed + install( FILES ${LINENOISE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linenoise ) + + # install the pkg-config config to system folder + install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) +endif(CMAKE_BUILD_TYPE MATCHES "RELEASE") From b4c438c2ae82d278758324ec5261cf5b32947cce Mon Sep 17 00:00:00 2001 From: VSF1 Date: Fri, 24 May 2024 14:55:49 +0100 Subject: [PATCH 10/20] remove pkg-config generation --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14db0d63..25dfbcdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,7 +34,7 @@ set_target_properties(linenoise PROPERTIES VERSION ${LINENOISE_VERSION_STRING} S set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) # create pkg-config files for configuration in non-cmake projects -configure_file(linenoise.pc.in linenoise.pc @ONLY) +# configure_file(linenoise.pc.in linenoise.pc @ONLY) # only offer install option if they compiled with release mode if(CMAKE_BUILD_TYPE MATCHES "RELEASE") From dcb5c98b6b7b7b4c59ac8ee633038fb1c16e15f6 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Fri, 6 Dec 2024 19:57:52 +0000 Subject: [PATCH 11/20] Updated to CMAKE 3.5 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 25dfbcdc..d4ec24e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.9) +cmake_minimum_required (VERSION 3.5) project (LINENOISE DESCRIPTION "A shell library") enable_testing() From 11dbfd89e8f9c6522304e7deaa71eec3f7470d2d Mon Sep 17 00:00:00 2001 From: VSF1 Date: Thu, 2 Jan 2025 12:32:01 +0000 Subject: [PATCH 12/20] updated build script --- CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4ec24e8..96f3d5e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,12 +39,11 @@ set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) # only offer install option if they compiled with release mode if(CMAKE_BUILD_TYPE MATCHES "RELEASE") # adds the 'make install' targets to copy the shared library to /usr/local/lib/ directory - install( TARGETS linenoise DESTINATION ${CMAKE_INSTALL_LIBDIR} ) + install(TARGETS linenoise DESTINATION ${CMAKE_INSTALL_LIBDIR} ) # adds all the relevant headers to /usr/local/include/gphoto2pp when ``make install`` is executed - install( FILES ${LINENOISE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linenoise ) - + install(FILES ${LINENOISE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linenoise ) # install the pkg-config config to system folder - install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) +# install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) endif(CMAKE_BUILD_TYPE MATCHES "RELEASE") add_executable(example example.c) From fe67777637ba09e7e0c65fbc30a7eb6b6753ab31 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Thu, 2 Jan 2025 12:32:46 +0000 Subject: [PATCH 13/20] added pc.in --- .gitignore | 1 - linenoise.pc.in | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 linenoise.pc.in diff --git a/.gitignore b/.gitignore index 784a9567..9e573a50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ linenoise_example *.dSYM history.txt -*.pc.in build/ \ No newline at end of file diff --git a/linenoise.pc.in b/linenoise.pc.in new file mode 100644 index 00000000..b7919c5f --- /dev/null +++ b/linenoise.pc.in @@ -0,0 +1,12 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ + +Name: @PROJECT_NAME@ +Description: @PROJECT_DESCRIPTION@ +Version: @LINENOISE_VERSION_STRING@ + +Requires: +Libs: -L${libdir} +Cflags: -I${includedir} \ No newline at end of file From 3946cf2ed7a4b27fc69218b1e0b11fc7377a86f0 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Fri, 14 Feb 2025 22:40:48 +0000 Subject: [PATCH 14/20] updated cmake script --- CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96f3d5e7..0e434d8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,14 @@ cmake_minimum_required (VERSION 3.5) project (LINENOISE DESCRIPTION "A shell library") -enable_testing() + +# Configuration specific to being the main project +if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) + set(CMAKE_VERBOSE_MAKEFILE ON) + set(LINENOISE_NOT_SUBPROJECT ON) +endif(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) if(CMAKE_BUILD_TYPE) - message("Building ${CMAKE_BUILD_TYPE} build.") + message("Building ${PROJECT_NAME} in ${CMAKE_BUILD_TYPE} build.") elseif(NOT CMAKE_BUILD_TYPE) message(FATAL_ERROR "No build type specified. Use -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] to specify.") endif(CMAKE_BUILD_TYPE) @@ -37,14 +42,14 @@ set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) # configure_file(linenoise.pc.in linenoise.pc @ONLY) # only offer install option if they compiled with release mode -if(CMAKE_BUILD_TYPE MATCHES "RELEASE") +if(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") # adds the 'make install' targets to copy the shared library to /usr/local/lib/ directory install(TARGETS linenoise DESTINATION ${CMAKE_INSTALL_LIBDIR} ) # adds all the relevant headers to /usr/local/include/gphoto2pp when ``make install`` is executed install(FILES ${LINENOISE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linenoise ) # install the pkg-config config to system folder # install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) -endif(CMAKE_BUILD_TYPE MATCHES "RELEASE") +endif(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") add_executable(example example.c) target_link_libraries(example linenoise) From 7d758d3521e4b482decfaf28df565de873c746d6 Mon Sep 17 00:00:00 2001 From: vitor Date: Sun, 16 Feb 2025 09:02:40 +0000 Subject: [PATCH 15/20] added options for buinding examples and tests --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96f3d5e7..f4ac53e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,7 +46,11 @@ if(CMAKE_BUILD_TYPE MATCHES "RELEASE") # install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) endif(CMAKE_BUILD_TYPE MATCHES "RELEASE") -add_executable(example example.c) -target_link_libraries(example linenoise) - -add_subdirectory(test) +if (OPT_BUILD_EXAMPLES) + add_executable(example example.c) + target_link_libraries(example linenoise) +endif (OPT_BUILD_EXAMPLES) + +if (OPT_BUILD_TESTS) + add_subdirectory(test) +endif (OPT_BUILD_TESTS) \ No newline at end of file From 46f3ced0f084f4182766b5a507dc8678b6237987 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Mon, 17 Feb 2025 12:10:32 +0000 Subject: [PATCH 16/20] added build options --- CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfe5fde3..39e3b5f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,9 @@ elseif(NOT CMAKE_BUILD_TYPE) message(FATAL_ERROR "No build type specified. Use -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] to specify.") endif(CMAKE_BUILD_TYPE) +option(LINENOISE_BUILD_EXAMPLES "Build examples" OFF) +option(LINENOISE_BUILD_TESTS "Build unit tests" OFF) + # set the version of our library # MAJOR, is significant breaking changes, MINOR, is when we might have changed signatures of existing functions, PATCH, is just bug fixes and no breaking changes set(LINENOISE_VERSION_MAJOR 1) @@ -51,11 +54,13 @@ if(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") # install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) endif(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") -if (OPT_BUILD_EXAMPLES) +if(LINENOISE_BUILD_EXAMPLES) + message(STATUS "Building examples") add_executable(example example.c) target_link_libraries(example linenoise) -endif (OPT_BUILD_EXAMPLES) +endif(LINENOISE_BUILD_EXAMPLES) -if (OPT_BUILD_TESTS) +if(LINENOISE_BUILD_TESTS) + message(STATUS "Building tests") add_subdirectory(test) -endif (OPT_BUILD_TESTS) \ No newline at end of file +endif(LINENOISE_BUILD_TESTS) \ No newline at end of file From ecf98fa831629771111458aa970626bb0343be04 Mon Sep 17 00:00:00 2001 From: VSF1 Date: Sat, 8 Mar 2025 18:03:57 +0000 Subject: [PATCH 17/20] updated pkgconfig --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39e3b5f3..dfb0d4cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,7 @@ if(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") # adds all the relevant headers to /usr/local/include/gphoto2pp when ``make install`` is executed install(FILES ${LINENOISE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linenoise ) # install the pkg-config config to system folder -# install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) + install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) endif(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") if(LINENOISE_BUILD_EXAMPLES) From afb8bcf5396a5beb5f16308b049f512c46003171 Mon Sep 17 00:00:00 2001 From: Vitor Fonseca Date: Fri, 20 Mar 2026 14:38:58 +0000 Subject: [PATCH 18/20] Delete CMakeLists.txt --- CMakeLists.txt | 66 -------------------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index dfb0d4cf..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,66 +0,0 @@ -cmake_minimum_required (VERSION 3.5) -project (LINENOISE DESCRIPTION "A shell library") - -# Configuration specific to being the main project -if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) - set(CMAKE_VERBOSE_MAKEFILE ON) - set(LINENOISE_NOT_SUBPROJECT ON) -endif(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) - -if(CMAKE_BUILD_TYPE) - message("Building ${PROJECT_NAME} in ${CMAKE_BUILD_TYPE} build.") -elseif(NOT CMAKE_BUILD_TYPE) - message(FATAL_ERROR "No build type specified. Use -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] to specify.") -endif(CMAKE_BUILD_TYPE) - -option(LINENOISE_BUILD_EXAMPLES "Build examples" OFF) -option(LINENOISE_BUILD_TESTS "Build unit tests" OFF) - -# set the version of our library -# MAJOR, is significant breaking changes, MINOR, is when we might have changed signatures of existing functions, PATCH, is just bug fixes and no breaking changes -set(LINENOISE_VERSION_MAJOR 1) -set(LINENOISE_VERSION_MINOR 0) -set(LINENOISE_VERSION_PATCH 1) -set(LINENOISE_VERSION_STRING ${LINENOISE_VERSION_MAJOR}.${LINENOISE_VERSION_MINOR}.${LINENOISE_VERSION_PATCH}) - -file(GLOB LINENOISE_SOURCE_FILES "linenoise.c") -file(GLOB LINENOISE_HEADER_FILES "linenoise.h") - -set(LINENOISE_SOURCES ${LINENOISE_SOURCE_FILES}) -set(LINENOISE_HEADERS ${LINENOISE_HEADER_FILES}) - -# where the library will be built to -set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/libs) - -add_library(linenoise SHARED ${LINENOISE_SOURCES} ${LINENOISE_HEADERS}) -target_link_libraries(linenoise) - -target_include_directories(linenoise PUBLIC ".") -# sets the shared library version -# http://cmake.3232098.n2.nabble.com/Version-in-name-of-shared-library-td7581530.html -set_target_properties(linenoise PROPERTIES VERSION ${LINENOISE_VERSION_STRING} SOVERSION ${LINENOISE_VERSION_MAJOR}) -set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) - -# create pkg-config files for configuration in non-cmake projects -# configure_file(linenoise.pc.in linenoise.pc @ONLY) - -# only offer install option if they compiled with release mode -if(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") - # adds the 'make install' targets to copy the shared library to /usr/local/lib/ directory - install(TARGETS linenoise DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - # adds all the relevant headers to /usr/local/include/gphoto2pp when ``make install`` is executed - install(FILES ${LINENOISE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linenoise ) - # install the pkg-config config to system folder - install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) -endif(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") - -if(LINENOISE_BUILD_EXAMPLES) - message(STATUS "Building examples") - add_executable(example example.c) - target_link_libraries(example linenoise) -endif(LINENOISE_BUILD_EXAMPLES) - -if(LINENOISE_BUILD_TESTS) - message(STATUS "Building tests") - add_subdirectory(test) -endif(LINENOISE_BUILD_TESTS) \ No newline at end of file From c4f3ce02b05b9ba929874234b3405f4c447f7caf Mon Sep 17 00:00:00 2001 From: vitor Date: Fri, 20 Mar 2026 14:44:30 +0000 Subject: [PATCH 19/20] updated --- CMakeLists.txt | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 0 2 files changed, 66 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..dfb0d4cf --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required (VERSION 3.5) +project (LINENOISE DESCRIPTION "A shell library") + +# Configuration specific to being the main project +if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) + set(CMAKE_VERBOSE_MAKEFILE ON) + set(LINENOISE_NOT_SUBPROJECT ON) +endif(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME) + +if(CMAKE_BUILD_TYPE) + message("Building ${PROJECT_NAME} in ${CMAKE_BUILD_TYPE} build.") +elseif(NOT CMAKE_BUILD_TYPE) + message(FATAL_ERROR "No build type specified. Use -DCMAKE_BUILD_TYPE=[DEBUG|RELEASE] to specify.") +endif(CMAKE_BUILD_TYPE) + +option(LINENOISE_BUILD_EXAMPLES "Build examples" OFF) +option(LINENOISE_BUILD_TESTS "Build unit tests" OFF) + +# set the version of our library +# MAJOR, is significant breaking changes, MINOR, is when we might have changed signatures of existing functions, PATCH, is just bug fixes and no breaking changes +set(LINENOISE_VERSION_MAJOR 1) +set(LINENOISE_VERSION_MINOR 0) +set(LINENOISE_VERSION_PATCH 1) +set(LINENOISE_VERSION_STRING ${LINENOISE_VERSION_MAJOR}.${LINENOISE_VERSION_MINOR}.${LINENOISE_VERSION_PATCH}) + +file(GLOB LINENOISE_SOURCE_FILES "linenoise.c") +file(GLOB LINENOISE_HEADER_FILES "linenoise.h") + +set(LINENOISE_SOURCES ${LINENOISE_SOURCE_FILES}) +set(LINENOISE_HEADERS ${LINENOISE_HEADER_FILES}) + +# where the library will be built to +set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/libs) + +add_library(linenoise SHARED ${LINENOISE_SOURCES} ${LINENOISE_HEADERS}) +target_link_libraries(linenoise) + +target_include_directories(linenoise PUBLIC ".") +# sets the shared library version +# http://cmake.3232098.n2.nabble.com/Version-in-name-of-shared-library-td7581530.html +set_target_properties(linenoise PROPERTIES VERSION ${LINENOISE_VERSION_STRING} SOVERSION ${LINENOISE_VERSION_MAJOR}) +set_target_properties(linenoise PROPERTIES LINKER_LANGUAGE C) + +# create pkg-config files for configuration in non-cmake projects +# configure_file(linenoise.pc.in linenoise.pc @ONLY) + +# only offer install option if they compiled with release mode +if(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") + # adds the 'make install' targets to copy the shared library to /usr/local/lib/ directory + install(TARGETS linenoise DESTINATION ${CMAKE_INSTALL_LIBDIR} ) + # adds all the relevant headers to /usr/local/include/gphoto2pp when ``make install`` is executed + install(FILES ${LINENOISE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/linenoise ) + # install the pkg-config config to system folder + install(FILES ${CMAKE_BINARY_DIR}/linenoise.pc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) +endif(CMAKE_BUILD_TYPE MATCHES "^(RELEASE|Release)") + +if(LINENOISE_BUILD_EXAMPLES) + message(STATUS "Building examples") + add_executable(example example.c) + target_link_libraries(example linenoise) +endif(LINENOISE_BUILD_EXAMPLES) + +if(LINENOISE_BUILD_TESTS) + message(STATUS "Building tests") + add_subdirectory(test) +endif(LINENOISE_BUILD_TESTS) \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..e69de29b From c518f5caab6d3ae3e6e5cf7083b31af05a63fcdb Mon Sep 17 00:00:00 2001 From: Vitor Fonseca Date: Sun, 3 May 2026 10:05:26 +0100 Subject: [PATCH 20/20] updated build script --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfb0d4cf..c871ea33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.10) project (LINENOISE DESCRIPTION "A shell library") # Configuration specific to being the main project