From e0279e305bc274d998c541bc9059811cab2bbdd9 Mon Sep 17 00:00:00 2001 From: Artur Wrona Date: Sat, 7 Jan 2023 17:21:48 +0100 Subject: [PATCH] Implement install STK --- CMakeLists.txt | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e83ceb..062e257 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ option(ENABLE_DS "Enable DirectSound API support (windows only)" ON) option(ENABLE_WASAPI "Enable Windows Audio Session API support (windows only)" OFF) # option(ENABLE_CORE "Enable CoreAudio API support (mac only)" ON) option(COMPILE_PROJECTS "Compile all the example projects" ON) +option(INSTALL_HEADERS "Install headers" ON) include_directories("./include") file(GLOB STK_SRC "./src/*.cpp") # GLOB instead of GLOB_RECURSE as the asio depends on system @@ -114,16 +115,26 @@ if(NOT IS_BIG_ENDIAN) add_definitions(-D__LITTLE_ENDIAN__) endif() +if(INSTALL_HEADERS) + file(GLOB STK_HEADERS "include/*.h") + install(FILES ${STK_HEADERS} DESTINATION include/stk) +endif() #========================================# #========== Build the Library ===========# #========================================# if(BUILD_STATIC) add_library(stk STATIC ${STK_SRC} ) + target_include_directories(stk PRIVATE include PUBLIC $) + set_target_properties(stk PROPERTIES PUBLIC_HEADER "${LIBSTK_HEADERS}") + list(APPEND STK_TARGETS stk) endif() if(BUILD_SHARED) add_library(stk_SHARED SHARED ${STK_SRC}) set_target_properties(stk_SHARED PROPERTIES OUTPUT_NAME stk) # rename the shared library name + target_include_directories(stk_SHARED PRIVATE include PUBLIC $) + set_target_properties(stk_SHARED PROPERTIES PUBLIC_HEADER "${LIBSTK_HEADERS}") + list(APPEND STK_TARGETS stk_SHARED) endif() #========================================# @@ -136,4 +147,16 @@ if(COMPILE_PROJECTS) add_subdirectory(projects/demo) add_subdirectory(projects/effects) add_subdirectory(projects/ragamatic) -endif() \ No newline at end of file +endif() + +#========================================# +#========= Install ======================# +#========================================# + +install(TARGETS ${STK_TARGETS} EXPORT stk-config + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include/stk) + +install(EXPORT stk-config DESTINATION lib/cmake/stk)