1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

install files after building server/client

package required files inside app bundle
This commit is contained in:
Andrey Filipenkov 2021-03-11 11:52:09 +03:00
parent 92a7936202
commit b6c4126bed
4 changed files with 30 additions and 25 deletions

View File

@ -61,8 +61,8 @@ if(APPLE_IOS)
set(BUNDLE_IDENTIFIER_PREFIX "eu.vcmi" CACHE STRING "Bundle identifier prefix")
else()
option(ENABLE_LAUNCHER "Enable compilation of launcher" ON)
option(ENABLE_TEST "Enable compilation of unit tests" ON)
endif()
option(ENABLE_TEST "Enable compilation of unit tests" ON)
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.16.0")
option(ENABLE_PCH "Enable compilation using precompiled headers" ON)
endif(NOT ${CMAKE_VERSION} VERSION_LESS "3.16.0")
@ -232,8 +232,11 @@ if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support suc
endif()
endif()
# TODO: also enable for macOS
if(APPLE_IOS)
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") # iPhone + iPad
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_64_TO_32_BIT_CONVERSION "NO")
# TODO: also enable for macOS
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fmodules")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fmodules")
endif(APPLE_IOS)
@ -336,19 +339,19 @@ elseif(APPLE)
set(LIB_DIR "." CACHE STRING "Where to install main library")
set(DATA_DIR "." CACHE STRING "Where to install data files")
else()
set(APP_BUNDLE_DIR "${CMAKE_PROJECT_NAME}.app")
if(APPLE_MACOS)
set(APP_BUNDLE_DIR "${CMAKE_PROJECT_NAME}.app")
set(APP_BUNDLE_CONTENTS_DIR "${APP_BUNDLE_DIR}/Contents")
set(APP_BUNDLE_BINARY_DIR "${APP_BUNDLE_CONTENTS_DIR}/MacOS")
else()
set(APP_BUNDLE_CONTENTS_DIR "${APP_BUNDLE_DIR}")
set(APP_BUNDLE_BINARY_DIR "${APP_BUNDLE_DIR}")
endif(APPLE_MACOS)
set(APP_BUNDLE_RESOURCES_DIR "${APP_BUNDLE_CONTENTS_DIR}/Resources")
set(APP_BUNDLE_RESOURCES_DIR "${APP_BUNDLE_CONTENTS_DIR}/Resources")
set(BIN_DIR "${APP_BUNDLE_BINARY_DIR}" CACHE STRING "Where to install binaries")
set(LIB_DIR "${APP_BUNDLE_CONTENTS_DIR}/Frameworks" CACHE STRING "Where to install main library")
set(DATA_DIR "${APP_BUNDLE_RESOURCES_DIR}/Data" CACHE STRING "Where to install data files")
set(BIN_DIR "${APP_BUNDLE_BINARY_DIR}" CACHE STRING "Where to install binaries")
set(LIB_DIR "${APP_BUNDLE_CONTENTS_DIR}/Frameworks" CACHE STRING "Where to install main library")
set(DATA_DIR "${APP_BUNDLE_RESOURCES_DIR}/Data" CACHE STRING "Where to install data files")
else()
set(LIB_DIR "Frameworks")
set(DATA_DIR ".")
endif(APPLE_MACOS)
endif()
else()
# includes lib path which determines where to install shared libraries (either /lib or /lib64)
@ -415,7 +418,7 @@ install(DIRECTORY scripts DESTINATION ${DATA_DIR})
install(DIRECTORY Mods DESTINATION ${DATA_DIR})
# that script is useless for Windows
if(NOT WIN32)
if(NOT WIN32 AND NOT APPLE_IOS)
install(FILES vcmibuilder DESTINATION ${BIN_DIR} PERMISSIONS
OWNER_WRITE OWNER_READ OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE

View File

@ -177,7 +177,7 @@ if(WIN32)
target_compile_definitions(vcmiclient PRIVATE WINDOWS_IGNORE_PACKING_MISMATCH)
elseif(APPLE_IOS)
target_link_libraries(vcmiclient PRIVATE
"-framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -framework CoreServices -framework ImageIO" # SDL2_image
"-framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -framework CoreServices -framework ImageIO -framework Metal -framework OpenGLES -framework AVFoundation -framework GameController -framework CoreMotion" # SDL2_image
)
set_target_properties(vcmiclient PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist.in")
@ -204,7 +204,13 @@ target_include_directories(vcmiclient
vcmi_set_output_dir(vcmiclient "")
enable_pch(vcmiclient)
install(TARGETS vcmiclient DESTINATION ${BIN_DIR})
if(APPLE_IOS)
add_custom_command(TARGET vcmiclient POST_BUILD
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
)
else()
install(TARGETS vcmiclient DESTINATION ${BIN_DIR})
endif()
#install icons and desktop file on Linux
if(NOT WIN32 AND NOT APPLE)

View File

@ -389,7 +389,6 @@ class VCMIDirsIOS final : public VCMIDirsApple
std::vector<bfs::path> dataPaths() const override;
bfs::path libraryPath() const override;
boost::filesystem::path fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const override;
bfs::path binaryPath() const override;
bool developmentMode() const override;
@ -420,15 +419,6 @@ bfs::path VCMIDirsIOS::libraryPath() const
return {ios_frameworksPath()};
#endif
}
// todo ios: place AI libs in subdir?
boost::filesystem::path VCMIDirsIOS::fullLibraryPath(const std::string & desiredFolder, const std::string & baseLibName) const
{
#ifdef VCMI_IOS_SIM
return VCMIDirsApple::fullLibraryPath(desiredFolder, baseLibName);
#else
return libraryPath() / libraryName(baseLibName);
#endif
}
bfs::path VCMIDirsIOS::binaryPath() const { return {ios_bundlePath()}; }
bool VCMIDirsIOS::developmentMode() const { return false; }

View File

@ -56,4 +56,10 @@ endif()
vcmi_set_output_dir(vcmiserver "")
enable_pch(vcmiserver)
install(TARGETS vcmiserver DESTINATION ${BIN_DIR})
if(APPLE_IOS)
add_custom_command(TARGET vcmiserver POST_BUILD
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiserver>"
)
else()
install(TARGETS vcmiserver DESTINATION ${BIN_DIR})
endif()