Skip to content

Commit

Permalink
Merge branch 'initial-implementation'
Browse files Browse the repository at this point in the history
  • Loading branch information
MortenSchou committed Feb 17, 2020
2 parents ef70c24 + eb18881 commit 6437b24
Show file tree
Hide file tree
Showing 17 changed files with 3,034 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,25 @@
*.exe
*.out
*.app

# CMake
CMakeCache.txt
CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt
CTestTestfile.cmake
*.cbp

#CTest
Testing/

#CLion
.idea
/cmake-build-debug/
/cmake-build-release/

#vim
*.swp
/build/
63 changes: 63 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
cmake_minimum_required(VERSION 3.7)

cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0069 NEW)

set(CMAKE_CXX_STANDARD 17)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif (NOT CMAKE_BUILD_TYPE)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
project(pdaaal VERSION 1.0.0 LANGUAGES CXX)


option(PDAAAL_BuildTests "Build the unit tests when BUILD_TESTING is enabled." ON)
option(PDAAAL_AddressSanitizer "Enables address sanitization during compilation." OFF)
option(PDAAAL_GetDependencies "Fetch external dependencies from web." ON)


set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wpedantic -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG -Wall -Wpedantic -fPIC")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if(PDAAAL_AddressSanitizer)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-omit-frame-pointer -fsanitize=address")
endif(PDAAAL_AddressSanitizer)

if (PDAAAL_GetDependencies)
# setup for external imports
include(ExternalProject)
set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)

ExternalProject_add(ptrie-ext
URL https://github.com/petergjoel/ptrie/archive/v1.1.0.zip
URL_HASH SHA512=092a8f50ca21d1199b19a10c4e0273c93a717a9f6491998a16bf21d21d37e6537ffd8a06ac41a2b623241da6036546d44b754567441944565e2a16646378cf29
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release
)
file(MAKE_DIRECTORY ${EXTERNAL_INSTALL_LOCATION}/include)

# we can now include external libraries
include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
link_directories(${EXTERNAL_INSTALL_LOCATION}/lib)

endif (PDAAAL_GetDependencies)


#actual library
add_subdirectory(src)

set(BUILD_TESTING ON)

if(BUILD_TESTING AND PDAAAL_BuildTests)
#benchmark
add_subdirectory(benchmark)

#testing
add_subdirectory(test)
enable_testing()
add_test(NAME Test1 COMMAND Test1)
endif()
10 changes: 10 additions & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
project(benchmark)

include_directories(${libpdaaal_SOURCE_DIR})

#add_library(murmur MurmurHash2.h MurmurHash2.cpp)
#add_executable(benchmark benchmark.cpp utils.h binarywrapper.cpp)
#add_executable(int_benchmark int_benchmark.cpp utils.h binarywrapper.cpp)

#target_link_libraries(int_benchmark LINK_PUBLIC ptrie murmur tbb jemalloc)
#target_link_libraries(benchmark LINK_PUBLIC ptrie murmur tbb jemalloc)
15 changes: 15 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.7)
project(PDAAAL C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

add_library(pdaaal pdaaal/PDA.h pdaaal/PDA.cpp pdaaal/PAutomaton.h pdaaal/PAutomaton.cpp ${HEADER_FILES})
add_dependencies(pdaaal ptrie-ext)
target_include_directories (pdaaal PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

install(TARGETS pdaaal
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install (FILES pdaaal/NFA.h pdaaal/PDA.h pdaaal/PDAFactory.h pdaaal/SimplePDAFactory.h pdaaal/TypedPDA.h pdaaal/PAutomaton.h pdaaal/Solver.h DESTINATION include/pdaaal)

Loading

0 comments on commit 6437b24

Please sign in to comment.