Commit 667a5344 authored by NzSN's avatar NzSN

Update CMakeLists.txt to enable install feature.

parent eef0a7d6
......@@ -10,6 +10,12 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(ROOT .)
set(INCLUDE ${ROOT}/src ${ROOT}/lib/include)
option(enable_trmem "Enable/Disable TransientMemProto" ON)
option(enable_movmem "Enable/Disable MovMemProto" ON)
option(DEBUG "Only enable during development" OFF)
if(DEBUG)
# Google Test
include(FetchContent)
FetchContent_Declare(
......@@ -33,24 +39,44 @@ ExternalProject_Add(
INSTALL_COMMAND make install
UPDATE_COMMAND ""
)
endif()
set(SRC ${ROOT}/src)
set(CMAKE_CXX_STANDARD 20)
# Basics
set(SRC_Files
${SRC}/ioctx.cc
${SRC}/utils.cc
${SRC}/proto/proto.cc
${SRC}/proto/sharedMemProto.cc
${SRC}/proto/transientMemProto.cc
${SRC}/proto/movMemProto.cc)
add_library(smp ${SRC_Files})
${SRC}/proto/proto.cc)
# Optional Modules
if(enable_trmem)
set(SRC_Files ${SRC_Files}
${SRC}/proto/transientMemProto.cc)
endif()
if (enable_movmem)
set(SRC_Files ${SRC_Files}
${SRC}/proto/movMemProto.cc)
endif()
# Library
add_library(shmproto ${SRC_Files})
install(TARGETS shmproto
DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${ROOT}/src/proto/proto.h
${ROOT}/src/utils.h
${ROOT}/src/proto/proto.h
${ROOT}/src/proto/movMemProto.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# Tests
set(Tests ${ROOT}/tests)
set(TestCases
${Tests}/ioctxTestCases.cc)
add_executable(unittest ${TestCases} ${SRC_Files})
add_dependencies(unittest libav)
include_directories(${INCLUDE})
add_custom_command(TARGET unittest PRE_BUILD
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment