mirror of https://github.com/libAthena/athena.git
Embedded atdna in Athena
This commit is contained in:
parent
3edc800e10
commit
7a90a0f6d0
|
@ -218,9 +218,7 @@ install(EXPORT AthenaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT Athena)
|
||||||
# atdna import #
|
# atdna import #
|
||||||
################
|
################
|
||||||
|
|
||||||
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/atdna/CMakeLists.txt")
|
|
||||||
add_subdirectory(atdna)
|
add_subdirectory(atdna)
|
||||||
endif()
|
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# CPack #
|
# CPack #
|
||||||
|
|
5
PKGBUILD
5
PKGBUILD
|
@ -1,11 +1,10 @@
|
||||||
# PKGBUILD for libAthena
|
# PKGBUILD for libAthena
|
||||||
_pkgname=libathena
|
_pkgname=libathena
|
||||||
pkgname=$_pkgname-git
|
pkgname=$_pkgname-git
|
||||||
pkgver=2.2.0.8.g2490fef
|
pkgver=2.3.0
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="Basic cross platform IO library"
|
pkgdesc="Basic cross platform IO library"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
source=("${pkgname%-*}::git+https://github.com/libAthena/Athena.git#branch=yaml")
|
source=("${pkgname%-*}::git+https://github.com/libAthena/Athena.git")
|
||||||
options=(staticlibs)
|
options=(staticlibs)
|
||||||
license="MIT"
|
license="MIT"
|
||||||
makedepends=('git cmake sed')
|
makedepends=('git cmake sed')
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
###############
|
||||||
|
# ATDNA Build #
|
||||||
|
###############
|
||||||
|
|
||||||
|
# Find dependencies
|
||||||
|
include(FindLLVM.cmake)
|
||||||
|
if(NOT LLVM_FOUND)
|
||||||
|
message("-- Unable to locate LLVM installation; skipping atdna")
|
||||||
|
else()
|
||||||
|
list(APPEND LLVM_LIBS
|
||||||
|
clangFrontend
|
||||||
|
clangTooling
|
||||||
|
clangDriver
|
||||||
|
clangSerialization
|
||||||
|
clangParse
|
||||||
|
clangSema
|
||||||
|
clangAnalysis
|
||||||
|
clangEdit
|
||||||
|
clangAST
|
||||||
|
clangLex
|
||||||
|
clangBasic
|
||||||
|
LLVMOption
|
||||||
|
LLVMMCParser
|
||||||
|
LLVMBitReader
|
||||||
|
LLVMMC
|
||||||
|
LLVMSupport)
|
||||||
|
set(CLANG_INCLUDE_DIR ${LLVM_LIBRARY_DIRS}/clang/${LLVM_VERSION_STRING}/include)
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
list(APPEND PLAT_LIBS z pthread curses dl)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Offer the user the choice of overriding the installation directories
|
||||||
|
set(INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
|
||||||
|
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
||||||
|
if(WIN32 AND NOT CYGWIN)
|
||||||
|
set(INSTALL_CMAKE_DIR cmake)
|
||||||
|
else()
|
||||||
|
set(INSTALL_CMAKE_DIR lib/cmake/atdna)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Make relative paths absolute (needed later on)
|
||||||
|
foreach(p BIN INCLUDE CMAKE)
|
||||||
|
set(var INSTALL_${p}_DIR)
|
||||||
|
if(NOT IS_ABSOLUTE "${${var}}")
|
||||||
|
set(ABS_${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||||||
|
else()
|
||||||
|
set(ABS_${var} "${${var}}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Icon
|
||||||
|
set(ATHENA_ICO ${CMAKE_CURRENT_SOURCE_DIR}/Athena.ico)
|
||||||
|
|
||||||
|
# Windows resource
|
||||||
|
if(WIN32)
|
||||||
|
configure_file(main.rc.in main.rc @ONLY)
|
||||||
|
set(PLAT_SRCS ${CMAKE_CURRENT_BINARY_DIR}/main.rc)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ATDNA target
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
|
include_directories(${LLVM_INCLUDE_DIRS})
|
||||||
|
link_directories(${LLVM_LIBRARY_DIRS})
|
||||||
|
add_executable(atdna main.cpp test.hpp ${PLAT_SRCS})
|
||||||
|
target_link_libraries(atdna ${LLVM_LIBS} ${PLAT_LIBS})
|
||||||
|
set_source_files_properties(main.cpp PROPERTIES COMPILE_DEFINITIONS
|
||||||
|
"INSTALL_PREFIX=${ABS_INSTALL_BIN_DIR};__STDC_LIMIT_MACROS=1;__STDC_CONSTANT_MACROS=1")
|
||||||
|
if(MSVC)
|
||||||
|
set_target_properties(atdna PROPERTIES
|
||||||
|
COMPILE_FLAGS "/GR-")
|
||||||
|
else()
|
||||||
|
set_target_properties(atdna PROPERTIES
|
||||||
|
COMPILE_FLAGS "-std=c++11 -fno-rtti -Wno-unused-parameter"
|
||||||
|
LINK_FLAGS -std=c++11)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Define installs
|
||||||
|
install(TARGETS atdna DESTINATION ${INSTALL_BIN_DIR} EXPORT atdnaTargets COMPONENT atdna)
|
||||||
|
install(DIRECTORY ${CLANG_INCLUDE_DIR}/ DESTINATION ${INSTALL_INCLUDE_DIR}/Athena/clang COMPONENT atdna)
|
||||||
|
|
||||||
|
##################
|
||||||
|
# Package Export #
|
||||||
|
##################
|
||||||
|
|
||||||
|
# Add all targets to the build-tree export set
|
||||||
|
export(TARGETS atdna FILE "${PROJECT_BINARY_DIR}/atdnaTargets.cmake")
|
||||||
|
|
||||||
|
# Export the package for use from the build-tree
|
||||||
|
# (this registers the build-tree with a global CMake-registry)
|
||||||
|
export(PACKAGE atdna)
|
||||||
|
|
||||||
|
# Create the atdnaConfig.cmake
|
||||||
|
# ... for the build tree
|
||||||
|
set(CONF_CLANG_INCLUDE_DIR "${CLANG_INCLUDE_DIR}")
|
||||||
|
configure_file(atdnaConfig.cmake.in "${PROJECT_BINARY_DIR}/atdnaConfig.cmake" @ONLY)
|
||||||
|
# ... for the install tree
|
||||||
|
set(CONF_CLANG_INCLUDE_DIR "\${ATHENA_INCLUDE_DIR}/clang")
|
||||||
|
configure_file(atdnaConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atdnaConfig.cmake" @ONLY)
|
||||||
|
# ... for both
|
||||||
|
configure_file(atdnaConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/atdnaConfigVersion.cmake" @ONLY)
|
||||||
|
|
||||||
|
# Install atdnaConfig.cmake
|
||||||
|
install(FILES
|
||||||
|
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atdnaConfig.cmake"
|
||||||
|
"${PROJECT_BINARY_DIR}/atdnaConfigVersion.cmake"
|
||||||
|
DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna)
|
||||||
|
|
||||||
|
# Install the export set for use with the install-tree
|
||||||
|
install(EXPORT atdnaTargets DESTINATION ${INSTALL_CMAKE_DIR} COMPONENT atdna)
|
||||||
|
|
||||||
|
#########
|
||||||
|
# CTest #
|
||||||
|
#########
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(NAME test-dna COMMAND $<TARGET_FILE:atdna> -o test.cpp
|
||||||
|
"-I${ATHENA_INCLUDE_DIR}" -isystem "${CLANG_INCLUDE_DIR}"
|
||||||
|
${CMAKE_SOURCE_DIR}/test.hpp)
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
|
@ -0,0 +1,205 @@
|
||||||
|
# - Find LLVM headers and libraries.
|
||||||
|
# This module locates LLVM and adapts the llvm-config output for use with
|
||||||
|
# CMake.
|
||||||
|
#
|
||||||
|
# A given list of COMPONENTS is passed to llvm-config.
|
||||||
|
#
|
||||||
|
# The following variables are defined:
|
||||||
|
# LLVM_FOUND - true if LLVM was found
|
||||||
|
# LLVM_CXXFLAGS - C++ compiler flags for files that include LLVM headers.
|
||||||
|
# LLVM_HOST_TARGET - Target triple used to configure LLVM.
|
||||||
|
# LLVM_INCLUDE_DIRS - Directory containing LLVM include files.
|
||||||
|
# LLVM_LDFLAGS - Linker flags to add when linking against LLVM
|
||||||
|
# (includes -LLLVM_LIBRARY_DIRS).
|
||||||
|
# LLVM_LIBRARIES - Full paths to the library files to link against.
|
||||||
|
# LLVM_LIBRARY_DIRS - Directory containing LLVM libraries.
|
||||||
|
# LLVM_ROOT_DIR - The root directory of the LLVM installation.
|
||||||
|
# llvm-config is searched for in ${LLVM_ROOT_DIR}/bin.
|
||||||
|
# LLVM_VERSION_MAJOR - Major version of LLVM.
|
||||||
|
# LLVM_VERSION_MINOR - Minor version of LLVM.
|
||||||
|
# LLVM_VERSION_STRING - Full LLVM version string (e.g. 2.9).
|
||||||
|
#
|
||||||
|
# Note: The variable names were chosen in conformance with the offical CMake
|
||||||
|
# guidelines, see ${CMAKE_ROOT}/Modules/readme.txt.
|
||||||
|
|
||||||
|
# Try suffixed versions to pick up the newest LLVM install available on Debian
|
||||||
|
# derivatives.
|
||||||
|
# We also want an user-specified LLVM_ROOT_DIR to take precedence over the
|
||||||
|
# system default locations such as /usr/local/bin. Executing find_program()
|
||||||
|
# multiples times is the approach recommended in the docs.
|
||||||
|
set(LLVM_FIND_COMPONENTS "")
|
||||||
|
if(WIN32)
|
||||||
|
get_filename_component(LLVM_ROOT_DIR [HKEY_LOCAL_MACHINE\\Software\\LLVM\\LLVM] ABSOLUTE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(llvm_config_names llvm-config-3.7 llvm-config37
|
||||||
|
llvm-config-3.6 llvm-config36
|
||||||
|
llvm-config-3.5 llvm-config35
|
||||||
|
llvm-config-3.4 llvm-config34
|
||||||
|
llvm-config-3.3 llvm-config33
|
||||||
|
llvm-config-3.2 llvm-config32
|
||||||
|
llvm-config-3.1 llvm-config31 llvm-config)
|
||||||
|
find_program(LLVM_CONFIG
|
||||||
|
NAMES ${llvm_config_names}
|
||||||
|
PATHS ${LLVM_ROOT_DIR}/bin NO_DEFAULT_PATH
|
||||||
|
DOC "Path to llvm-config tool.")
|
||||||
|
find_program(LLVM_CONFIG NAMES ${llvm_config_names})
|
||||||
|
|
||||||
|
if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
|
||||||
|
if (WIN32)
|
||||||
|
# A bit of a sanity check:
|
||||||
|
if( NOT EXISTS ${LLVM_ROOT_DIR}/include/llvm )
|
||||||
|
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
|
||||||
|
endif()
|
||||||
|
# We incorporate the CMake features provided by LLVM:
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT_DIR}/share/llvm/cmake")
|
||||||
|
include(LLVMConfig)
|
||||||
|
# Set properties
|
||||||
|
set(LLVM_HOST_TARGET ${TARGET_TRIPLE})
|
||||||
|
set(LLVM_VERSION_STRING ${LLVM_PACKAGE_VERSION})
|
||||||
|
set(LLVM_CXXFLAGS ${LLVM_DEFINITIONS})
|
||||||
|
set(LLVM_LDFLAGS "")
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "all-targets" index)
|
||||||
|
list(APPEND LLVM_FIND_COMPONENTS ${LLVM_TARGETS_TO_BUILD})
|
||||||
|
# Work around LLVM bug 21016
|
||||||
|
list(FIND LLVM_TARGETS_TO_BUILD "X86" TARGET_X86)
|
||||||
|
if(TARGET_X86 GREATER -1)
|
||||||
|
list(APPEND LLVM_FIND_COMPONENTS x86utils)
|
||||||
|
endif()
|
||||||
|
# Similar to the work around above, but for AArch64
|
||||||
|
list(FIND LLVM_TARGETS_TO_BUILD "AArch64" TARGET_AArch64)
|
||||||
|
if(TARGET_AArch64 GREATER -1)
|
||||||
|
list(APPEND LLVM_FIND_COMPONENTS AArch64Utils)
|
||||||
|
endif()
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "backend" index)
|
||||||
|
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
||||||
|
# Versions below 3.3 do not support components objcarcopts, option
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
||||||
|
endif()
|
||||||
|
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||||
|
# Versions below 3.5 do not support components lto, profiledata
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
||||||
|
endif()
|
||||||
|
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
|
||||||
|
# Versions below 3.7 do not support components debuginfodwarf
|
||||||
|
# Only debuginfo is available
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
|
||||||
|
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||||
|
llvm_map_components_to_libraries(tmplibs ${LLVM_FIND_COMPONENTS})
|
||||||
|
else()
|
||||||
|
llvm_map_components_to_libnames(tmplibs ${LLVM_FIND_COMPONENTS})
|
||||||
|
endif()
|
||||||
|
if(MSVC)
|
||||||
|
foreach(lib ${tmplibs})
|
||||||
|
list(APPEND LLVM_LIBRARIES "${LLVM_LIBRARY_DIRS}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
# Rely on the library search path being set correctly via -L on
|
||||||
|
# MinGW and others, as the library list returned by
|
||||||
|
# llvm_map_components_to_libraries also includes imagehlp and psapi.
|
||||||
|
set(LLVM_LDFLAGS "-L${LLVM_LIBRARY_DIRS}")
|
||||||
|
set(LLVM_LIBRARIES ${tmplibs})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# When using the CMake LLVM module, LLVM_DEFINITIONS is a list
|
||||||
|
# instead of a string. Later, the list seperators would entirely
|
||||||
|
# disappear, replace them by spaces instead. A better fix would be
|
||||||
|
# to switch to add_definitions() instead of throwing strings around.
|
||||||
|
string(REPLACE ";" " " LLVM_CXXFLAGS "${LLVM_CXXFLAGS}")
|
||||||
|
else()
|
||||||
|
if (NOT FIND_LLVM_QUIETLY)
|
||||||
|
message(WARNING "Could not find llvm-config. Try manually setting LLVM_ROOT_DIR to the prebuilt LLVM prefix to use.")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
macro(llvm_set var flag)
|
||||||
|
if(LLVM_FIND_QUIETLY)
|
||||||
|
set(_quiet_arg ERROR_QUIET)
|
||||||
|
endif()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${LLVM_CONFIG} --${flag}
|
||||||
|
OUTPUT_VARIABLE LLVM_${var}
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
${_quiet_arg}
|
||||||
|
)
|
||||||
|
if(${ARGV2})
|
||||||
|
file(TO_CMAKE_PATH "${LLVM_${var}}" LLVM_${var})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
macro(llvm_set_libs var flag prefix)
|
||||||
|
if(LLVM_FIND_QUIETLY)
|
||||||
|
set(_quiet_arg ERROR_QUIET)
|
||||||
|
endif()
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${LLVM_CONFIG} --${flag} ${LLVM_FIND_COMPONENTS}
|
||||||
|
OUTPUT_VARIABLE tmplibs
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
${_quiet_arg}
|
||||||
|
)
|
||||||
|
file(TO_CMAKE_PATH "${tmplibs}" tmplibs)
|
||||||
|
string(REGEX REPLACE "([$^.[|*+?()]|])" "\\\\\\1" pattern "${prefix}/")
|
||||||
|
string(REGEX MATCHALL "${pattern}[^ ]+" LLVM_${var} ${tmplibs})
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
llvm_set(VERSION_STRING version)
|
||||||
|
llvm_set(CXXFLAGS cxxflags)
|
||||||
|
llvm_set(HOST_TARGET host-target)
|
||||||
|
llvm_set(INCLUDE_DIRS includedir true)
|
||||||
|
llvm_set(ROOT_DIR prefix true)
|
||||||
|
|
||||||
|
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-2][\\.0-9A-Za-z]*")
|
||||||
|
# Versions below 3.3 do not support components objcarcopts, option
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "objcarcopts" index)
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "option" index)
|
||||||
|
endif()
|
||||||
|
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||||
|
# Versions below 3.5 do not support components lto, profiledata
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "lto" index)
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "profiledata" index)
|
||||||
|
endif()
|
||||||
|
if(${LLVM_VERSION_STRING} MATCHES "^3\\.[0-6][\\.0-9A-Za-z]*")
|
||||||
|
# Versions below 3.7 do not support components debuginfodwarf
|
||||||
|
# Only debuginfo is available
|
||||||
|
list(REMOVE_ITEM LLVM_FIND_COMPONENTS "debuginfodwarf" index)
|
||||||
|
list(APPEND LLVM_FIND_COMPONENTS "debuginfo")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
llvm_set(LDFLAGS ldflags)
|
||||||
|
if(NOT ${LLVM_VERSION_STRING} MATCHES "^3\\.[0-4][\\.0-9A-Za-z]*")
|
||||||
|
# In LLVM 3.5+, the system library dependencies (e.g. "-lz") are accessed
|
||||||
|
# using the separate "--system-libs" flag.
|
||||||
|
llvm_set(SYSTEM_LIBS system-libs)
|
||||||
|
string(REPLACE "\n" " " LLVM_LDFLAGS "${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBS}")
|
||||||
|
endif()
|
||||||
|
llvm_set(LIBRARY_DIRS libdir true)
|
||||||
|
llvm_set_libs(LIBRARIES libfiles "${LLVM_LIBRARY_DIRS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# On CMake builds of LLVM, the output of llvm-config --cxxflags does not
|
||||||
|
# include -fno-rtti, leading to linker errors. Be sure to add it.
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"))
|
||||||
|
if(NOT ${LLVM_CXXFLAGS} MATCHES "-fno-rtti")
|
||||||
|
set(LLVM_CXXFLAGS "${LLVM_CXXFLAGS} -fno-rtti")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REGEX REPLACE "([0-9]+).*" "\\1" LLVM_VERSION_MAJOR "${LLVM_VERSION_STRING}" )
|
||||||
|
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*[A-Za-z]*" "\\1" LLVM_VERSION_MINOR "${LLVM_VERSION_STRING}" )
|
||||||
|
|
||||||
|
# Use the default CMake facilities for handling QUIET/REQUIRED.
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
if(${CMAKE_VERSION} VERSION_LESS "2.8.4")
|
||||||
|
# The VERSION_VAR argument is not supported on pre-2.8.4, work around this.
|
||||||
|
set(VERSION_VAR dummy)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package_handle_standard_args(LLVM
|
||||||
|
REQUIRED_VARS LLVM_ROOT_DIR LLVM_HOST_TARGET
|
||||||
|
VERSION_VAR LLVM_VERSION_STRING)
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# atdna
|
||||||
|
[User Overview](http://libAthena.github.io/doc/atdna.html)
|
||||||
|
[DNA Record Reference](http://libAthena.github.io/doc/atdna-ref.html)
|
|
@ -0,0 +1,52 @@
|
||||||
|
# - Config file for the atdna package
|
||||||
|
|
||||||
|
# Compute paths
|
||||||
|
get_filename_component(ATHENA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
|
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||||
|
if(NOT TARGET atdna AND NOT atdna_BINARY_DIR)
|
||||||
|
include("${ATHENA_CMAKE_DIR}/atdnaTargets.cmake")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find Athena
|
||||||
|
find_package(Athena REQUIRED)
|
||||||
|
|
||||||
|
# Super handy macro for adding atdna target
|
||||||
|
macro(atdna out)
|
||||||
|
# Make input files source-relative
|
||||||
|
set(ins "")
|
||||||
|
foreach(arg ${ARGN})
|
||||||
|
list(APPEND ins ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Get local include directories for atdna
|
||||||
|
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||||
|
set(inccli "")
|
||||||
|
foreach(dir ${incdirs})
|
||||||
|
list(APPEND inccli "-I${dir}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Get local defines for atdna
|
||||||
|
get_property(cdefs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
|
||||||
|
set(cdefcli "")
|
||||||
|
foreach(def ${cdefs})
|
||||||
|
list(APPEND cdefcli "-D${def}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# MS extra
|
||||||
|
unset(extraargs)
|
||||||
|
if(MSVC)
|
||||||
|
list(APPEND extraargs -fms-compatibility -fexceptions)
|
||||||
|
if(MSVC_VERSION EQUAL 1800)
|
||||||
|
list(APPEND extraargs -fms-compatibility-version=18.00)
|
||||||
|
elseif(MSVC_VERSION EQUAL 1900)
|
||||||
|
list(APPEND extraargs -fms-compatibility-version=19.00)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Make target
|
||||||
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
|
ARGS ${extraargs} -o ${out} ${cdefcli} ${inccli} "-I${ATHENA_INCLUDE_DIR}" -isystem "@CONF_CLANG_INCLUDE_DIR@" ${ins}
|
||||||
|
DEPENDS ${ins} COMMENT "Generating DNA ${out}")
|
||||||
|
endmacro()
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
set(PACKAGE_VERSION "@ATDNA_VERSION@")
|
||||||
|
|
||||||
|
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||||
|
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||||
|
else()
|
||||||
|
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||||
|
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||||
|
set(PACKAGE_VERSION_EXACT TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,32 @@
|
||||||
|
#include "winver.h"
|
||||||
|
|
||||||
|
IDI_ICON1 ICON DISCARDABLE "@ATHENA_ICO@"
|
||||||
|
|
||||||
|
VS_VERSION_INFO VERSIONINFO
|
||||||
|
FILEVERSION @ATDNA_MAJOR_VERSION@,@ATDNA_MINOR_VERSION@,@ATDNA_PATCH_VERSION@,0
|
||||||
|
PRODUCTVERSION @ATDNA_MAJOR_VERSION@,@ATDNA_MINOR_VERSION@,@ATDNA_PATCH_VERSION@,0
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
FILEOS 0x00040004L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "000004b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "Jackoalan / Antidote"
|
||||||
|
VALUE "FileDescription", "ATDNA"
|
||||||
|
VALUE "FileVersion", "@ATDNA_MAJOR_VERSION@.@ATDNA_MINOR_VERSION@.@ATDNA_PATCH_VERSION@"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) 2015 Jackoalan / Antidote"
|
||||||
|
VALUE "InternalName", "atdna"
|
||||||
|
VALUE "OriginalFilename", "atdna.exe"
|
||||||
|
VALUE "ProductName", "ATDNA"
|
||||||
|
VALUE "ProductVersion", "@ATDNA_MAJOR_VERSION@.@ATDNA_MINOR_VERSION@.@ATDNA_PATCH_VERSION@"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x0, 1200
|
||||||
|
END
|
||||||
|
END
|
|
@ -0,0 +1,75 @@
|
||||||
|
#include <Athena/DNAYaml.hpp>
|
||||||
|
|
||||||
|
using namespace Athena;
|
||||||
|
typedef io::DNAYaml<BigEndian> BigDNA;
|
||||||
|
|
||||||
|
struct TESTSubFile : public BigDNA
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
DECL_YAML
|
||||||
|
Value<atUint32> sub1;
|
||||||
|
Value<atUint32> sub2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TESTSubClassFile : public TESTSubFile
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
DECL_YAML
|
||||||
|
Value<atUint32> sub3;
|
||||||
|
Value<atUint32> sub4;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TESTSubSubClassFile : public TESTSubClassFile
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
DECL_YAML
|
||||||
|
Value<atUint32> sub5;
|
||||||
|
Value<atUint32> sub6;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TESTFile : public BigDNA
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
DECL_YAML
|
||||||
|
Value<bool> varBool;
|
||||||
|
Value<atUint32> var32;
|
||||||
|
Value<atUint16> var16;
|
||||||
|
Value<atVec3f> vec3;
|
||||||
|
Value<atVec4f> vec4;
|
||||||
|
|
||||||
|
struct TESTNestedSubFile : public BigDNA
|
||||||
|
{
|
||||||
|
DECL_DNA
|
||||||
|
DECL_YAML
|
||||||
|
Value<atUint32> nestSub1;
|
||||||
|
Value<atUint32> nestSub2;
|
||||||
|
} nestedSubFile;
|
||||||
|
|
||||||
|
TESTSubFile subFile;
|
||||||
|
|
||||||
|
Align<4> align;
|
||||||
|
|
||||||
|
struct TESTExplicitSubFile : public BigDNA
|
||||||
|
{
|
||||||
|
DECL_EXPLICIT_DNA
|
||||||
|
DECL_YAML
|
||||||
|
Value<atUint32> explSub1;
|
||||||
|
Value<atUint32> explSub2;
|
||||||
|
} explSubFile;
|
||||||
|
|
||||||
|
Value<atUint32> arrCount[2];
|
||||||
|
Vector<atUint32, DNA_COUNT(arrCount[0])> array;
|
||||||
|
|
||||||
|
Seek<21, Current> seek;
|
||||||
|
|
||||||
|
Value<atUint32> arrCount2;
|
||||||
|
Vector<TESTSubFile, DNA_COUNT(arrCount[1] + arrCount2)> array2;
|
||||||
|
|
||||||
|
Value<atUint32> bufSz;
|
||||||
|
Buffer<DNA_COUNT(bufSz)> buf;
|
||||||
|
|
||||||
|
String<32> str;
|
||||||
|
WString<64> wstr;
|
||||||
|
WStringAsString<> utf8str[5];
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue