Skip to content

Commit

Permalink
Re-organize file with cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
feifeibear committed Jul 12, 2022
2 parents 2b2076a + 3c2de63 commit 102e656
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 18 deletions.
2 changes: 2 additions & 0 deletions 3rd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include(ExternalProject)
ExternalProject_Add(extern_uring
GIT_REPOSITORY https://github.com/axboe/liburing.git
GIT_TAG liburing-2.2
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/liburing
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/liburing
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/liburing
Expand All @@ -16,6 +17,7 @@ add_dependencies(uring extern_uring)

ExternalProject_Add(extern_aio
GIT_REPOSITORY https://pagure.io/libaio.git
GIT_TAG libaio-0.3.113
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/libaio
SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/libaio
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/libaio
Expand Down
27 changes: 10 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
cmake_minimum_required(VERSION 3.16)
project(nvme)
project(
ColossalAI-NVME
VERSION 0.1
DESCRIPTION "ColossalAI NVME"
LANGUAGES CXX
)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)

add_subdirectory(3rd)
include_directories(csrc/include)
include_directories(tests)
add_subdirectory(csrc)

add_library(colo_asyncio
OBJECT
csrc/uring.cpp
csrc/aio.cpp)
target_link_libraries(colo_asyncio PUBLIC uring aio)



add_executable(test_asyncio
tests/test_asyncio.cpp)
target_link_libraries(test_asyncio colo_asyncio)

add_executable(test_space_mgr tests/test_space_mgr.cpp
csrc/space_mgr.cpp)
#if((CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR MODERN_CMAKE_BUILD_TESTING) AND BUILD_TESTING)
add_subdirectory(tests)
#endif()
14 changes: 14 additions & 0 deletions csrc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_library(colo_asyncio
OBJECT
aio.cpp
uring.cpp)
target_link_libraries(colo_asyncio
PUBLIC uring
PUBLIC aio)
target_include_directories(colo_asyncio PUBLIC ../include)


add_library(space_mgr
OBJECT
space_mgr.cpp)
target_include_directories(space_mgr PUBLIC ../include)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def cpp_ext_helper(name, sources, **kwargs):
return CppExtension(
name,
[os.path.join(this_dir, path) for path in sources],
include_dirs=[os.path.join(this_dir, 'csrc'), os.path.join(this_dir, 'csrc/include')],
include_dirs=[os.path.join(this_dir, 'csrc'), os.path.join(this_dir, 'include')],
**kwargs
)

Expand Down
12 changes: 12 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
add_executable(test_asyncio
test_asyncio.cpp)
target_link_libraries(test_asyncio colo_asyncio)
target_include_directories(test_asyncio INTERFACE .)
add_test(NAME test_asyncio COMMAND test_asyncio)


add_executable(test_space_mgr
test_space_mgr.cpp)
target_link_libraries(test_space_mgr space_mgr)
target_include_directories(test_space_mgr INTERFACE .)
add_test(NAME test_space_mgr COMMAND test_space_mgr)

0 comments on commit 102e656

Please sign in to comment.