Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomlneto committed Nov 5, 2018
1 parent 7339909 commit a9df87d
Show file tree
Hide file tree
Showing 11 changed files with 652 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,75 @@
#######################################
# CMake #
#######################################
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake

#######################################
# C #
#######################################
# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

#######################################
# C++ #
#######################################
# Prerequisites
*.d

Expand Down Expand Up @@ -30,3 +102,18 @@
*.exe
*.out
*.app

#######################################
# procmap specific #
#######################################

# user-generated CMake scripts
DartConfiguration.tcl
cmake_uninstall.cmake

# generated libraries
/libprocmap.so

# generated executables
/simple

53 changes: 53 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
language: cpp
sudo: true

matrix:
include:
- name: "gcc 8"
env: MATRIX_ENV="CC=gcc-8 CXX=g++-8"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libnuma-dev
- g++-8
- name: "gcc 7"
env: MATRIX_ENV="CC=gcc-7 CXX=g++-7"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libnuma-dev
- g++-7
- name: "gcc 6"
env: MATRIX_ENV="CC=gcc-6 CXX=g++-6"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- libnuma-dev
- g++-6
- name: "clang 6"
env: MATRIX_ENV="CC=clang-6.0 CXX=clang++-6.0"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-6.0
packages:
- libnuma-dev
- libstdc++-8-dev
- clang-6.0

env:
global:
- MAKEFLAGS="-j 2" # parallelize compilation process

before_install: eval "${MATRIX_ENV}"

script:
- cmake . -DCMAKE_BUILD_TYPE=Debug
- make all
50 changes: 50 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.5)
project(unstickymem VERSION 1.0 LANGUAGES CXX C)

include(GNUInstallDirs)
include(CTest)

set(CMAKE_VERBOSE_MAKEFILE OFF)

# get list of source files
file(GLOB_RECURSE procmap_src relative ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp" "src/*c")
add_library(procmap SHARED ${procmap_src})

set_property(TARGET procmap PROPERTY POSITION_INDEPENDENT_CODE on)

target_compile_features(procmap PRIVATE cxx_std_14)

target_compile_options(procmap PRIVATE -g -Wall -pedantic -Wshadow -Wfatal-errors)

target_include_directories(procmap
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<INSTALL_INTERFACE:include>
PRIVATE src)

# 'make install' to the correct locations (provided by GNUInstallDirs)
install(TARGETS procmap
EXPORT procmap_config
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

# This makes the project importable from the install directory
# Put config file in per-project dir (name MUST match), can also
# just go into 'cmake'
install(EXPORT procmap_config DESTINATION share/procmap/cmake)

# uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()


# tests/examples
add_executable(simple test/simple.cpp)
target_link_libraries(simple procmap)
add_test(simple simple)
21 changes: 21 additions & 0 deletions cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")

file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
exec_program(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if(NOT "${rm_retval}" STREQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif(NOT "${rm_retval}" STREQUAL 0)
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)
Loading

0 comments on commit a9df87d

Please sign in to comment.