From c80280eec3b80c4aae77c9275746869a7a25da3d Mon Sep 17 00:00:00 2001 From: Arkadiusz Hypki Date: Fri, 8 Nov 2024 09:47:24 +0100 Subject: [PATCH] 'Added CLion IDE projects to show how one can create one shared library and then import it from another project;' --- ex4/clion-ide/test-cpp/.idea/.name | 1 + ex4/clion-ide/test-cpp/.idea/editor.xml | 580 ++++++++++++++++++ ex4/clion-ide/test-cpp/.idea/misc.xml | 14 + ex4/clion-ide/test-cpp/.idea/modules.xml | 8 + ex4/clion-ide/test-cpp/.idea/test-cpp.iml | 2 + ex4/clion-ide/test-cpp/CMakeLists.txt | 22 + ex4/clion-ide/test-cpp/main.cpp | 11 + ex4/clion-ide/test-libshared/.idea/.name | 1 + ex4/clion-ide/test-libshared/.idea/editor.xml | 580 ++++++++++++++++++ ex4/clion-ide/test-libshared/.idea/misc.xml | 13 + .../test-libshared/.idea/modules.xml | 8 + .../test-libshared/.idea/untitled1.iml | 2 + ex4/clion-ide/test-libshared/CMakeLists.txt | 6 + ex4/clion-ide/test-libshared/library.cpp | 7 + ex4/clion-ide/test-libshared/library.h | 6 + ex4/{ => eclipse-ide}/lib/.cproject | 0 ex4/{ => eclipse-ide}/lib/.project | 0 .../lib/.settings/language.settings.xml | 0 ex4/{ => eclipse-ide}/lib/Debug/TestClass.d | 0 ex4/{ => eclipse-ide}/lib/Debug/TestClass.o | Bin .../lib/Debug/liblib-cpp-shared.so | Bin ex4/{ => eclipse-ide}/lib/Debug/makefile | 0 ex4/{ => eclipse-ide}/lib/Debug/sources.mk | 0 ex4/{ => eclipse-ide}/lib/Debug/subdir.mk | 0 ex4/{ => eclipse-ide}/lib/TestClass.cpp | 0 ex4/{ => eclipse-ide}/lib/TestClass.h | 0 ex4/{ => eclipse-ide}/main/.cproject | 0 ex4/{ => eclipse-ide}/main/.project | 0 .../main/.settings/language.settings.xml | 0 .../main/.settings/org.eclipse.cdt.core.prefs | 0 .../main/src/main-using-lib-cpp-shared.cpp | 0 31 files changed, 1261 insertions(+) create mode 100644 ex4/clion-ide/test-cpp/.idea/.name create mode 100644 ex4/clion-ide/test-cpp/.idea/editor.xml create mode 100644 ex4/clion-ide/test-cpp/.idea/misc.xml create mode 100644 ex4/clion-ide/test-cpp/.idea/modules.xml create mode 100644 ex4/clion-ide/test-cpp/.idea/test-cpp.iml create mode 100644 ex4/clion-ide/test-cpp/CMakeLists.txt create mode 100644 ex4/clion-ide/test-cpp/main.cpp create mode 100644 ex4/clion-ide/test-libshared/.idea/.name create mode 100644 ex4/clion-ide/test-libshared/.idea/editor.xml create mode 100644 ex4/clion-ide/test-libshared/.idea/misc.xml create mode 100644 ex4/clion-ide/test-libshared/.idea/modules.xml create mode 100644 ex4/clion-ide/test-libshared/.idea/untitled1.iml create mode 100644 ex4/clion-ide/test-libshared/CMakeLists.txt create mode 100644 ex4/clion-ide/test-libshared/library.cpp create mode 100644 ex4/clion-ide/test-libshared/library.h rename ex4/{ => eclipse-ide}/lib/.cproject (100%) rename ex4/{ => eclipse-ide}/lib/.project (100%) rename ex4/{ => eclipse-ide}/lib/.settings/language.settings.xml (100%) rename ex4/{ => eclipse-ide}/lib/Debug/TestClass.d (100%) rename ex4/{ => eclipse-ide}/lib/Debug/TestClass.o (100%) rename ex4/{ => eclipse-ide}/lib/Debug/liblib-cpp-shared.so (100%) rename ex4/{ => eclipse-ide}/lib/Debug/makefile (100%) rename ex4/{ => eclipse-ide}/lib/Debug/sources.mk (100%) rename ex4/{ => eclipse-ide}/lib/Debug/subdir.mk (100%) rename ex4/{ => eclipse-ide}/lib/TestClass.cpp (100%) rename ex4/{ => eclipse-ide}/lib/TestClass.h (100%) rename ex4/{ => eclipse-ide}/main/.cproject (100%) rename ex4/{ => eclipse-ide}/main/.project (100%) rename ex4/{ => eclipse-ide}/main/.settings/language.settings.xml (100%) rename ex4/{ => eclipse-ide}/main/.settings/org.eclipse.cdt.core.prefs (100%) rename ex4/{ => eclipse-ide}/main/src/main-using-lib-cpp-shared.cpp (100%) diff --git a/ex4/clion-ide/test-cpp/.idea/.name b/ex4/clion-ide/test-cpp/.idea/.name new file mode 100644 index 0000000..60f3686 --- /dev/null +++ b/ex4/clion-ide/test-cpp/.idea/.name @@ -0,0 +1 @@ +test_cpp \ No newline at end of file diff --git a/ex4/clion-ide/test-cpp/.idea/editor.xml b/ex4/clion-ide/test-cpp/.idea/editor.xml new file mode 100644 index 0000000..226ca24 --- /dev/null +++ b/ex4/clion-ide/test-cpp/.idea/editor.xml @@ -0,0 +1,580 @@ + + + + + \ No newline at end of file diff --git a/ex4/clion-ide/test-cpp/.idea/misc.xml b/ex4/clion-ide/test-cpp/.idea/misc.xml new file mode 100644 index 0000000..97dabe1 --- /dev/null +++ b/ex4/clion-ide/test-cpp/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + \ No newline at end of file diff --git a/ex4/clion-ide/test-cpp/.idea/modules.xml b/ex4/clion-ide/test-cpp/.idea/modules.xml new file mode 100644 index 0000000..357c89a --- /dev/null +++ b/ex4/clion-ide/test-cpp/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ex4/clion-ide/test-cpp/.idea/test-cpp.iml b/ex4/clion-ide/test-cpp/.idea/test-cpp.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/ex4/clion-ide/test-cpp/.idea/test-cpp.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ex4/clion-ide/test-cpp/CMakeLists.txt b/ex4/clion-ide/test-cpp/CMakeLists.txt new file mode 100644 index 0000000..7752ca6 --- /dev/null +++ b/ex4/clion-ide/test-cpp/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.29) +project(test_cpp) + +set(CMAKE_CXX_STANDARD 20) + +#find_package(testlib) + +add_executable(test_cpp main.cpp) + +#set (CMAKE_PREFIX_PATH "/home/ahypki/CLionProjects/test-libshared/cmake-build-debug/") +# + +#target_link_libraries(testlib PUBLIC /home/ahypki/CLionProjects/test-libshared/cmake-build-debug/libtestlib.so) + +#add_library(testlib SHARED IMPORTED) +#set_target_properties(testlib PROPERTIES IMPORTED_LOCATION "/home/ahypki/CLionProjects/test-libshared/cmake-build-debug/libtestlib.so") + +#target_link_libraries(testlib testlib) + + +include_directories(/home/ahypki/CLionProjects/test-libshared/cmake-build-debug/) +target_link_libraries(test_cpp "/home/ahypki/CLionProjects/test-libshared/cmake-build-debug/libtestlib.so") diff --git a/ex4/clion-ide/test-cpp/main.cpp b/ex4/clion-ide/test-cpp/main.cpp new file mode 100644 index 0000000..9814a30 --- /dev/null +++ b/ex4/clion-ide/test-cpp/main.cpp @@ -0,0 +1,11 @@ +#include +#include "../test-libshared/library.h" + +int main() +{ + std::cout << "Hello, World!" << std::endl; + + hello(); + + return 0; +} diff --git a/ex4/clion-ide/test-libshared/.idea/.name b/ex4/clion-ide/test-libshared/.idea/.name new file mode 100644 index 0000000..ffcc5e3 --- /dev/null +++ b/ex4/clion-ide/test-libshared/.idea/.name @@ -0,0 +1 @@ +testlib \ No newline at end of file diff --git a/ex4/clion-ide/test-libshared/.idea/editor.xml b/ex4/clion-ide/test-libshared/.idea/editor.xml new file mode 100644 index 0000000..1f0ef49 --- /dev/null +++ b/ex4/clion-ide/test-libshared/.idea/editor.xml @@ -0,0 +1,580 @@ + + + + + \ No newline at end of file diff --git a/ex4/clion-ide/test-libshared/.idea/misc.xml b/ex4/clion-ide/test-libshared/.idea/misc.xml new file mode 100644 index 0000000..7fcdf18 --- /dev/null +++ b/ex4/clion-ide/test-libshared/.idea/misc.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/ex4/clion-ide/test-libshared/.idea/modules.xml b/ex4/clion-ide/test-libshared/.idea/modules.xml new file mode 100644 index 0000000..4922bfe --- /dev/null +++ b/ex4/clion-ide/test-libshared/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ex4/clion-ide/test-libshared/.idea/untitled1.iml b/ex4/clion-ide/test-libshared/.idea/untitled1.iml new file mode 100644 index 0000000..f08604b --- /dev/null +++ b/ex4/clion-ide/test-libshared/.idea/untitled1.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ex4/clion-ide/test-libshared/CMakeLists.txt b/ex4/clion-ide/test-libshared/CMakeLists.txt new file mode 100644 index 0000000..9e11ead --- /dev/null +++ b/ex4/clion-ide/test-libshared/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.29) +project(testlib) + +set(CMAKE_CXX_STANDARD 20) + +add_library(testlib SHARED library.cpp) diff --git a/ex4/clion-ide/test-libshared/library.cpp b/ex4/clion-ide/test-libshared/library.cpp new file mode 100644 index 0000000..ede525a --- /dev/null +++ b/ex4/clion-ide/test-libshared/library.cpp @@ -0,0 +1,7 @@ +#include "library.h" + +#include + +void hello() { + std::cout << "Hello, World BUT from library!" << std::endl; +} diff --git a/ex4/clion-ide/test-libshared/library.h b/ex4/clion-ide/test-libshared/library.h new file mode 100644 index 0000000..de090b9 --- /dev/null +++ b/ex4/clion-ide/test-libshared/library.h @@ -0,0 +1,6 @@ +#ifndef UNTITLED1_LIBRARY_H +#define UNTITLED1_LIBRARY_H + +void hello(); + +#endif //UNTITLED1_LIBRARY_H diff --git a/ex4/lib/.cproject b/ex4/eclipse-ide/lib/.cproject similarity index 100% rename from ex4/lib/.cproject rename to ex4/eclipse-ide/lib/.cproject diff --git a/ex4/lib/.project b/ex4/eclipse-ide/lib/.project similarity index 100% rename from ex4/lib/.project rename to ex4/eclipse-ide/lib/.project diff --git a/ex4/lib/.settings/language.settings.xml b/ex4/eclipse-ide/lib/.settings/language.settings.xml similarity index 100% rename from ex4/lib/.settings/language.settings.xml rename to ex4/eclipse-ide/lib/.settings/language.settings.xml diff --git a/ex4/lib/Debug/TestClass.d b/ex4/eclipse-ide/lib/Debug/TestClass.d similarity index 100% rename from ex4/lib/Debug/TestClass.d rename to ex4/eclipse-ide/lib/Debug/TestClass.d diff --git a/ex4/lib/Debug/TestClass.o b/ex4/eclipse-ide/lib/Debug/TestClass.o similarity index 100% rename from ex4/lib/Debug/TestClass.o rename to ex4/eclipse-ide/lib/Debug/TestClass.o diff --git a/ex4/lib/Debug/liblib-cpp-shared.so b/ex4/eclipse-ide/lib/Debug/liblib-cpp-shared.so similarity index 100% rename from ex4/lib/Debug/liblib-cpp-shared.so rename to ex4/eclipse-ide/lib/Debug/liblib-cpp-shared.so diff --git a/ex4/lib/Debug/makefile b/ex4/eclipse-ide/lib/Debug/makefile similarity index 100% rename from ex4/lib/Debug/makefile rename to ex4/eclipse-ide/lib/Debug/makefile diff --git a/ex4/lib/Debug/sources.mk b/ex4/eclipse-ide/lib/Debug/sources.mk similarity index 100% rename from ex4/lib/Debug/sources.mk rename to ex4/eclipse-ide/lib/Debug/sources.mk diff --git a/ex4/lib/Debug/subdir.mk b/ex4/eclipse-ide/lib/Debug/subdir.mk similarity index 100% rename from ex4/lib/Debug/subdir.mk rename to ex4/eclipse-ide/lib/Debug/subdir.mk diff --git a/ex4/lib/TestClass.cpp b/ex4/eclipse-ide/lib/TestClass.cpp similarity index 100% rename from ex4/lib/TestClass.cpp rename to ex4/eclipse-ide/lib/TestClass.cpp diff --git a/ex4/lib/TestClass.h b/ex4/eclipse-ide/lib/TestClass.h similarity index 100% rename from ex4/lib/TestClass.h rename to ex4/eclipse-ide/lib/TestClass.h diff --git a/ex4/main/.cproject b/ex4/eclipse-ide/main/.cproject similarity index 100% rename from ex4/main/.cproject rename to ex4/eclipse-ide/main/.cproject diff --git a/ex4/main/.project b/ex4/eclipse-ide/main/.project similarity index 100% rename from ex4/main/.project rename to ex4/eclipse-ide/main/.project diff --git a/ex4/main/.settings/language.settings.xml b/ex4/eclipse-ide/main/.settings/language.settings.xml similarity index 100% rename from ex4/main/.settings/language.settings.xml rename to ex4/eclipse-ide/main/.settings/language.settings.xml diff --git a/ex4/main/.settings/org.eclipse.cdt.core.prefs b/ex4/eclipse-ide/main/.settings/org.eclipse.cdt.core.prefs similarity index 100% rename from ex4/main/.settings/org.eclipse.cdt.core.prefs rename to ex4/eclipse-ide/main/.settings/org.eclipse.cdt.core.prefs diff --git a/ex4/main/src/main-using-lib-cpp-shared.cpp b/ex4/eclipse-ide/main/src/main-using-lib-cpp-shared.cpp similarity index 100% rename from ex4/main/src/main-using-lib-cpp-shared.cpp rename to ex4/eclipse-ide/main/src/main-using-lib-cpp-shared.cpp