Support for emscripten

This commit is contained in:
Luke Street 2022-08-03 18:16:30 -04:00
parent c6046d9150
commit fa346ace47
4 changed files with 22 additions and 8 deletions

View File

@ -1,8 +1,8 @@
# - Config file for the atdna package
# Compute paths
get_filename_component(ATDNA_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("${ATDNA_CMAKE_DIR}/atdnaTargets.cmake")
@ -26,7 +26,9 @@ function(atdna out)
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
set(inccli "")
foreach(dir ${incdirs})
list(APPEND inccli "-I${dir}")
if (NOT dir MATCHES ".*emscripten.*")
list(APPEND inccli "-I${dir}")
endif()
endforeach()
# Get local defines for atdna

View File

@ -92,6 +92,18 @@ function(atdna out incdirs cdefs)
list(APPEND ins_impdeps ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
endforeach()
set(inccli "")
foreach(dir ${incdirs})
if (NOT dir MATCHES ".*emscripten.*")
list(APPEND inccli "-I${dir}")
endif()
endforeach()
set(cdefcli "")
foreach(def ${cdefs})
list(APPEND cdefcli "-D${def}")
endforeach()
# MS extra
unset(extraargs)
if(MSVC)
@ -124,8 +136,7 @@ function(atdna out incdirs cdefs)
# Use Ninja's DEPFILE parser in cooperation with atdna
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
${inccli} ${cdefcli}
"-I${athena_SOURCE_DIR}/include" ${ins}
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
@ -136,8 +147,7 @@ function(atdna out incdirs cdefs)
# Use CMake's built-in dependency scanner for makefile targets
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
ARGS ${extraargs} -o ${out_rel}
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
${inccli} ${cdefcli}
"-I${athena_SOURCE_DIR}/include" ${ins}
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}

View File

@ -4,6 +4,8 @@
#if _WIN32
using mode_t = int;
#else
#include <sys/stat.h>
#endif
namespace athena {

View File

@ -47,7 +47,7 @@
#endif
// clang-format on
#if defined(GEKKO) || defined(__SWITCH__)
#if defined(GEKKO) || defined(__SWITCH__) || defined(EMSCRIPTEN)
#include "gekko_support.h"
typedef struct stat atStat64_t;
#define atStat64 stat