Testing version

This commit is contained in:
Václav Valíček 2020-05-16 23:32:17 +02:00
parent c083ffd6f1
commit ce14270d6a
10 changed files with 79 additions and 0 deletions

6
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

1
.idea/.name Normal file
View File

@ -0,0 +1 @@
test_shared_library

4
.idea/misc.xml Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/test-shared-library.iml" filepath="$PROJECT_DIR$/.idea/test-shared-library.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

24
CMakeLists.txt Normal file
View File

@ -0,0 +1,24 @@
cmake_minimum_required(VERSION 3.9)
project(test_shared_library LANGUAGES C VERSION 1.0.1 DESCRIPTION "Shared C Library for testin")
include(GNUInstallDirs)
add_library(test_shared_library SHARED test_shared_library.c test_shared_library.h)
set(CMAKE_C_STANDARD 99)
set_target_properties(test_shared_library PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION 1
PUBLIC_HEADER test_shared_library.h)
configure_file(test_shared_library.pc.in test_shared_library.pc @ONLY)
target_include_directories(test_shared_library PRIVATE .)
install(TARGETS test_shared_library
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${CMAKE_BINARY_DIR}/test_shared_library.pc
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
add_executable(test test.c)
target_link_libraries(test test_shared_library)

7
test.c Normal file
View File

@ -0,0 +1,7 @@
#include <stdio.h>
#include "test_shared_library.h"
int main(void){
printf("Hello result: %d\n", hello(12));
return 0;
}

9
test_shared_library.c Normal file
View File

@ -0,0 +1,9 @@
#include "test_shared_library.h"
#include <stdio.h>
#include <stdint.h>
int hello(int param) {
printf("Hello, World!\n");
return param;
}

6
test_shared_library.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef TEST_SHARED_LIBRARY_TEST_SHARED_LIBRARY_H
#define TEST_SHARED_LIBRARY_TEST_SHARED_LIBRARY_H
int hello(int param);
#endif //TEST_SHARED_LIBRARY_TEST_SHARED_LIBRARY_H

12
test_shared_library.pc.in Normal file
View File

@ -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: @PROJECT_VERSION@
Requires:
Libs: -L${libdir} -ltest_shared_library
Cflags: -I${includedir}