2017-11-14 04:50:41 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10 FATAL_ERROR) # because of c++17
|
2020-05-28 01:37:03 +00:00
|
|
|
# Set MSVC runtime library flags from CMAKE_MSVC_RUNTIME_LIBRARY
|
|
|
|
cmake_policy(SET CMP0091 NEW)
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
##################
|
|
|
|
# Athena Version #
|
|
|
|
##################
|
2021-04-12 23:39:36 +00:00
|
|
|
find_package(Git)
|
|
|
|
if (GIT_FOUND)
|
|
|
|
# make sure version information gets re-run when the current Git HEAD changes
|
|
|
|
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --git-path HEAD
|
|
|
|
OUTPUT_VARIABLE athena_git_head_filename
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${athena_git_head_filename}")
|
|
|
|
|
|
|
|
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --symbolic-full-name HEAD
|
|
|
|
OUTPUT_VARIABLE athena_git_head_symbolic
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse --git-path ${athena_git_head_symbolic}
|
|
|
|
OUTPUT_VARIABLE athena_git_head_symbolic_filename
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${athena_git_head_symbolic_filename}")
|
|
|
|
|
|
|
|
# defines ATHENA_WC_REVISION
|
|
|
|
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
|
|
|
OUTPUT_VARIABLE ATHENA_WC_REVISION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
# defines ATHENA_WC_DESCRIBE
|
|
|
|
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} describe --tag --long --dirty
|
|
|
|
OUTPUT_VARIABLE ATHENA_WC_DESCRIBE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
# remove hash (and trailing "-0" if needed) from description
|
|
|
|
string(REGEX REPLACE "(-0)?-[^-]+((-dirty)?)$" "\\2" ATHENA_WC_DESCRIBE "${ATHENA_WC_DESCRIBE}")
|
|
|
|
|
|
|
|
# defines ATHENA_WC_BRANCH
|
|
|
|
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
|
|
|
OUTPUT_VARIABLE ATHENA_WC_BRANCH
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
# defines ATHENA_WC_DATE
|
|
|
|
execute_process(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad
|
|
|
|
OUTPUT_VARIABLE ATHENA_WC_DATE
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
else ()
|
|
|
|
message(STATUS "Unable to find git, commit information will not be available")
|
|
|
|
endif ()
|
2015-07-08 23:53:40 +00:00
|
|
|
|
2021-04-12 23:39:36 +00:00
|
|
|
if (ATHENA_WC_DESCRIBE)
|
|
|
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+)\-([0-9]+).*" "\\1.\\2.\\3.\\4" ATHENA_VERSION_STRING "${ATHENA_WC_DESCRIBE}")
|
|
|
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1.\\2.\\3" ATHENA_VERSION "${ATHENA_VERSION_STRING}")
|
|
|
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\1" ATHENA_MAJOR_VERSION "${ATHENA_VERSION_STRING}")
|
|
|
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\2" ATHENA_MINOR_VERSION "${ATHENA_VERSION_STRING}")
|
|
|
|
string(REGEX REPLACE "v?([0-9]+)\.([0-9]+)\.([0-9]+).*" "\\3" ATHENA_PATCH_VERSION "${ATHENA_VERSION_STRING}")
|
|
|
|
else ()
|
|
|
|
set(ATHENA_WC_DESCRIBE "UNKNOWN-VERSION")
|
|
|
|
set(ATHENA_VERSION "0.0.0")
|
|
|
|
set(ATHENA_MAJOR_VERSION "0")
|
|
|
|
set(ATHENA_MINOR_VERSION "0")
|
|
|
|
set(ATHENA_PATCH_VERSION "0")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# Add version information to CI environment variables
|
|
|
|
if(DEFINED ENV{GITHUB_ENV})
|
|
|
|
file(APPEND "$ENV{GITHUB_ENV}" "ATHENA_VERSION=${ATHENA_WC_DESCRIBE}")
|
|
|
|
endif()
|
2021-04-12 21:19:08 +00:00
|
|
|
|
|
|
|
project(athena VERSION ${ATHENA_VERSION} LANGUAGES C CXX)
|
|
|
|
|
|
|
|
if (MSVC)
|
|
|
|
# Shaddup MSVC
|
|
|
|
add_compile_definitions(UNICODE=1 _UNICODE=1 __SSE__=1
|
|
|
|
_CRT_SECURE_NO_WARNINGS=1 D_SCL_SECURE_NO_WARNINGS=1
|
|
|
|
_SCL_SECURE_NO_DEPRECATE=1 _CRT_NONSTDC_NO_WARNINGS=1
|
|
|
|
_ENABLE_EXTENDED_ALIGNED_STORAGE=1 NOMINMAX=1)
|
|
|
|
add_compile_options(/IGNORE:4221
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4018>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4800>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4005>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4311>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4068>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4267>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4244>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4200>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4305>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4067>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4146>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4309>
|
|
|
|
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/wd4805>
|
|
|
|
${VS_OPTIONS})
|
|
|
|
|
|
|
|
string(REPLACE "/GR " "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
string(REPLACE " /EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
add_compile_options(
|
|
|
|
# Disable exceptions
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/EHsc->
|
|
|
|
|
|
|
|
# Disable RTTI
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/GR->
|
|
|
|
|
|
|
|
# Enforce various standards compliant behavior.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/permissive->
|
|
|
|
|
|
|
|
# Enable standard volatile semantics.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/volatile:iso>
|
|
|
|
|
|
|
|
# Reports the proper value for the __cplusplus preprocessor macro.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus>
|
|
|
|
|
|
|
|
# Use latest C++ standard.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/std:c++latest>
|
|
|
|
)
|
|
|
|
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
|
|
# Flags for MSVC (not clang-cl)
|
|
|
|
add_compile_options(
|
|
|
|
# Allow constexpr variables to have explicit external linkage.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:externConstexpr>
|
|
|
|
|
|
|
|
# Assume that new throws exceptions, allowing better code generation.
|
|
|
|
$<$<COMPILE_LANGUAGE:CXX>:/Zc:throwingNew>
|
|
|
|
|
|
|
|
# Link-time Code Generation for Release builds
|
|
|
|
$<$<CONFIG:Release>:/GL>
|
|
|
|
)
|
|
|
|
|
|
|
|
# Link-time Code Generation for Release builds
|
|
|
|
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
|
|
|
endif ()
|
|
|
|
else ()
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
endif ()
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
################
|
|
|
|
# Athena Build #
|
|
|
|
################
|
|
|
|
|
2015-07-07 03:23:37 +00:00
|
|
|
add_subdirectory(extern)
|
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-core
|
|
|
|
src/athena/Utility.cpp
|
|
|
|
src/athena/MemoryReader.cpp
|
|
|
|
src/athena/MemoryWriter.cpp
|
2018-08-25 08:38:23 +00:00
|
|
|
src/athena/VectorWriter.cpp
|
2017-01-27 03:25:48 +00:00
|
|
|
src/athena/FileWriterGeneric.cpp
|
2016-03-04 23:00:12 +00:00
|
|
|
src/athena/Global.cpp
|
|
|
|
src/athena/Checksums.cpp
|
|
|
|
src/athena/Compression.cpp
|
2017-12-30 01:05:53 +00:00
|
|
|
src/athena/Socket.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
src/LZ77/LZLookupTable.cpp
|
|
|
|
src/LZ77/LZType10.cpp
|
|
|
|
src/LZ77/LZType11.cpp
|
|
|
|
src/LZ77/LZBase.cpp
|
2016-03-04 23:00:12 +00:00
|
|
|
src/athena/FileInfo.cpp
|
|
|
|
src/athena/Dir.cpp
|
|
|
|
src/athena/DNAYaml.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/IStream.hpp
|
|
|
|
include/athena/IStreamReader.hpp
|
|
|
|
include/athena/IStreamWriter.hpp
|
|
|
|
include/athena/Types.hpp
|
|
|
|
include/athena/Utility.hpp
|
|
|
|
include/athena/Global.hpp
|
|
|
|
include/athena/FileReader.hpp
|
|
|
|
include/athena/FileWriter.hpp
|
|
|
|
include/athena/MemoryReader.hpp
|
|
|
|
include/athena/MemoryWriter.hpp
|
2018-08-25 08:38:23 +00:00
|
|
|
include/athena/VectorWriter.hpp
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/Checksums.hpp
|
2018-03-04 04:24:11 +00:00
|
|
|
include/athena/ChecksumsLiterals.hpp
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/Compression.hpp
|
2017-01-07 05:03:13 +00:00
|
|
|
include/athena/Socket.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
include/LZ77/LZBase.hpp
|
|
|
|
include/LZ77/LZLookupTable.hpp
|
|
|
|
include/LZ77/LZType10.hpp
|
|
|
|
include/LZ77/LZType11.hpp
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/FileInfo.hpp
|
|
|
|
include/athena/Dir.hpp
|
|
|
|
include/athena/DNA.hpp
|
|
|
|
include/athena/DNAYaml.hpp
|
2018-03-04 04:24:11 +00:00
|
|
|
include/athena/DNAOp.hpp
|
|
|
|
include/athena/YAMLCommon.hpp
|
|
|
|
include/athena/YAMLDocReader.hpp
|
|
|
|
include/athena/YAMLDocWriter.hpp
|
2015-08-31 21:11:42 +00:00
|
|
|
include/yaml.h
|
|
|
|
include/utf8proc.h
|
2015-07-07 03:23:37 +00:00
|
|
|
)
|
2019-09-07 12:53:03 +00:00
|
|
|
if(WIN32)
|
|
|
|
target_sources(athena-core PRIVATE
|
|
|
|
src/win32_largefilewrapper.c
|
|
|
|
include/win32_largefilewrapper.h
|
|
|
|
src/athena/FileWriterWin32.cpp
|
|
|
|
src/athena/FileReaderWin32.cpp
|
|
|
|
)
|
2019-09-07 15:43:31 +00:00
|
|
|
|
|
|
|
target_compile_definitions(athena-core PRIVATE
|
|
|
|
-DNOMINMAX
|
|
|
|
-DWIN32_LEAN_AND_MEAN
|
|
|
|
)
|
2019-09-07 12:53:03 +00:00
|
|
|
else()
|
|
|
|
target_sources(athena-core PRIVATE
|
|
|
|
src/athena/FileWriterNix.cpp
|
|
|
|
src/athena/FileReader.cpp
|
|
|
|
)
|
|
|
|
if(APPLE OR GEKKO OR NX OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
target_sources(athena-core PRIVATE
|
|
|
|
src/osx_largefilewrapper.c
|
|
|
|
include/osx_largefilewrapper.h
|
|
|
|
)
|
|
|
|
|
|
|
|
if(GEKKO OR NX)
|
|
|
|
target_sources(athena-core PRIVATE
|
|
|
|
src/gekko_support.c
|
|
|
|
include/gekko_support.h
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2019-06-13 01:29:18 +00:00
|
|
|
target_include_directories(athena-core PUBLIC
|
2019-09-07 12:53:03 +00:00
|
|
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
|
|
|
$<BUILD_INTERFACE:${ZLIB_INCLUDE_DIR}>
|
|
|
|
)
|
|
|
|
target_link_libraries(athena-core PUBLIC
|
|
|
|
athena-libyaml
|
|
|
|
fmt
|
|
|
|
)
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-sakura EXCLUDE_FROM_ALL
|
|
|
|
src/athena/Sprite.cpp
|
|
|
|
src/athena/SpriteFile.cpp
|
|
|
|
src/athena/SpriteFileReader.cpp
|
|
|
|
src/athena/SpriteFileWriter.cpp
|
|
|
|
src/athena/SpriteFrame.cpp
|
|
|
|
src/athena/SpritePart.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/SakuraGlobal.hpp
|
|
|
|
include/athena/Sprite.hpp
|
|
|
|
include/athena/SpriteFile.hpp
|
|
|
|
include/athena/SpriteFileReader.hpp
|
|
|
|
include/athena/SpriteFileWriter.hpp
|
|
|
|
include/athena/SpriteFrame.hpp
|
|
|
|
include/athena/SpritePart.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
)
|
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-wiisave EXCLUDE_FROM_ALL
|
|
|
|
src/athena/WiiBanner.cpp
|
|
|
|
src/athena/WiiFile.cpp
|
|
|
|
src/athena/WiiImage.cpp
|
|
|
|
src/athena/WiiSave.cpp
|
|
|
|
src/athena/WiiSaveReader.cpp
|
|
|
|
src/athena/WiiSaveWriter.cpp
|
2017-01-03 10:32:39 +00:00
|
|
|
src/bn.cpp
|
|
|
|
src/ec.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
src/md5.cpp
|
|
|
|
src/sha1.cpp
|
2015-07-08 02:53:39 +00:00
|
|
|
src/aes.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/WiiBanner.hpp
|
|
|
|
include/athena/WiiFile.hpp
|
|
|
|
include/athena/WiiImage.hpp
|
|
|
|
include/athena/WiiSave.hpp
|
|
|
|
include/athena/WiiSaveReader.hpp
|
|
|
|
include/athena/WiiSaveWriter.hpp
|
2015-07-08 02:53:39 +00:00
|
|
|
include/aes.hpp
|
2017-01-03 10:32:39 +00:00
|
|
|
include/bn.hpp
|
|
|
|
include/ec.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
include/md5.h
|
|
|
|
include/sha1.h
|
|
|
|
)
|
2021-02-01 05:13:23 +00:00
|
|
|
if(NOT MSVC AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL x86_64)
|
2019-09-07 12:53:03 +00:00
|
|
|
set_source_files_properties(src/aes.cpp PROPERTIES COMPILE_FLAGS -maes)
|
2015-07-22 18:59:40 +00:00
|
|
|
endif()
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-06-30 05:20:27 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
add_library(athena-zelda EXCLUDE_FROM_ALL
|
|
|
|
src/athena/ALTTPFile.cpp
|
|
|
|
src/athena/ALTTPFileReader.cpp
|
|
|
|
src/athena/ALTTPFileWriter.cpp
|
|
|
|
src/athena/ALTTPQuest.cpp
|
|
|
|
src/athena/MCFile.cpp
|
|
|
|
src/athena/MCFileReader.cpp
|
|
|
|
src/athena/MCFileWriter.cpp
|
|
|
|
src/athena/MCSlot.cpp
|
|
|
|
src/athena/SkywardSwordFile.cpp
|
|
|
|
src/athena/SkywardSwordFileReader.cpp
|
|
|
|
src/athena/SkywardSwordFileWriter.cpp
|
|
|
|
src/athena/SkywardSwordQuest.cpp
|
|
|
|
src/athena/ZQuestFile.cpp
|
|
|
|
src/athena/ZQuestFileReader.cpp
|
|
|
|
src/athena/ZQuestFileWriter.cpp
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2016-03-04 23:00:12 +00:00
|
|
|
include/athena/ALTTPEnums.hpp
|
|
|
|
include/athena/ALTTPFile.hpp
|
|
|
|
include/athena/ALTTPFileReader.hpp
|
|
|
|
include/athena/ALTTPFileWriter.hpp
|
|
|
|
include/athena/ALTTPQuest.hpp
|
|
|
|
include/athena/ALTTPStructs.hpp
|
|
|
|
include/athena/MCFile.hpp
|
|
|
|
include/athena/MCFileReader.hpp
|
|
|
|
include/athena/MCFileWriter.hpp
|
|
|
|
include/athena/SkywardSwordFile.hpp
|
|
|
|
include/athena/SkywardSwordFileReader.hpp
|
|
|
|
include/athena/SkywardSwordFileWriter.hpp
|
|
|
|
include/athena/SkywardSwordQuest.hpp
|
2017-01-03 11:15:07 +00:00
|
|
|
include/athena/ZQuestFile.hpp
|
|
|
|
include/athena/ZQuestFileReader.hpp
|
|
|
|
include/athena/ZQuestFileWriter.hpp
|
2015-07-07 03:23:37 +00:00
|
|
|
)
|
|
|
|
|
2015-08-04 03:42:44 +00:00
|
|
|
# Icon
|
|
|
|
set(ATHENA_ICO ${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico)
|
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
# Offer the user the choice of overriding the installation directories
|
|
|
|
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
|
|
|
|
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
|
|
|
if(WIN32 AND NOT CYGWIN)
|
2015-07-10 23:44:31 +00:00
|
|
|
set(INSTALL_CMAKE_DIR cmake)
|
2015-07-08 23:53:40 +00:00
|
|
|
else()
|
2016-03-04 23:00:12 +00:00
|
|
|
set(INSTALL_CMAKE_DIR lib/cmake/athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
endif()
|
2015-07-07 03:23:37 +00:00
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
# Make relative paths absolute (needed later on)
|
|
|
|
foreach(p LIB INCLUDE CMAKE)
|
|
|
|
set(var INSTALL_${p}_DIR)
|
|
|
|
if(NOT IS_ABSOLUTE "${${var}}")
|
2015-07-09 00:57:51 +00:00
|
|
|
set(ABS_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
|
|
|
else()
|
|
|
|
set(ABS_${var} "${${var}}")
|
2015-07-08 23:53:40 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Define installs
|
2019-07-20 04:19:44 +00:00
|
|
|
install(DIRECTORY include DESTINATION ${INSTALL_INCLUDE_DIR}/athena COMPONENT athena)
|
|
|
|
install(DIRECTORY extern/fmt/include DESTINATION ${INSTALL_INCLUDE_DIR}/fmt COMPONENT athena)
|
2019-12-08 21:32:50 +00:00
|
|
|
install(TARGETS athena-core fmt
|
2016-03-04 23:00:12 +00:00
|
|
|
DESTINATION ${INSTALL_LIB_DIR} EXPORT AthenaTargets COMPONENT athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
if(WIN32 AND NOT CYGWIN)
|
2016-03-04 23:00:12 +00:00
|
|
|
install(FILES Athena.ico DESTINATION ${INSTALL_LIB_DIR} COMPONENT athena)
|
2015-07-09 00:01:05 +00:00
|
|
|
elseif(UNIX)
|
2015-07-10 23:44:31 +00:00
|
|
|
configure_file(libAthena.pc.in libAthena.pc @ONLY)
|
2015-08-14 03:21:49 +00:00
|
|
|
configure_file(PKGBUILD.in ${CMAKE_CURRENT_SOURCE_DIR}/PKGBUILD @ONLY)
|
2017-12-07 04:07:33 +00:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libAthena.pc
|
2016-03-04 23:00:12 +00:00
|
|
|
DESTINATION ${INSTALL_LIB_DIR}/pkgconfig COMPONENT athena)
|
2015-07-08 20:21:50 +00:00
|
|
|
endif()
|
|
|
|
|
2015-07-08 23:53:40 +00:00
|
|
|
##################
|
|
|
|
# Package Export #
|
|
|
|
##################
|
|
|
|
|
|
|
|
# Add all targets to the build-tree export set
|
2019-07-20 04:19:44 +00:00
|
|
|
export(TARGETS athena-core athena-libyaml fmt FILE "${CMAKE_CURRENT_BINARY_DIR}/AthenaTargets.cmake")
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
# Export the package for use from the build-tree
|
|
|
|
# (this registers the build-tree with a global CMake-registry)
|
2016-03-04 23:00:12 +00:00
|
|
|
export(PACKAGE athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
# Create the AthenaConfig.cmake
|
|
|
|
# ... for the build tree
|
2016-03-04 23:00:12 +00:00
|
|
|
set(CONF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include/athena")
|
2015-07-08 23:53:40 +00:00
|
|
|
set(CONF_ICON_DIR "${PROJECT_SOURCE_DIR}/Athena.ico")
|
2017-12-07 04:07:33 +00:00
|
|
|
configure_file(AthenaConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/AthenaConfig.cmake" @ONLY)
|
2015-07-08 23:53:40 +00:00
|
|
|
# ... for the install tree
|
2015-07-09 00:57:51 +00:00
|
|
|
file(RELATIVE_PATH REL_INCLUDE_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_INCLUDE_DIR}")
|
|
|
|
file(RELATIVE_PATH REL_ICON_DIR "${ABS_INSTALL_CMAKE_DIR}" "${ABS_INSTALL_LIB_DIR}/Athena.ico")
|
2016-03-04 23:00:12 +00:00
|
|
|
set(CONF_INCLUDE_DIR "\${ATHENA_CMAKE_DIR}/${REL_INCLUDE_DIR}/athena")
|
2015-07-08 23:53:40 +00:00
|
|
|
set(CONF_ICON_DIR "\${ATHENA_CMAKE_DIR}/${REL_ICON_DIR}")
|
2017-12-07 04:07:33 +00:00
|
|
|
configure_file(AthenaConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake" @ONLY)
|
2015-07-08 23:53:40 +00:00
|
|
|
# ... for both
|
2017-12-07 04:07:33 +00:00
|
|
|
configure_file(AthenaConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/AthenaConfigVersion.cmake" @ONLY)
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
# Install AthenaConfig.cmake
|
|
|
|
install(FILES
|
2017-12-07 04:07:33 +00:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/AthenaConfig.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/AthenaConfigVersion.cmake"
|
2016-03-04 23:00:12 +00:00
|
|
|
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
# Install the export set for use with the install-tree
|
2016-03-04 23:00:12 +00:00
|
|
|
install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT athena)
|
2015-07-10 23:44:31 +00:00
|
|
|
|
|
|
|
################
|
|
|
|
# atdna import #
|
|
|
|
################
|
|
|
|
|
2015-08-03 01:42:47 +00:00
|
|
|
add_subdirectory(atdna)
|
2020-10-21 04:22:22 +00:00
|
|
|
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2018-02-27 06:02:24 +00:00
|
|
|
# Test target
|
2019-06-12 01:58:44 +00:00
|
|
|
add_executable(atdna-test atdna/test.cpp atdna/test.hpp)
|
2018-09-25 22:38:11 +00:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL "Switch")
|
|
|
|
set_target_properties(atdna-test PROPERTIES SUFFIX ".elf")
|
2019-06-12 01:58:44 +00:00
|
|
|
target_link_libraries(atdna-test athena-core nx)
|
2018-09-25 22:38:11 +00:00
|
|
|
else()
|
2019-06-12 01:58:44 +00:00
|
|
|
target_link_libraries(atdna-test athena-core)
|
2015-10-16 08:07:54 +00:00
|
|
|
endif()
|
2021-04-08 20:18:20 +00:00
|
|
|
target_atdna(atdna-test atdna_test.cpp atdna/test.hpp)
|
2020-10-21 04:22:22 +00:00
|
|
|
endif()
|
2015-07-08 23:53:40 +00:00
|
|
|
|
|
|
|
#########
|
|
|
|
# CPack #
|
|
|
|
#########
|
|
|
|
|
2015-07-08 20:21:50 +00:00
|
|
|
include(InstallRequiredSystemLibraries)
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Athena")
|
2021-04-12 23:39:36 +00:00
|
|
|
set(CPACK_PACKAGE_VENDOR "AxioDL Team")
|
2015-07-08 20:21:50 +00:00
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
2015-07-08 23:53:40 +00:00
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${ATHENA_MAJOR_VERSION})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${ATHENA_MINOR_VERSION})
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${ATHENA_PATCH_VERSION})
|
2016-03-04 23:00:12 +00:00
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "athena")
|
2021-04-12 23:39:36 +00:00
|
|
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
|
|
|
|
|
2021-04-13 00:03:17 +00:00
|
|
|
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" ARCHITECTURE_NAME)
|
2021-04-12 23:39:36 +00:00
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
|
|
|
|
set(SYSTEM_NAME win32)
|
|
|
|
elseif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|
|
|
set(SYSTEM_NAME macos)
|
|
|
|
list(LENGTH CMAKE_OSX_ARCHITECTURES num_archs)
|
|
|
|
if (num_archs GREATER 1)
|
|
|
|
set(ARCHITECTURE_NAME universal)
|
|
|
|
elseif(num_archs EQUAL 1)
|
|
|
|
set(ARCHITECTURE_NAME ${CMAKE_OSX_ARCHITECTURES})
|
|
|
|
endif()
|
|
|
|
elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
|
|
set(SYSTEM_NAME linux)
|
|
|
|
else ()
|
|
|
|
set(SYSTEM_NAME "${CMAKE_SYSTEM_NAME}")
|
|
|
|
endif ()
|
2021-04-13 00:03:17 +00:00
|
|
|
set(CPACK_PACKAGE_FILE_NAME "athena-${SYSTEM_NAME}-${ARCHITECTURE_NAME}")
|
2021-04-12 23:39:36 +00:00
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set(CPACK_GENERATOR 7Z)
|
|
|
|
else ()
|
|
|
|
set(CPACK_GENERATOR TGZ)
|
|
|
|
endif ()
|
2015-07-08 20:21:50 +00:00
|
|
|
include(CPack)
|
2015-07-07 03:23:37 +00:00
|
|
|
|