Skip to content

Commit b83b405

Browse files
committed
New version 1.3.2
add example fix installation rules
1 parent d8b9f03 commit b83b405

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.10)
22

33
# set the project name
4-
project(mrc VERSION 1.3.1)
4+
project(mrc VERSION 1.3.2)
55

66
enable_testing()
77

@@ -60,12 +60,12 @@ set(PACKAGE_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
6060

6161
configure_file(${PROJECT_SOURCE_DIR}/mrc.h.in mrc.h)
6262

63-
install(TARGETS mrc CONFIGURATIONS Release)
63+
install(TARGETS mrc)
6464

6565
if(WIN32)
6666
install(FILES mrc-config.cmake DESTINATION cmake)
6767
install(FILES mrc-manual.pdf DESTINATION doc)
6868
else()
6969
install(FILES mrc-config.cmake DESTINATION share/mrc/cmake)
70-
install(FILES mrc-manual.pdf DESTINATION share/doc/mrc)
70+
install(FILES mrc.1 DESTINATION share/man/man1)
7171
endif()

changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 1.3.2
2+
- Fix install rules in CMakeLists.txt
3+
- Added example code
4+
15
Version 1.3.1
26
- Fix writing header to specified output instead of stdout
37
- Added a cmake config file, for easy configuration

example/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
# set the project name
4+
project(mrc-user VERSION 1.0.0 LANGUAGES CXX)
5+
6+
# Locate the mrc executable and load the mrc_* functions
7+
find_package(mrc)
8+
9+
# Write out an mrsrc.hpp file and make sure the compiler finds it
10+
mrc_write_header(${CMAKE_CURRENT_BINARY_DIR}/mrsrc.hpp)
11+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
12+
13+
# The executable to create
14+
add_executable(mrc-user ${CMAKE_CURRENT_SOURCE_DIR}/mrc-user.cpp)
15+
16+
# Add the hello.txt file as a resource, more files and/or directories
17+
# can be specified here
18+
mrc_target_resources(mrc-user ${CMAKE_CURRENT_SOURCE_DIR}/hello.txt)

example/hello.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello, world!

example/mrc-user.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Example of the use of resources created with mrc in a C++ application
3+
*/
4+
5+
#include <iostream>
6+
7+
// Include the generated header file
8+
#include "mrsrc.hpp"
9+
10+
int main()
11+
{
12+
try
13+
{
14+
mrsrc::rsrc res("hello.txt");
15+
if (not res)
16+
throw std::runtime_error("Resource not found");
17+
18+
std::cout.write(res.data(), res.size());
19+
std::cout << std::endl;
20+
}
21+
catch(const std::exception& e)
22+
{
23+
std::cerr << e.what() << '\n';
24+
exit(1);
25+
}
26+
27+
return 0;
28+
}
29+

0 commit comments

Comments
 (0)