From 790fbbac4acb30cdabb723b8b0ed3638868b73d8 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Tue, 12 Sep 2023 17:16:13 +0200 Subject: [PATCH] testlib --- .gitignore | 5 + members/c-bindings/lib/CMakeLists.txt | 15 ++ members/c-bindings/lib/Makefile | 230 ++++++++++++++++++++++++++ members/c-bindings/lib/test.c | 5 + members/c-bindings/lib/test.h | 1 + 5 files changed, 256 insertions(+) create mode 100644 members/c-bindings/lib/CMakeLists.txt create mode 100644 members/c-bindings/lib/Makefile create mode 100644 members/c-bindings/lib/test.c create mode 100644 members/c-bindings/lib/test.h diff --git a/.gitignore b/.gitignore index ea8c4bf..04ce869 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ /target +members/c-bindings/lib/CMakeCache.txt +members/c-bindings/lib/cmake_install.cmake +members/c-bindings/lib/libtest.so +members/c-bindings/lib/libtest.so.1 +members/c-bindings/lib/libtest.so.1.0.1 diff --git a/members/c-bindings/lib/CMakeLists.txt b/members/c-bindings/lib/CMakeLists.txt new file mode 100644 index 0000000..634d518 --- /dev/null +++ b/members/c-bindings/lib/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.9) +project(test VERSION 1.0.1 DESCRIPTION "test lib") +include(GNUInstallDirs) +add_library(test SHARED test.c) +set_target_properties(test PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION 1 + PUBLIC_HEADER test.h) +# configure_file(test.pc.in test.pc @ONLY) +target_include_directories(test PRIVATE .) +install(TARGETS test + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES ${CMAKE_BINARY_DIR}/test.pc + DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) diff --git a/members/c-bindings/lib/Makefile b/members/c-bindings/lib/Makefile new file mode 100644 index 0000000..aae36f6 --- /dev/null +++ b/members/c-bindings/lib/Makefile @@ -0,0 +1,230 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.22 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/cscherr/Documents/code/rust/rs-basic/members/c-bindings/lib + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/cscherr/Documents/code/rust/rs-basic/members/c-bindings/lib + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/cscherr/Documents/code/rust/rs-basic/members/c-bindings/lib/CMakeFiles /home/cscherr/Documents/code/rust/rs-basic/members/c-bindings/lib//CMakeFiles/progress.marks + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/cscherr/Documents/code/rust/rs-basic/members/c-bindings/lib/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named test + +# Build rule for target. +test: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 test +.PHONY : test + +# fast build rule for target. +test/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/build +.PHONY : test/fast + +test.o: test.c.o +.PHONY : test.o + +# target to build an object file +test.c.o: + $(MAKE) $(MAKESILENT) -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/test.c.o +.PHONY : test.c.o + +test.i: test.c.i +.PHONY : test.i + +# target to preprocess a source file +test.c.i: + $(MAKE) $(MAKESILENT) -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/test.c.i +.PHONY : test.c.i + +test.s: test.c.s +.PHONY : test.s + +# target to generate assembly for a file +test.c.s: + $(MAKE) $(MAKESILENT) -f CMakeFiles/test.dir/build.make CMakeFiles/test.dir/test.c.s +.PHONY : test.c.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... test" + @echo "... test.o" + @echo "... test.i" + @echo "... test.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/members/c-bindings/lib/test.c b/members/c-bindings/lib/test.c new file mode 100644 index 0000000..511b773 --- /dev/null +++ b/members/c-bindings/lib/test.c @@ -0,0 +1,5 @@ +#include "test.h" + +int ret19() { + return 19; +} diff --git a/members/c-bindings/lib/test.h b/members/c-bindings/lib/test.h new file mode 100644 index 0000000..c771912 --- /dev/null +++ b/members/c-bindings/lib/test.h @@ -0,0 +1 @@ +int ret19();