mirror of
https://github.com/vimpunk/mio.git
synced 2025-12-06 16:57:01 +08:00
commit
571b003b8d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
test/**
|
test/**
|
||||||
!test/test.cpp
|
!test/test.cpp
|
||||||
!test/example.cpp
|
!test/example.cpp
|
||||||
|
build/
|
||||||
|
|||||||
36
CMakeLists.txt
Normal file
36
CMakeLists.txt
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
cmake_minimum_required( VERSION 3.2.2 )
|
||||||
|
project( mio )
|
||||||
|
|
||||||
|
### Standard
|
||||||
|
set( CMAKE_CXX_STANDARD 11 )
|
||||||
|
|
||||||
|
# Generate 'compile_commands.json' for clang_complete
|
||||||
|
set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||||
|
|
||||||
|
### Flags/Options
|
||||||
|
option( BUILD_TESTS "Enable the building of mio unit tests" OFF )
|
||||||
|
|
||||||
|
### Library targets
|
||||||
|
add_library( mio INTERFACE)
|
||||||
|
target_include_directories( mio INTERFACE include )
|
||||||
|
install(
|
||||||
|
DIRECTORY include/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
|
||||||
|
### Test targets
|
||||||
|
if( BUILD_TESTS )
|
||||||
|
## test
|
||||||
|
add_executable(
|
||||||
|
test
|
||||||
|
test/test.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries( test PRIVATE mio )
|
||||||
|
|
||||||
|
## example
|
||||||
|
add_executable(
|
||||||
|
example
|
||||||
|
test/example.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries( example PRIVATE mio )
|
||||||
|
endif()
|
||||||
14
README.md
14
README.md
@ -140,3 +140,17 @@ Though generally not needed, since mio maps users requested offsets to page boun
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
mio is a header-only library, so just copy the contents in `mio/include` into your system wide include path, such as `/usr/include`, or into your project's lib folder.
|
mio is a header-only library, so just copy the contents in `mio/include` into your system wide include path, such as `/usr/include`, or into your project's lib folder.
|
||||||
|
|
||||||
|
## CMake
|
||||||
|
A `CMakeLists.txt` is provided to allow easy git submodule usage or installation.
|
||||||
|
|
||||||
|
To use as a submodule, clone mio within your project's dependencies/externals folder and add:
|
||||||
|
```
|
||||||
|
add_subdirectory( dependencies_folder/mio )
|
||||||
|
target_link_libraries( MyCoolProject mio )
|
||||||
|
```
|
||||||
|
to your project's `CMakeLists.txt` to add mio into `MyCoolProject`'s include-space.
|
||||||
|
|
||||||
|
To install, do an out-of-source build(such as making a `build` folder and running `cmake ..` inside of it) and then run `sudo make install` to copy relevant include files to
|
||||||
|
|
||||||
|
The optional `BUILD_TESTS` option can be used to build unit tests(off by default) by instead using `cmake -DBUILD_TESTS=ON ..`
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "../include/mio/mmap.hpp"
|
#include <mio/mmap.hpp>
|
||||||
#include <system_error> // for std::error_code
|
#include <system_error> // for std::error_code
|
||||||
#include <cstdio> // for std::printf
|
#include <cstdio> // for std::printf
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "../include/mio/mmap.hpp"
|
#include <mio/mmap.hpp>
|
||||||
#include "../include/mio/shared_mmap.hpp"
|
#include <mio/shared_mmap.hpp>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user