cmake: Initial work towards component-ification

The old fake component system is starting to be very annoying to work with, as it doesn't properly split things apart. The new system should aid with this significantly, and make errors easier to spot.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2023-09-03 12:09:33 +02:00 committed by Xaymar
parent e82823d49c
commit 50c85608c3

View file

@ -425,8 +425,10 @@ if(D_PLATFORM_MAC)
) )
endif() endif()
set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "User-Interface Files/Generated")
################################################################################ ################################################################################
# Components # Components (Old System)
################################################################################ ################################################################################
# Component resolving: # Component resolving:
@ -1608,83 +1610,54 @@ if((CMAKE_C_COMPILER_ID STREQUAL "GNU")
endif() endif()
################################################################################ ################################################################################
# Register Library # Helpers
################################################################################ ################################################################################
define_property(TARGET PROPERTY COMPONENT_LABEL)
define_property(TARGET PROPERTY COMPONENT_NAME)
define_property(TARGET PROPERTY COMPONENT_OPTION)
define_property(TARGET PROPERTY COMPONENT_DEPENDS)
# Combine all variables that matter. function(streamfx_add_library TARGET_NAME TARGET_TYPE)
set(PROJECT_FILES add_library(${TARGET_NAME} ${TARGET_TYPE})
# Always exist
${PROJECT_DATA}
${PROJECT_PRIVATE_GENERATED}
${PROJECT_PRIVATE_SOURCE}
${PROJECT_TEMPLATES}
# UI-only (empty if not enabled)
${PROJECT_UI}
${PROJECT_UI_SOURCE}
# Media
${PROJECT_MEDIA}
)
# Set source groups for IDE generators.
source_group(TREE "${PROJECT_SOURCE_DIR}/data" PREFIX "Data" FILES ${PROJECT_DATA})
source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Source" FILES ${PROJECT_PRIVATE_SOURCE} ${PROJECT_UI_SOURCE})
source_group(TREE "${PROJECT_BINARY_DIR}/generated" PREFIX "Source" FILES ${PROJECT_PRIVATE_GENERATED})
source_group(TREE "${PROJECT_SOURCE_DIR}/templates" PREFIX "Templates" FILES ${PROJECT_TEMPLATES})
source_group(TREE "${PROJECT_SOURCE_DIR}/ui" PREFIX "User Interface" FILES ${PROJECT_UI})
source_group(TREE "${PROJECT_SOURCE_DIR}/media" PREFIX "Media" FILES ${PROJECT_MEDIA})
# Prevent unwanted files from being built as source.
set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_UI} ${PROJECT_MEDIA} PROPERTIES
HEADER_FILE_ONLY ON
)
# Prevent non-UI files from being Qt'd
if(Qt5_Found OR Qt6_FOUND)
set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_MEDIA} ${PROJECT_PRIVATE_GENERATED} ${PROJECT_PRIVATE_SOURCE} PROPERTIES
SKIP_AUTOGEN ON
SKIP_AUTOMOC ON
SKIP_AUTORCC ON
SKIP_AUTOUIC ON
)
endif()
# Register the library
add_library(${PROJECT_NAME} MODULE ${PROJECT_FILES}) # We are a module for libOBS.
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_LIBRARIES})
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE_DIRS})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${PROJECT_DEFINITIONS})
set_target_properties(${TARGET_NAME} PROPERTIES
# Always generate position independent code. # Always generate position independent code.
set_target_properties(${PROJECT_NAME} PROPERTIES
POSITION_INDEPENDENT_CODE ON POSITION_INDEPENDENT_CODE ON
)
# Set C++ Standard and Extensions # Set C++ Standard and Extensions
set_target_properties(${PROJECT_NAME} PROPERTIES
C_STANDARD 17 C_STANDARD 17
C_STANDARD_REQUIRED ON C_STANDARD_REQUIRED ON
CXX_STANDARD 17 CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
)
target_compile_definitions(${PROJECT_NAME} PRIVATE
__STDC_WANT_LIB_EXT1__=1
)
# Link-Time/Interprocedural Optimization # Remove prefix from generated files.
if(${PREFIX}ENABLE_LTO) PREFIX ""
set_target_properties(${PROJECT_NAME} PROPERTIES IMPORT_PREFIX ""
INTERPROCEDURAL_OPTIMIZATION ON )
if(D_PLATFORM_MAC)
set_target_properties(${TARGET_NAME} PROPERTIES
# @rpath in installed binaries
INSTALL_RPATH "@executable_path/../Frameworks/;@loader_path/../Frameworks/;@loader_path/../Resources/"
)
if(STANDALONE)
set_target_properties(${TARGET_NAME} PROPERTIES
# @rpath in built binaries
BUILD_WITH_INSTALL_RPATH ON
) )
endif() endif()
endif()
target_compile_definitions(${TARGET_NAME} PRIVATE
__STDC_WANT_LIB_EXT1__=1
)
# C/C++ Compiler Adjustments # C/C++ Compiler Adjustments
if(D_PLATFORM_WINDOWS AND ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))) if(D_PLATFORM_WINDOWS AND ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")))
# MSVC/ClangCL # MSVC/ClangCL
message(STATUS "Applying custom flags for MSVC style build.")
# - Dynamically link Microsoft C/C++ Redistributable. # - Dynamically link Microsoft C/C++ Redistributable.
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
$<$<CONFIG:>:/MD> $<$<CONFIG:>:/MD>
$<$<CONFIG:Debug>:/MDd> $<$<CONFIG:Debug>:/MDd>
$<$<CONFIG:Release>:/MD> $<$<CONFIG:Release>:/MD>
@ -1693,9 +1666,10 @@ if(D_PLATFORM_WINDOWS AND ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX
) )
# - Treat Warnings as Errors # - Treat Warnings as Errors
target_compile_options(${PROJECT_NAME} PRIVATE "/Wall") target_compile_options(${TARGET_NAME} PRIVATE "/Wall")
# - Explicitly disable treating all Warnings as Errors # - Explicitly disable treating all Warnings as Errors
target_compile_options(${PROJECT_NAME} PRIVATE "/WX-") target_compile_options(${TARGET_NAME} PRIVATE "/WX-")
# - Disable useless warnings # - Disable useless warnings
set(DISABLED_WARNINGS set(DISABLED_WARNINGS
@ -1734,72 +1708,52 @@ if(D_PLATFORM_WINDOWS AND ((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX
"4324" "4324"
) )
foreach(WARN ${DISABLED_WARNINGS}) foreach(WARN ${DISABLED_WARNINGS})
target_compile_options(${PROJECT_NAME} PRIVATE "/wd${WARN}") target_compile_options(${TARGET_NAME} PRIVATE "/wd${WARN}")
endforeach() endforeach()
# - Require enabled instruction sets. # - Require enabled instruction sets.
if(D_PLATFORM_ARCH_X86) if(D_PLATFORM_ARCH_X86)
if(${PREFIX}TARGET_X86_64_V4) if(${PREFIX}TARGET_X86_64_V4)
target_compile_options(${PROJECT_NAME} PRIVATE "/arch:AVX512") target_compile_options(${TARGET_NAME} PRIVATE "/arch:AVX512")
message(STATUS "Targeting x86-64-v4.")
elseif(${PREFIX}TARGET_X86_64_V3) elseif(${PREFIX}TARGET_X86_64_V3)
target_compile_options(${PROJECT_NAME} PRIVATE "/arch:AVX2") target_compile_options(${TARGET_NAME} PRIVATE "/arch:AVX2")
message(STATUS "Targeting x86-64-v3.")
elseif(${PREFIX}TARGET_X86_64_V2_EX) elseif(${PREFIX}TARGET_X86_64_V2_EX)
target_compile_options(${PROJECT_NAME} PRIVATE "/arch:AVX") target_compile_options(${TARGET_NAME} PRIVATE "/arch:AVX")
message(STATUS "Targeting extended x86-64-v2.")
elseif(${PREFIX}TARGET_X86_64_V2) elseif(${PREFIX}TARGET_X86_64_V2)
target_compile_options(${PROJECT_NAME} PRIVATE "/d2archSSE42") target_compile_options(${TARGET_NAME} PRIVATE "/d2archSSE42")
message(STATUS "Targeting x86-64-v2.")
elseif(${PREFIX}TARGET_X86_64) elseif(${PREFIX}TARGET_X86_64)
#target_compile_options(${PROJECT_NAME} PRIVATE "/arch:SSE2") #target_compile_options(${TARGET_NAME} PRIVATE "/arch:SSE2")
message(STATUS "Targeting x86-64.")
endif() endif()
endif() endif()
# - Use fast unordered math if possible. # - Use fast unordered math if possible.
if(${PREFIX}ENABLE_FASTMATH) if(${PREFIX}ENABLE_FASTMATH)
target_compile_options(${PROJECT_NAME} PRIVATE "/fp:fast") target_compile_options(${TARGET_NAME} PRIVATE "/fp:fast")
else() else()
target_compile_options(${PROJECT_NAME} PRIVATE "/fp:precise") target_compile_options(${TARGET_NAME} PRIVATE "/fp:precise")
if(MSVC_VERSION GREATER 1930) if(MSVC_VERSION GREATER 1930)
# Keep original behavior in VS2022 and up. # Keep original behavior in VS2022 and up.
target_compile_options(${PROJECT_NAME} PRIVATE "/fp:contract") target_compile_options(${TARGET_NAME} PRIVATE "/fp:contract")
endif() endif()
endif() endif()
# - Disable incremental builds # - Disable incremental builds
target_compile_options(${PROJECT_NAME} PRIVATE "/INCREMENTAL:NO") target_compile_options(${TARGET_NAME} PRIVATE "/INCREMENTAL:NO")
# - Enable C++ exceptions with SEH exceptions. # - Enable C++ exceptions with SEH exceptions.
target_compile_options(${PROJECT_NAME} PRIVATE "/EHa") target_compile_options(${TARGET_NAME} PRIVATE "/EHa")
# - Enable multi-processor compiling. # - Enable multi-processor compiling.
target_compile_options(${PROJECT_NAME} PRIVATE "/MP") target_compile_options(${TARGET_NAME} PRIVATE "/MP")
# - Enable updated __cplusplus macro # - Enable updated __cplusplus macro
target_compile_options(${PROJECT_NAME} PRIVATE "/Zc:__cplusplus") target_compile_options(${TARGET_NAME} PRIVATE "/Zc:__cplusplus")
# - Generic Optimizations for Release/RelWithDebInfo/MinSizeRel
set(FLAGS
"/OPT:REF"
"/OPT:ICF=3"
"/GL"
"/Gy"
"/GF"
"/Ox"
"/Ob3"
)
foreach(FLAG ${FLAGS})
target_compile_options(${PROJECT_NAME} PRIVATE "$<$<CONFIG:Release,RelWithDebInfo,MinSizeRel>:${FLAG}>")
endforeach()
elseif(D_PLATFORM_LINUX AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))) elseif(D_PLATFORM_LINUX AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")))
# GCC/Clang # GCC/Clang
message(STATUS "Applying custom flags for GCC/Clang style build.")
# - Enable all warnings. # - Enable all warnings.
target_compile_options(${PROJECT_NAME} PRIVATE "-Wall") target_compile_options(${TARGET_NAME} PRIVATE "-Wall")
target_compile_options(${PROJECT_NAME} PRIVATE "-Wextra") target_compile_options(${TARGET_NAME} PRIVATE "-Wextra")
# - Disable useless warnings # - Disable useless warnings
set(DISABLED_WARNINGS set(DISABLED_WARNINGS
@ -1826,28 +1780,25 @@ elseif(D_PLATFORM_LINUX AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_
"unused-macros" "unused-macros"
) )
foreach(WARN ${DISABLED_WARNINGS}) foreach(WARN ${DISABLED_WARNINGS})
target_compile_options(${PROJECT_NAME} PRIVATE "-Wno-${WARN}") target_compile_options(${TARGET_NAME} PRIVATE "-Wno-${WARN}")
endforeach() endforeach()
# - Require enabled instruction sets. # - Require enabled instruction sets.
if(${PREFIX}TARGET_NATIVE) if(${PREFIX}TARGET_NATIVE)
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-march=native" "-march=native"
) )
message(WARNING "Targeting native architecture. Binaries will not be distributable to other systems!")
elseif(D_PLATFORM_ARCH_X86) elseif(D_PLATFORM_ARCH_X86)
if(${PREFIX}TARGET_X86_64_V4) if(${PREFIX}TARGET_X86_64_V4)
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v4" "-march=x86-64-v4"
) )
message(STATUS "Targeting x86-64-v4.")
elseif(${PREFIX}TARGET_X86_64_V3) elseif(${PREFIX}TARGET_X86_64_V3)
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v3" "-march=x86-64-v3"
) )
message(STATUS "Targeting x86-64-v3.")
elseif(${PREFIX}TARGET_X86_64_V2_EX) elseif(${PREFIX}TARGET_X86_64_V2_EX)
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v2" "-march=x86-64-v2"
"-mavx" "-mavx"
"-mbmi2" "-mbmi2"
@ -1858,24 +1809,21 @@ elseif(D_PLATFORM_LINUX AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_
"-mpclmul" "-mpclmul"
"-mpopcnt" "-mpopcnt"
) )
message(STATUS "Targeting extended x86-64-v2.")
elseif(${PREFIX}TARGET_X86_64_V2) elseif(${PREFIX}TARGET_X86_64_V2)
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64-v2" "-march=x86-64-v2"
) )
message(STATUS "Targeting x86-64-v2.")
elseif(${PREFIX}TARGET_X86_64) elseif(${PREFIX}TARGET_X86_64)
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-march=x86-64" "-march=x86-64"
) )
message(STATUS "Targeting x86-64.")
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-mtune=generic" "-mtune=generic"
) )
else() else()
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-mtune=x86-64" "-mtune=x86-64"
) )
endif() endif()
@ -1884,16 +1832,16 @@ elseif(D_PLATFORM_LINUX AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_
# - Use fast unordered math if possible. # - Use fast unordered math if possible.
if(${PREFIX}ENABLE_FASTMATH) if(${PREFIX}ENABLE_FASTMATH)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-ffast-math" "-ffast-math"
) )
else() else()
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-ffp-model=fast" "-ffp-model=fast"
) )
endif() endif()
else() else()
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-ffp-model=precise" "-ffp-model=precise"
) )
endif() endif()
@ -1902,15 +1850,14 @@ elseif(D_PLATFORM_LINUX AND ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") OR (CMAKE_
# add_compile_options("-fvisibility=hidden") # add_compile_options("-fvisibility=hidden")
elseif(D_PLATFORM_MAC AND (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")) elseif(D_PLATFORM_MAC AND (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
# AppleClang # AppleClang
message(STATUS "Applying custom flags for AppleClang style build.")
# - Enable most useful warnings. # - Enable most useful warnings.
target_compile_options(${PROJECT_NAME} PRIVATE "-Wall") target_compile_options(${TARGET_NAME} PRIVATE "-Wall")
target_compile_options(${PROJECT_NAME} PRIVATE "-Wextra") target_compile_options(${TARGET_NAME} PRIVATE "-Wextra")
# - Require enabled instruction sets. # - Require enabled instruction sets.
if(${PREFIX}TARGET_NATIVE) if(${PREFIX}TARGET_NATIVE)
target_compile_options(${PROJECT_NAME} PRIVATE target_compile_options(${TARGET_NAME} PRIVATE
"-march=native" "-march=native"
) )
message(WARNING "Targeting native architecture. Binaries will not be distributable to other systems!") message(WARNING "Targeting native architecture. Binaries will not be distributable to other systems!")
@ -1923,12 +1870,128 @@ elseif(D_PLATFORM_MAC AND (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))
# add_compile_options("-fvisibility=hidden") # add_compile_options("-fvisibility=hidden")
endif() endif()
# Remove prefix on other platforms. # Enable Qt if needed
set_target_properties(${PROJECT_NAME} PROPERTIES set_target_properties(${TARGET_NAME} PROPERTIES
PREFIX "" AUTOUIC ON
IMPORT_PREFIX "" AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/ui"
AUTOMOC ON
AUTORCC ON
AUTOGEN_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated"
) )
# Extras: Clang
#is_feature_enabled(CLANG T_CHECK)
#if(T_CHECK)
# generate_compile_commands_json(
# TARGETS ${TARGET_NAME}
# )
# clang_tidy(
# TARGETS ${TARGET_NAME}
# VERSION 14.0.0
# )
# clang_format(
# TARGETS ${TARGET_NAME}
# DEPENDENCY
# VERSION 14.0.0
# )
#endif()
endfunction()
set(${PREFIX}COMPONENTS "")
function(streamfx_add_component COMPONENT_NAME)
# Sanitize the component name by trimming whitespace.
string(REGEX REPLACE "^[ \t]+" "" COMPONENT_NAME "${COMPONENT_NAME}")
string(REGEX REPLACE "[ \t]+$" "" COMPONENT_NAME "${COMPONENT_NAME}")
# Generate a sanitized version of the component name for use in targets and options.
string(REGEX REPLACE "[^a-zA-Z0-9_-]+" "_" COMPONENT_SANITIZED_NAME "${COMPONENT_NAME}")
string(REGEX REPLACE "_[_]+" "_" COMPONENT_SANITIZED_NAME "${COMPONENT_SANITIZED_NAME}")
# Convert the sanitized version to upper case.
string(TOUPPER "${COMPONENT_SANITIZED_NAME}" COMPONENT_OPTION_NAME)
set(COMPONENT_OPTION "${PREFIX}COMPONENT_${COMPONENT_OPTION_NAME}" PARENT_SCOPE)
# Define the necessary targets.
set(COMPONENT_TARGET "${PROJECT_NAME}_${COMPONENT_SANITIZED_NAME}")
set(COMPONENT_TARGET "${PROJECT_NAME}_${COMPONENT_SANITIZED_NAME}" PARENT_SCOPE)
set(COMPONENT_ALIAS "${PROJECT_NAME}::${COMPONENT_SANITIZED_NAME}")
set(COMPONENT_ALIAS "${PROJECT_NAME}::${COMPONENT_SANITIZED_NAME}" PARENT_SCOPE)
streamfx_add_library(${COMPONENT_TARGET} STATIC)
add_library(${COMPONENT_ALIAS} ALIAS ${COMPONENT_TARGET})
set_target_properties(${COMPONENT_TARGET} PROPERTIES
COMPONENT_LABEL "${COMPONENT_LABEL}"
COMPONENT_NAME "${COMPONENT_ALIAS}"
COMPONENT_OPTION "${COMPONENT_OPTION_NAME}"
)
# Register the component globally.
list(APPEND ${PREFIX}COMPONENTS "${COMPONENT_TARGET}")
# Allow disabling this component.
set(${PREFIX}COMPONENT_${COMPONENT_OPTION_NAME} CACHE BOOL "Enable the ${COMPONENT_NAME} component?")
# Add files in common places.
file(GLOB_RECURSE TEMPLATES FOLLOW_SYMLINKS CONFIGURE_DEPENDS "templates/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/templates" PREFIX "Templates" FILES ${TEMPLATES})
file(GLOB_RECURSE SOURCE_PRIVATE FOLLOW_SYMLINKS CONFIGURE_DEPENDS "ui/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/ui" PREFIX "User-Interface Files" FILES ${UI_PRIVATE})
file(GLOB_RECURSE SOURCE_PRIVATE FOLLOW_SYMLINKS CONFIGURE_DEPENDS "source/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/source" PREFIX "Private Files" FILES ${SOURCE_PRIVATE})
file(GLOB_RECURSE GENERATED_PRIVATE FOLLOW_SYMLINKS CONFIGURE_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/source/*")
source_group(TREE "${CMAKE_CURRENT_BINARY_DIR}/source" PREFIX "Private Files/Generated" FILES ${GENERATED_PRIVATE})
file(GLOB_RECURSE SOURCE_PUBLIC FOLLOW_SYMLINKS CONFIGURE_DEPENDS "include/*")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/include" PREFIX "Public Files" FILES ${SOURCE_PUBLIC})
file(GLOB_RECURSE GENERATED_PUBLIC FOLLOW_SYMLINKS CONFIGURE_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/include/*")
source_group(TREE "${CMAKE_CURRENT_BINARY_DIR}/include" PREFIX "Public Files/Generated" FILES ${GENERATED_PUBLIC})
target_sources(${COMPONENT_TARGET}
PRIVATE
${TEMPLATES}
${UI_PRIVATE}
${SOURCE_PRIVATE}
${GENERATED_PRIVATE}
PUBLIC
${SOURCE_PUBLIC}
${GENERATED_PUBLIC}
)
# Ignore data only files.
set_source_files_properties(
${TEMPLATES}
${UI_PRIVATE}
PROPERTIES
HEADER_FILE_ONLY ON
)
set_source_files_properties(
${TEMPLATES}
${SOURCE_PRIVATE}
${GENERATED_PRIVATE}
${SOURCE_PUBLIC}
${GENERATED_PUBLIC}
PROPERTIES
SKIP_AUTOGEN ON
SKIP_AUTOMOC ON
SKIP_AUTORCC ON
SKIP_AUTOUIC ON
)
endfunction()
# Use this to add a dependency on another component,
function(streamfx_add_component_dependency COMPONENT_NAME)
endfunction()
################################################################################
# Register Library
################################################################################
streamfx_add_library(${PROJECT_NAME} MODULE) # We are a module for libOBS.
# Set file version # Set file version
set_target_properties(${PROJECT_NAME} PROPERTIES set_target_properties(${PROJECT_NAME} PROPERTIES
MACHO_COMPATIBILITY_VERSION ${_VERSION_MAJOR}.${_VERSION_MINOR} MACHO_COMPATIBILITY_VERSION ${_VERSION_MAJOR}.${_VERSION_MINOR}
@ -1937,17 +2000,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
) )
# Enable Qt if needed
if(Qt5_FOUND OR Qt6_FOUND)
set_target_properties(${PROJECT_NAME} PROPERTIES
AUTOUIC ON
AUTOUIC_SEARCH_PATHS "${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/ui"
AUTOMOC ON
AUTORCC ON
AUTOGEN_BUILD_DIR "${PROJECT_BINARY_DIR}/generated"
)
endif()
# Windows exclusive changes # Windows exclusive changes
if(D_PLATFORM_WINDOWS) if(D_PLATFORM_WINDOWS)
foreach(DELAYLOAD ${PROJECT_LIBRARIES_DELAYED}) foreach(DELAYLOAD ${PROJECT_LIBRARIES_DELAYED})
@ -2013,259 +2065,300 @@ if(D_PLATFORM_MAC)
endif() endif()
################################################################################ ################################################################################
# Extra Tools # Add Core
################################################################################ ################################################################################
streamfx_add_library(${PROJECT_NAME}_Core STATIC EXCLUDE_FROM_ALL)
add_library(${PROJECT_NAME}::Core ALIAS ${PROJECT_NAME}_Core)
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}::Core)
# Clang # Combine all variables that matter.
is_feature_enabled(CLANG T_CHECK) set(PROJECT_FILES
if(T_CHECK) # Always exist
generate_compile_commands_json( ${PROJECT_DATA}
TARGETS ${PROJECT_NAME} ${PROJECT_PRIVATE_GENERATED}
${PROJECT_PRIVATE_SOURCE}
${PROJECT_TEMPLATES}
# UI-only (empty if not enabled)
${PROJECT_UI}
${PROJECT_UI_SOURCE}
# Media
${PROJECT_MEDIA}
) )
clang_tidy(
TARGETS ${PROJECT_NAME} # Set source groups for IDE generators.
VERSION 14.0.0 source_group(TREE "${PROJECT_SOURCE_DIR}/data" PREFIX "Data" FILES ${PROJECT_DATA})
source_group(TREE "${PROJECT_SOURCE_DIR}/source" PREFIX "Source" FILES ${PROJECT_PRIVATE_SOURCE} ${PROJECT_UI_SOURCE})
source_group(TREE "${PROJECT_BINARY_DIR}/generated" PREFIX "Source" FILES ${PROJECT_PRIVATE_GENERATED})
source_group(TREE "${PROJECT_SOURCE_DIR}/templates" PREFIX "Templates" FILES ${PROJECT_TEMPLATES})
source_group(TREE "${PROJECT_SOURCE_DIR}/ui" PREFIX "User Interface" FILES ${PROJECT_UI})
source_group(TREE "${PROJECT_SOURCE_DIR}/media" PREFIX "Media" FILES ${PROJECT_MEDIA})
# Prevent unwanted files from being built as source.
set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_UI} ${PROJECT_MEDIA} PROPERTIES
HEADER_FILE_ONLY ON
) )
clang_format(
TARGETS ${PROJECT_NAME} # Prevent non-UI files from being Qt'd
DEPENDENCY if(Qt5_Found OR Qt6_FOUND)
VERSION 14.0.0 set_source_files_properties(${PROJECT_DATA} ${PROJECT_TEMPLATES} ${PROJECT_MEDIA} ${PROJECT_PRIVATE_GENERATED} ${PROJECT_PRIVATE_SOURCE} PROPERTIES
SKIP_AUTOGEN ON
SKIP_AUTOMOC ON
SKIP_AUTORCC ON
SKIP_AUTOUIC ON
) )
endif() endif()
# Register the library
target_sources(${PROJECT_NAME}_Core PRIVATE ${PROJECT_FILES})
target_link_libraries(${PROJECT_NAME}_Core PRIVATE ${PROJECT_LIBRARIES})
target_include_directories(${PROJECT_NAME}_Core PRIVATE ${PROJECT_INCLUDE_DIRS})
target_compile_definitions(${PROJECT_NAME}_Core PRIVATE ${PROJECT_DEFINITIONS})
################################################################################ ################################################################################
# Installation # Components
################################################################################ ################################################################################
# As the above monolithic approach started to show its weaknesses, it was time
# for an improved system which suffers under less issues. This new component
# system should address the main necessary parts,
if(STANDALONE) file(GLOB COMPONENTS RELATIVE ${PROJECT_SOURCE_DIR} CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/components/*)
if(STRUCTURE_UNIFIED) foreach(COMPONENT ${COMPONENTS})
install( add_subdirectory(${COMPONENT} EXCLUDE_FROM_ALL)
DIRECTORY "data/" endforeach()
DESTINATION "data/"
FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
if(D_PLATFORM_WINDOWS) # ################################################################################
install( # # Installation
TARGETS ${PROJECT_NAME} # ################################################################################
RUNTIME DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
LIBRARY DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
if(MSVC)
install(
FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/"
COMPONENT StreamFX
OPTIONAL
)
endif()
# Dependency: AOM # if(STANDALONE)
if(HAVE_AOM AND AOM_BINARY AND D_PLATFORM_WINDOWS) # if(STRUCTURE_UNIFIED)
install( # install(
FILES ${AOM_BINARY} # DIRECTORY "data/"
DESTINATION "data/" COMPONENT StreamFX # DESTINATION "data/"
) # FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
endif() # DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
elseif(D_PLATFORM_LINUX) # )
install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
LIBRARY DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
elseif(D_PLATFORM_MAC)
install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
LIBRARY DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
endif()
install( # if(D_PLATFORM_WINDOWS)
FILES LICENSE # install(
DESTINATION "LICENSE" # TARGETS ${PROJECT_NAME}
COMPONENT StreamFX # RUNTIME DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
) # LIBRARY DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
install( # PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
FILES icon.png # )
DESTINATION "icon.png" # if(MSVC)
COMPONENT StreamFX # install(
) # FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
elseif(D_PLATFORM_WINDOWS) # DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/"
install( # COMPONENT StreamFX
TARGETS ${PROJECT_NAME} # OPTIONAL
RUNTIME DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX # )
LIBRARY DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX # endif()
)
install(
DIRECTORY "data/"
DESTINATION "data/obs-plugins/${PROJECT_NAME}/"
)
if(MSVC)
install(
FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/"
OPTIONAL
)
endif()
# Dependency: AOM # # Dependency: AOM
if(HAVE_AOM AND AOM_BINARY) # if(HAVE_AOM AND AOM_BINARY AND D_PLATFORM_WINDOWS)
install( # install(
FILES "${AOM_BINARY}" # FILES ${AOM_BINARY}
DESTINATION "data/obs-plugins/${PROJECT_NAME}/" COMPONENT StreamFX # DESTINATION "data/" COMPONENT StreamFX
) # )
endif() # endif()
elseif(D_PLATFORM_LINUX) # elseif(D_PLATFORM_LINUX)
if(STRUCTURE_PACKAGEMANAGER) # install(
install( # TARGETS ${PROJECT_NAME}
TARGETS ${PROJECT_NAME} # RUNTIME DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
RUNTIME DESTINATION "lib/obs-plugins/" COMPONENT StreamFX # LIBRARY DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
LIBRARY DESTINATION "lib/obs-plugins/" COMPONENT StreamFX # PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE # )
) # elseif(D_PLATFORM_MAC)
install( # install(
DIRECTORY "data/" # TARGETS ${PROJECT_NAME}
DESTINATION "share/obs/obs-plugins/${PROJECT_NAME}" # RUNTIME DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
COMPONENT StreamFX # LIBRARY DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX
FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE # PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE # )
) # endif()
else()
install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "plugins/${PROJECT_NAME}/bin/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
LIBRARY DESTINATION "plugins/${PROJECT_NAME}/bin/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
install(
DIRECTORY "data/"
DESTINATION "plugins/${PROJECT_NAME}/data/"
COMPONENT StreamFX
FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
endif()
elseif(D_PLATFORM_MAC)
if(STRUCTURE_BUNDLE)
install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "." COMPONENT StreamFX
LIBRARY DESTINATION "." COMPONENT StreamFX
BUNDLE DESTINATION "." COMPONENT StreamFX
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
else()
install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
LIBRARY DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
install(
DIRECTORY "data/"
DESTINATION "${PROJECT_NAME}/data/"
COMPONENT StreamFX
FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
)
endif()
endif()
else()
if(COMMAND setup_plugin_target)
setup_plugin_target(${PROJECT_NAME})
# Seems like we lost the ability to customize which directoy resources are in, and instead are forced to use '/data'.
if(HAVE_AOM AND AOM_BINARY) # Dependency: AOM # install(
add_target_resource(${PROJECT_NAME} "${AOM_BINARY}" "obs-plugins/${PROJECT_NAME}") # FILES LICENSE
endif() # DESTINATION "LICENSE"
elseif(COMMAND install_obs_plugin_with_data) # COMPONENT StreamFX
install_obs_plugin_with_data(${PROJECT_NAME} data) # )
# install(
# FILES icon.png
# DESTINATION "icon.png"
# COMPONENT StreamFX
# )
# elseif(D_PLATFORM_WINDOWS)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# LIBRARY DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# )
# install(
# DIRECTORY "data/"
# DESTINATION "data/obs-plugins/${PROJECT_NAME}/"
# )
# if(MSVC)
# install(
# FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
# DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/"
# OPTIONAL
# )
# endif()
if(HAVE_AOM AND AOM_BINARY) # Dependency: AOM # # Dependency: AOM
install( # if(HAVE_AOM AND AOM_BINARY)
FILES "${AOM_BINARY}" # install(
DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/${PROJECT_NAME}" # FILES "${AOM_BINARY}"
) # DESTINATION "data/obs-plugins/${PROJECT_NAME}/" COMPONENT StreamFX
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD # )
COMMAND "${CMAKE_COMMAND}" -E copy # endif()
"${AOM_BINARY}" # elseif(D_PLATFORM_LINUX)
"${OBS_DATA_DESTINATION}/obs-plugins/${PROJECT_NAME}" # if(STRUCTURE_PACKAGEMANAGER)
VERBATIM) # install(
endif() # TARGETS ${PROJECT_NAME}
endif() # RUNTIME DESTINATION "lib/obs-plugins/" COMPONENT StreamFX
endif() # LIBRARY DESTINATION "lib/obs-plugins/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# install(
# DIRECTORY "data/"
# DESTINATION "share/obs/obs-plugins/${PROJECT_NAME}"
# COMPONENT StreamFX
# FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# else()
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "plugins/${PROJECT_NAME}/bin/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# LIBRARY DESTINATION "plugins/${PROJECT_NAME}/bin/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# install(
# DIRECTORY "data/"
# DESTINATION "plugins/${PROJECT_NAME}/data/"
# COMPONENT StreamFX
# FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# endif()
# elseif(D_PLATFORM_MAC)
# if(STRUCTURE_BUNDLE)
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "." COMPONENT StreamFX
# LIBRARY DESTINATION "." COMPONENT StreamFX
# BUNDLE DESTINATION "." COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# else()
# install(
# TARGETS ${PROJECT_NAME}
# RUNTIME DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
# LIBRARY DESTINATION "${PROJECT_NAME}/bin/" COMPONENT StreamFX
# PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# install(
# DIRECTORY "data/"
# DESTINATION "${PROJECT_NAME}/data/"
# COMPONENT StreamFX
# FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE
# )
# endif()
# endif()
# else()
# if(COMMAND setup_plugin_target)
# setup_plugin_target(${PROJECT_NAME})
# # Seems like we lost the ability to customize which directoy resources are in, and instead are forced to use '/data'.
################################################################################ # if(HAVE_AOM AND AOM_BINARY) # Dependency: AOM
# Packaging # add_target_resource(${PROJECT_NAME} "${AOM_BINARY}" "obs-plugins/${PROJECT_NAME}")
################################################################################ # endif()
# elseif(COMMAND install_obs_plugin_with_data)
# install_obs_plugin_with_data(${PROJECT_NAME} data)
if(STANDALONE) # if(HAVE_AOM AND AOM_BINARY) # Dependency: AOM
# Packaging # install(
if(NOT PACKAGE_SUFFIX) # FILES "${AOM_BINARY}"
set(_PACKAGE_SUFFIX_OVERRIDE "${_VERSION_THIN}") # DESTINATION "${OBS_DATA_DESTINATION}/obs-plugins/${PROJECT_NAME}"
else() # )
set(_PACKAGE_SUFFIX_OVERRIDE "${PACKAGE_SUFFIX}") # add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
endif() # COMMAND "${CMAKE_COMMAND}" -E copy
set(_PACKAGE_FULL_NAME "${PACKAGE_PREFIX}/${PACKAGE_NAME}-${_PACKAGE_SUFFIX_OVERRIDE}") # "${AOM_BINARY}"
# "${OBS_DATA_DESTINATION}/obs-plugins/${PROJECT_NAME}"
# VERBATIM)
# endif()
# endif()
# endif()
if(STRUCTURE_UNIFIED) # ################################################################################
add_custom_target( # # Packaging
PACKAGE_ZIP # ################################################################################
${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.obs" --format=zip --
"."
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
)
else()
add_custom_target(
PACKAGE_7Z
${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.7z" --format=7zip --
"."
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
)
add_custom_target(
PACKAGE_ZIP
${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.zip" --format=zip --
"."
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
)
# Windows # if(STANDALONE)
if(D_PLATFORM_WINDOWS) # # Packaging
## Installer (InnoSetup) # if(NOT PACKAGE_SUFFIX)
get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) # set(_PACKAGE_SUFFIX_OVERRIDE "${_VERSION_THIN}")
file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR) # else()
# set(_PACKAGE_SUFFIX_OVERRIDE "${PACKAGE_SUFFIX}")
# endif()
# set(_PACKAGE_FULL_NAME "${PACKAGE_PREFIX}/${PACKAGE_NAME}-${_PACKAGE_SUFFIX_OVERRIDE}")
get_filename_component(ISS_PACKAGE_DIR "${PACKAGE_PREFIX}" ABSOLUTE) # if(STRUCTURE_UNIFIED)
file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR) # add_custom_target(
# PACKAGE_ZIP
# ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.obs" --format=zip --
# "."
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
# )
# else()
# add_custom_target(
# PACKAGE_7Z
# ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.7z" --format=7zip --
# "."
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
# )
# add_custom_target(
# PACKAGE_ZIP
# ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.zip" --format=zip --
# "."
# WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
# )
get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE) # # Windows
file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR) # if(D_PLATFORM_WINDOWS)
# ## Installer (InnoSetup)
# get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
# file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR)
get_filename_component(ISS_MSVCHELPER_PATH "${msvc-redist-helper_BUILD_DIR}" ABSOLUTE) # get_filename_component(ISS_PACKAGE_DIR "${PACKAGE_PREFIX}" ABSOLUTE)
file(TO_NATIVE_PATH "${ISS_MSVCHELPER_PATH}" ISS_MSVCHELPER_PATH) # file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR)
configure_file( # get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE)
"templates/windows/installer.iss.in" # file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR)
"installer.iss"
)
endif()
# Apple MacOS # get_filename_component(ISS_MSVCHELPER_PATH "${msvc-redist-helper_BUILD_DIR}" ABSOLUTE)
if(D_PLATFORM_MAC) # file(TO_NATIVE_PATH "${ISS_MSVCHELPER_PATH}" ISS_MSVCHELPER_PATH)
# .pkg Installer
set(PACKAGES_PATH_NAME "${PROJECT_NAME}") # configure_file(
if(STRUCTURE_BUNDLE) # "templates/windows/installer.iss.in"
set(PACKAGES_PATH_NAME "${PACKAGES_PATH_NAME}.plugin") # "installer.iss"
endif() # )
configure_file( # endif()
"templates/macos/installer.pkgproj.in"
"installer.pkgproj" # # Apple MacOS
) # if(D_PLATFORM_MAC)
endif() # # .pkg Installer
endif() # set(PACKAGES_PATH_NAME "${PROJECT_NAME}")
endif() # if(STRUCTURE_BUNDLE)
# set(PACKAGES_PATH_NAME "${PACKAGES_PATH_NAME}.plugin")
# endif()
# configure_file(
# "templates/macos/installer.pkgproj.in"
# "installer.pkgproj"
# )
# endif()
# endif()
# endif()