Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [do-not-merge] Python compatability #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "externals/moderngpu"]
path = externals/moderngpu
url = https://github.com/moderngpu/moderngpu.git
[submodule "externals/rapidjson"]
path = externals/rapidjson
url = https://github.com/Tencent/rapidjson.git
61 changes: 40 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@ set(PROJECT_DEPS_DIR externals)
# end /* Dependencies directory */

# begin /* Include cmake modules */
include(${PROJECT_SOURCE_DIR}/cmake/FetchRapidJSON.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/FetchThrustCUB.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/FetchModernGPU.cmake)
# <<
# include(${PROJECT_SOURCE_DIR}/cmake/FetchRapidJSON.cmake)
# include(${PROJECT_SOURCE_DIR}/cmake/FetchThrustCUB.cmake)
# include(${PROJECT_SOURCE_DIR}/cmake/FetchModernGPU.cmake)
# --
include(${PROJECT_SOURCE_DIR}/cmake/FindRapidJSON.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/FindModernGPU.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/FindMTX.cmake)
# >>

# end /* Include cmake modules */

## Set the directory where the binaries will be stored
Expand Down Expand Up @@ -85,14 +92,26 @@ target_compile_features(essentials INTERFACE cxx_std_17)
####################################################
############ TARGET INCLUDE DIRECTORIES ############
####################################################

# <<
# target_include_directories(essentials
# INTERFACE include
# INTERFACE ${THRUST_INCLUDE_DIR}
# INTERFACE ${CUB_INCLUDE_DIR}
# INTERFACE ${MODERNGPU_INCLUDE_DIR}
# INTERFACE ${RAPIDJSON_INCLUDE_DIR}
# INTERFACE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
# )
# --
target_include_directories(essentials
INTERFACE include
INTERFACE ${THRUST_INCLUDE_DIR}
INTERFACE ${CUB_INCLUDE_DIR}
INTERFACE ${MODERNGPU_INCLUDE_DIR}
INTERFACE ${RAPIDJSON_INCLUDE_DIR}
INTERFACE externals/
INTERFACE externals/mtx
INTERFACE externals/moderngpu/src
INTERFACE externals/rapidjson/include
INTERFACE ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES}
)
# >>

####################################################
############ TARGET LINK LIBRARIES #################
Expand Down Expand Up @@ -138,23 +157,23 @@ target_compile_options(essentials INTERFACE
####################################################
############ BUILD EXAMPLE APPLICATIONS ############
####################################################
option(ESSENTIALS_BUILD_EXAMPLES
"If on, builds the example graph applications."
ON)
# option(ESSENTIALS_BUILD_EXAMPLES
# "If on, builds the example graph applications."
# ON)

# Subdirectories for examples, testing and documentation
if(ESSENTIALS_BUILD_EXAMPLES)
add_subdirectory(examples)
endif(ESSENTIALS_BUILD_EXAMPLES)
# # Subdirectories for examples, testing and documentation
# if(ESSENTIALS_BUILD_EXAMPLES)
# add_subdirectory(examples)
# endif(ESSENTIALS_BUILD_EXAMPLES)

####################################################
################ BUILD UNIT TESTS #################
####################################################
option(ESSENTIALS_BUILD_TESTS
"If on, builds the unit tests."
OFF)
# option(ESSENTIALS_BUILD_TESTS
# "If on, builds the unit tests."
# OFF)

# Subdirectories for examples, testing and documentation
if(ESSENTIALS_BUILD_TESTS)
add_subdirectory(unittests)
endif(ESSENTIALS_BUILD_TESTS)
# # Subdirectories for examples, testing and documentation
# if(ESSENTIALS_BUILD_TESTS)
# add_subdirectory(unittests)
# endif(ESSENTIALS_BUILD_TESTS)
28 changes: 28 additions & 0 deletions cmake/FindMTX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# ------------------------------------------------------------------------
# Find external mtx directories
# ------------------------------------------------------------------------
SET(MTX_INCLUDEDIR
${PROJECT_SOURCE_DIR}/externals/mtx
CACHE PATH
"Directory to the MTX include files")

SET(MTX_SOURCE_DIR
${PROJECT_SOURCE_DIR}/externals/mtx
CACHE PATH
"Directory to the MTX source files")

find_path(
MTX_INCLUDEDIR
NAMES mmio.hxx
PATHS ${MTX_INCLUDE_DIR}
DOC "Include directory for the mtx library."
)

mark_as_advanced(MTX_INCLUDE_DIR)

if(MTX_INCLUDE_DIR)
set(MTX_FOUND TRUE)
endif()

mark_as_advanced(MTX_FOUND)
27 changes: 27 additions & 0 deletions cmake/FindModernGPU.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ------------------------------------------------------------------------
# Find external moderngpu directories
# ------------------------------------------------------------------------
SET(MODERNGPU_INCLUDEDIR
${PROJECT_SOURCE_DIR}/externals/moderngpu/src
CACHE PATH
"Directory to the Modern GPU include files")

SET(MODERNGPU_SOURCE_DIR
${PROJECT_SOURCE_DIR}/externals/moderngpu/src/moderngpu
CACHE PATH
"Directory to the Modern GPU source files")

find_path(
MODERNGPU_INCLUDEDIR
NAMES moderngpu/context.hxx
PATHS ${MODERNGPU_INCLUDE_DIR}
DOC "Include directory for the moderngpu library."
)

mark_as_advanced(MODERNGPU_INCLUDE_DIR)

if(MODERNGPU_INCLUDE_DIR)
set(MODERNGPU_FOUND TRUE)
endif()

mark_as_advanced(MODERNGPU_FOUND)
102 changes: 102 additions & 0 deletions cmake/FindRapidJSON.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Copyright (c) 2011 Milo Yip (miloyip@gmail.com)
# Copyright (c) 2013 Rafal Jeczalik (rjeczalik@gmail.com)
# Distributed under the MIT License (see license.txt file)

# -----------------------------------------------------------------------------------
#
# Finds the rapidjson library
#
# -----------------------------------------------------------------------------------
#
# Variables used by this module, they can change the default behaviour.
# Those variables need to be either set before calling find_package
# or exported as environment variables before running CMake:
#
# RAPIDJSON_INCLUDEDIR - Set custom include path, useful when rapidjson headers are
# outside system paths
# RAPIDJSON_USE_SSE2 - Configure rapidjson to take advantage of SSE2 capabilities
# RAPIDJSON_USE_SSE42 - Configure rapidjson to take advantage of SSE4.2 capabilities
#
# -----------------------------------------------------------------------------------
#
# Variables defined by this module:
#
# RAPIDJSON_FOUND - True if rapidjson was found
# RAPIDJSON_INCLUDE_DIRS - Path to rapidjson include directory
# RAPIDJSON_CXX_FLAGS - Extra C++ flags required for compilation with rapidjson
#
# -----------------------------------------------------------------------------------
#
# Example usage:
#
# set(RAPIDJSON_USE_SSE2 ON)
# set(RAPIDJSON_INCLUDEDIR "/opt/github.com/rjeczalik/rapidjson/include")
#
# find_package(rapidjson REQUIRED)
#
# include_directories("${RAPIDJSON_INCLUDE_DIRS}")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RAPIDJSON_CXX_FLAGS}")
# add_executable(foo foo.cc)
#
# -----------------------------------------------------------------------------------

SET(RAPIDJSON_INCLUDEDIR
${PROJECT_SOURCE_DIR}/externals/rapidjson/include
CACHE PATH
"Directory to the RapidJson include files")

foreach(opt RAPIDJSON_INCLUDEDIR RAPIDJSON_USE_SSE2 RAPIDJSON_USE_SSE42)
if(${opt} AND DEFINED ENV{${opt}} AND NOT ${opt} STREQUAL "$ENV{${opt}}")
message(WARNING "Conflicting ${opt} values: ignoring environment variable and using CMake cache entry.")
elseif(DEFINED ENV{${opt}} AND NOT ${opt})
set(${opt} "$ENV{${opt}}")
endif()
endforeach()

find_path(
RAPIDJSON_INCLUDE_DIRS
NAMES rapidjson/rapidjson.h
PATHS ${RAPIDJSON_INCLUDEDIR}
DOC "Include directory for the rapidjson library."
)

mark_as_advanced(RAPIDJSON_INCLUDE_DIRS)

if(RAPIDJSON_INCLUDE_DIRS)
set(RAPIDJSON_FOUND TRUE)
endif()

mark_as_advanced(RAPIDJSON_FOUND)

if(RAPIDJSON_USE_SSE42)
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE42")
if(MSVC)
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE4.2")
else()
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse4.2")
endif()
else()
if(RAPIDJSON_USE_SSE2)
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE2")
if(MSVC)
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE2")
else()
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse2")
endif()
endif()
endif()

mark_as_advanced(RAPIDJSON_CXX_FLAGS)

if(RAPIDJSON_FOUND)
if(NOT rapidjson_FIND_QUIETLY)
message(STATUS "Found rapidjson header files in ${RAPIDJSON_INCLUDE_DIRS}")
if(DEFINED RAPIDJSON_CXX_FLAGS)
message(STATUS "Found rapidjson C++ extra compilation flags: ${RAPIDJSON_CXX_FLAGS}")
endif()
endif()
elseif(rapidjson_FIND_REQUIRED)
message(FATAL_ERROR "Could not find rapidjson")
else()
message(STATUS "Optional package rapidjson was not found")
endif()
1 change: 1 addition & 0 deletions externals/moderngpu
Submodule moderngpu added at 2b3985
1 change: 1 addition & 0 deletions externals/rapidjson
Submodule rapidjson added at 17aa82