Browse Source

Add install rules/target; works on linux but finnicky on Windows

master
Jessica James 3 years ago
parent
commit
5b9d4492cd
  1. 76
      CMakeLists.txt
  2. 2
      LICENSE
  3. 1
      baseline/Config.ini
  4. 1
      src/CMakeLists.txt

76
CMakeLists.txt

@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.0)
project(jupiter_bot)
set(CMAKE_CXX_STANDARD 20)
option(INSTALL_JUPITER_BOT "Enables the INSTALL target for Jupiter Bot" ON)
# Try to set JUPITER_VERSION_SHORT if it isn't already
if (NOT DEFINED JUPITER_VERSION_SHORT)
@ -47,6 +48,10 @@ include(build/CMakeLists.txt)
# Setup source files
add_subdirectory(src)
########################################
# PackagedBuild & FullBotBuild targets #
########################################
# Add PackagedBuild target to package a release build, and FullBotBuild to just build all plugins
add_custom_target(FullBotBuild)
add_dependencies(FullBotBuild jupiter Bot)
@ -114,3 +119,74 @@ add_custom_command(TARGET PackagedBuild
add_custom_command(TARGET PackagedBuild
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E rename "${PACKAGED_BUILD_PATH}/../${TAR_FILENAME}" "${PACKAGED_BUILD_PATH}/${TAR_FILENAME}")
##########################
# INSTALL rules & target #
##########################
if (INSTALL_JUPITER_BOT)
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "CMAKE_INSTALL_BINDIR: ${CMAKE_INSTALL_BINDIR}")
message(STATUS "CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}")
message(STATUS "CMAKE_INSTALL_INCLUDEDIR: ${CMAKE_INSTALL_INCLUDEDIR}")
message(STATUS "CMAKE_INSTALL_SYSCONFDIR: ${CMAKE_INSTALL_SYSCONFDIR}")
message(STATUS "CMAKE_INSTALL_LOCALSTATEDIR: ${CMAKE_INSTALL_LOCALSTATEDIR}")
message(STATUS "CMAKE_INSTALL_DATADIR: ${CMAKE_INSTALL_DATADIR}")
set(JUPITER_BOT_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}")
set(JUPITER_BOT_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
set(JUPITER_BOT_INSTALL_SYSCONFDIR "${CMAKE_INSTALL_SYSCONFDIR}")
set(JUPITER_BOT_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}")
# Jupiter Bot program binary
set(JUPITER_BOT_INSTALL_EXE "jupiter_bot${CMAKE_EXECUTABLE_SUFFIX}")
install(PROGRAMS $<TARGET_FILE:Bot>
DESTINATION ${JUPITER_BOT_INSTALL_BINDIR}
RENAME ${JUPITER_BOT_INSTALL_EXE})
# Shared library dependencies
install(TARGETS jupiter jessilib
RUNTIME DESTINATION ${JUPITER_BOT_INSTALL_BINDIR}
LIBRARY DESTINATION ${JUPITER_BOT_INSTALL_LIBDIR})
# Plugins
install(TARGETS ${JUPITER_PLUGINS}
RUNTIME DESTINATION "${JUPITER_BOT_INSTALL_BINDIR}/Plugins"
LIBRARY DESTINATION "${JUPITER_BOT_INSTALL_LIBDIR}/Plugins")
# Copy baselines for modification
set(TMP_INSTALL_FILE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/install_tmp")
set(BASELINE_FILES_INSTALL "${TMP_INSTALL_FILE_DIR}/baseline")
install(CODE
"execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory \"${CMAKE_CURRENT_SOURCE_DIR}/baseline\" \"${BASELINE_FILES_INSTALL}/\")")
# Configure ConfigsDirectory & PluginsDirectory
set(INSTALL_CONFIG_PATH "${BASELINE_FILES_INSTALL}/Config.ini")
install(CODE
"file(APPEND \"${INSTALL_CONFIG_PATH}\" \"ConfigsDirectory=${CMAKE_INSTALL_PREFIX}/${JUPITER_BOT_INSTALL_SYSCONFDIR}/jupiter_bot/Configs\n\")")
if (WIN32)
install(CODE
"file(APPEND \"${INSTALL_CONFIG_PATH}\" \"PluginsDirectory=${CMAKE_INSTALL_PREFIX}/${JUPITER_BOT_INSTALL_BINDIR}/Plugins\n\")")
else()
install(CODE
"file(APPEND \"${INSTALL_CONFIG_PATH}\" \"PluginsDirectory=${CMAKE_INSTALL_PREFIX}/${JUPITER_BOT_INSTALL_LIBDIR}/Plugins\n\")")
endif()
# Generate run script to pass in Config.ini
set(HELPER_SCRIPT_NAME "jupiter_bot.sh")
if (WIN32)
install(CODE
"file(WRITE \"${TMP_INSTALL_FILE_DIR}/jupiter_bot.bat\" \"jupiter_bot.exe --config=${CMAKE_INSTALL_PREFIX}/${JUPITER_BOT_INSTALL_SYSCONFDIR}/jupiter_bot/Config.ini\")")
install(PROGRAMS ${TMP_INSTALL_FILE_DIR}/jupiter_bot.bat
DESTINATION ${JUPITER_BOT_INSTALL_BINDIR})
else()
install(CODE
"file(WRITE \"${TMP_INSTALL_FILE_DIR}/jupiter_bot.sh\" \"jupiter_bot --config=${CMAKE_INSTALL_PREFIX}/${JUPITER_BOT_INSTALL_SYSCONFDIR}/jupiter_bot/Config.ini\")")
install(PROGRAMS ${TMP_INSTALL_FILE_DIR}/jupiter_bot.sh
DESTINATION ${JUPITER_BOT_INSTALL_BINDIR})
endif()
# Copy configured baseline files
install(DIRECTORY ${BASELINE_FILES_INSTALL}/
DESTINATION "${JUPITER_BOT_INSTALL_SYSCONFDIR}/jupiter_bot")
endif()

2
LICENSE

@ -1,4 +1,4 @@
Copyright (C) 2013-2016 Jessica James.
Copyright (C) 2013-2021 Jessica James.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above

1
baseline/Config.ini

@ -19,4 +19,3 @@
Plugins=IRC.Core CoreCommands PluginManager ExtraCommands RenX.Core RenX.Commands RenX.Logging RenX.Medals
;EOF

1
src/CMakeLists.txt

@ -7,6 +7,7 @@ set(CMAKE_SHARED_LIBRARY_PREFIX)
# We need Jupiter and jessilib to be shared libs, and there aren't separate targets for shared/static variants
set(BUILD_SHARED_LIBS ON)
set(INSTALL_GTEST OFF)
# Add primary components (Jupiter, Bot)
add_subdirectory(Jupiter)

Loading…
Cancel
Save