2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:04:56 +00:00

Use binary atdna, universal macOS fixes, more

This commit is contained in:
2021-04-13 10:42:01 -04:00
parent 4e38cf3574
commit 7d7db261a2
18 changed files with 479 additions and 278 deletions

View File

@@ -1,62 +1,9 @@
if(NOT CMAKE_CROSSCOMPILING)
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
cmake_policy(VERSION 3.15...3.20)
project(bintoc LANGUAGES C)
add_executable(bintoc bintoc.c)
target_include_directories(bintoc PRIVATE ${ZLIB_INCLUDE_DIR})
target_link_libraries(bintoc ${ZLIB_LIBRARIES})
function(bintoc out in sym)
if(IS_ABSOLUTE ${out})
set(theOut ${out})
else()
set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out})
endif()
if(IS_ABSOLUTE ${in})
set(theIn ${in})
else()
set(theIn ${CMAKE_CURRENT_SOURCE_DIR}/${in})
endif()
get_filename_component(outDir ${theOut} DIRECTORY)
file(MAKE_DIRECTORY ${outDir})
add_custom_command(OUTPUT ${theOut}
COMMAND $<TARGET_FILE:bintoc> ARGS ${theIn} ${theOut} ${sym}
DEPENDS ${theIn} bintoc)
endfunction()
function(bintoc_compress out in sym)
if(IS_ABSOLUTE ${out})
set(theOut ${out})
else()
set(theOut ${CMAKE_CURRENT_BINARY_DIR}/${out})
endif()
if(IS_ABSOLUTE ${in})
set(theIn ${in})
else()
set(theIn ${CMAKE_CURRENT_SOURCE_DIR}/${in})
endif()
get_filename_component(outDir ${theOut} DIRECTORY)
file(MAKE_DIRECTORY ${outDir})
add_custom_command(OUTPUT ${theOut}
COMMAND $<TARGET_FILE:bintoc> ARGS --compress ${theIn} ${theOut} ${sym}
DEPENDS ${theIn} bintoc)
endfunction()
find_package(ZLIB REQUIRED)
target_link_libraries(bintoc PRIVATE ZLIB::ZLIB)
##################
# Package Export #
##################
# Add all targets to the build-tree export set
export(TARGETS bintoc FILE "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocTargets.cmake")
# Export the package for use from the build-tree
# (this registers the build-tree with a global CMake-registry)
export(PACKAGE hecl-bintoc)
# Create the atdnaConfig.cmake
# ... for the build tree
configure_file(hecl-bintocConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocConfig.cmake" @ONLY)
# ... for the install tree
configure_file(hecl-bintocConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hecl-bintocConfig.cmake" @ONLY)
# ... for both
configure_file(hecl-bintocConfigVersion.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/hecl-bintocConfigVersion.cmake" @ONLY)
else()
# Use native if cross compiling
find_package(hecl-bintoc REQUIRED)
endif()
install(TARGETS bintoc DESTINATION bin)

View File

@@ -1,13 +1,3 @@
# - Config file for the bintoc package
# Compute paths
get_filename_component(BINTOC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
# Our library dependencies (contains definitions for IMPORTED targets)
if(NOT TARGET bintoc AND NOT bintoc_BINARY_DIR)
include("${BINTOC_CMAKE_DIR}/hecl-bintocTargets.cmake")
endif()
function(bintoc out in sym)
if(IS_ABSOLUTE ${out})
set(theOut ${out})
@@ -21,9 +11,10 @@ function(bintoc out in sym)
endif()
get_filename_component(outDir ${theOut} DIRECTORY)
file(MAKE_DIRECTORY ${outDir})
ExternalProject_Get_Property(bintoc INSTALL_DIR)
add_custom_command(OUTPUT ${theOut}
COMMAND $<TARGET_FILE:bintoc> ARGS ${theIn} ${theOut} ${sym}
DEPENDS ${theIn})
COMMAND "${INSTALL_DIR}/bin/bintoc" ARGS ${theIn} ${theOut} ${sym}
DEPENDS ${theIn} bintoc)
endfunction()
function(bintoc_compress out in sym)
@@ -39,7 +30,8 @@ function(bintoc_compress out in sym)
endif()
get_filename_component(outDir ${theOut} DIRECTORY)
file(MAKE_DIRECTORY ${outDir})
ExternalProject_Get_Property(bintoc INSTALL_DIR)
add_custom_command(OUTPUT ${theOut}
COMMAND $<TARGET_FILE:bintoc> ARGS --compress ${theIn} ${theOut} ${sym}
DEPENDS ${theIn})
COMMAND "${INSTALL_DIR}/bin/bintoc" ARGS --compress ${theIn} ${theOut} ${sym}
DEPENDS ${theIn} bintoc)
endfunction()

View File

@@ -1,12 +0,0 @@
set(PACKAGE_VERSION "@BINTOC_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()