forked from pmem/libpmemobj-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pmem#5 from igchor/init_examples
Build examples
- Loading branch information
Showing
55 changed files
with
364 additions
and
1,118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# | ||
# Copyright 2018, Intel Corporation | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# | ||
# * Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# | ||
# * Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in | ||
# the documentation and/or other materials provided with the | ||
# distribution. | ||
# | ||
# * Neither the name of the copyright holder nor the names of its | ||
# contributors may be used to endorse or promote products derived | ||
# from this software without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
include_directories(${PMEMOBJ_INCLUDE_DIRS} .) | ||
link_directories(${PMEMOBJ_LIBRARY_DIRS}) | ||
|
||
add_cppstyle(examples-common ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) | ||
add_check_whitespace(examples-common ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp) | ||
|
||
function(add_example name srcs) | ||
prepend(srcs ${CMAKE_CURRENT_SOURCE_DIR} ${srcs}) | ||
add_executable(example-${name} ${srcs}) | ||
add_cppstyle(examples-${name} ${srcs}) | ||
add_check_whitespace(examples-${name} ${srcs}) | ||
endfunction() | ||
|
||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(CURSES QUIET ncurses) | ||
else() | ||
# Specifies that we want FindCurses to find ncurses and not just any | ||
# curses library | ||
set(CURSES_NEED_NCURSES TRUE) | ||
find_package(Curses QUIET) | ||
endif() | ||
|
||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(SFML QUIET sfml-all>=2.4) | ||
else() | ||
find_package(SFML 2.4 QUIET all) | ||
endif() | ||
|
||
add_example(queue queue/queue.cpp) | ||
target_link_libraries(example-queue ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
if(CURSES_FOUND) | ||
add_example(pman pman/pman.cpp) | ||
target_include_directories(example-pman PUBLIC ${CURSES_INCLUDE_DIR}) | ||
target_link_libraries(example-pman ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURSES_LIBRARIES}) | ||
else() | ||
message(WARNING "ncurses not found - pman won't be build") | ||
endif() | ||
|
||
if(SFML_FOUND) | ||
add_example(pmpong pmpong/Ball.cpp pmpong/GameController.cpp pmpong/GameOverView.cpp | ||
pmpong/GameView.cpp pmpong/MainGame.cpp pmpong/MenuView.cpp pmpong/Paddle.cpp | ||
pmpong/PongGameStatus.cpp pmpong/Pool.cpp) | ||
target_include_directories(example-pmpong PUBLIC ${SFML_INCLUDE_DIR}) | ||
target_link_libraries(example-pmpong ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${SFML_LIBRARIES}) | ||
|
||
if(NOT WIN32) | ||
execute_process(COMMAND uname -s OUTPUT_VARIABLE SYSTEM_TYPE) | ||
if(SYSTEM_TYPE STREQUAL "FreeBSD") | ||
set(FONTDIR "/usr/local/share/fonts") | ||
else() | ||
set(FONTDIR "/usr/share/fonts") | ||
endif() | ||
file(GLOB_RECURSE fonts ${FONTDIR}/*.ttf) | ||
list(GET fonts 0 font) | ||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/fontConf ${font}) | ||
endif() | ||
else() | ||
message(WARNING "SFML 2.4 or newer not found - pmpong won't be build") | ||
endif() | ||
|
||
if(CURSES_FOUND) | ||
add_example(panaconda panaconda/panaconda.cpp) | ||
target_include_directories(example-panaconda PUBLIC ${CURSES_INCLUDE_DIR}) | ||
target_link_libraries(example-panaconda ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CURSES_LIBRARIES}) | ||
else() | ||
message(WARNING "ncurses not found - panaconda won't be build") | ||
endif() | ||
|
||
add_example(map_cli map_cli/map_cli.cpp) | ||
target_link_libraries(example-map_cli ${PMEMOBJ_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
#XXX : fix compile error on clang | ||
#add_library(doc_snippets_persistent OBJECT doc_snippets/persistent.cpp) | ||
add_library(doc_snippets_make_persistent OBJECT doc_snippets/make_persistent.cpp) | ||
add_library(doc_snippets_mutex OBJECT doc_snippets/mutex.cpp) | ||
add_library(doc_snippets_pool OBJECT doc_snippets/pool.cpp) | ||
add_library(doc_snippets_transaction OBJECT doc_snippets/transaction.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,7 @@ | ||
Persistent Memory Development Kit | ||
|
||
This is examples/libpmemobj++/README. | ||
|
||
This directory contains examples for libpmemobj++, the library providing | ||
This directory contains examples for libpmemobj-cpp, the library providing | ||
a transactional object store for pmem. Some of these examples are explained | ||
in more detail here: http://pmem.io/pmdk/cpp_obj/ | ||
|
||
To build these examples: | ||
make | ||
|
||
These examples can be built against an installed system using: | ||
make LIBDIR=/usr/lib INCDIR=/usr/include | ||
|
||
If you're looking for documentation to get you started using PMDK, | ||
start here: http://pmem.io/pmdk and follow the links to examples and | ||
man pages. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.