mirror of https://github.com/libAthena/athena.git
Support for emscripten
This commit is contained in:
parent
c6046d9150
commit
fa346ace47
|
@ -1,8 +1,8 @@
|
||||||
# - Config file for the atdna package
|
# - Config file for the atdna package
|
||||||
|
|
||||||
# Compute paths
|
# Compute paths
|
||||||
get_filename_component(ATDNA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
get_filename_component(ATDNA_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||||
|
|
||||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||||
if(NOT TARGET atdna AND NOT atdna_BINARY_DIR)
|
if(NOT TARGET atdna AND NOT atdna_BINARY_DIR)
|
||||||
include("${ATDNA_CMAKE_DIR}/atdnaTargets.cmake")
|
include("${ATDNA_CMAKE_DIR}/atdnaTargets.cmake")
|
||||||
|
@ -26,7 +26,9 @@ function(atdna out)
|
||||||
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
get_property(incdirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||||
set(inccli "")
|
set(inccli "")
|
||||||
foreach(dir ${incdirs})
|
foreach(dir ${incdirs})
|
||||||
list(APPEND inccli "-I${dir}")
|
if (NOT dir MATCHES ".*emscripten.*")
|
||||||
|
list(APPEND inccli "-I${dir}")
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Get local defines for atdna
|
# Get local defines for atdna
|
||||||
|
|
|
@ -92,6 +92,18 @@ function(atdna out incdirs cdefs)
|
||||||
list(APPEND ins_impdeps ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
list(APPEND ins_impdeps ${CMAKE_CURRENT_SOURCE_DIR}/${arg})
|
||||||
endforeach()
|
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
|
# MS extra
|
||||||
unset(extraargs)
|
unset(extraargs)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
@ -124,8 +136,7 @@ function(atdna out incdirs cdefs)
|
||||||
# Use Ninja's DEPFILE parser in cooperation with atdna
|
# Use Ninja's DEPFILE parser in cooperation with atdna
|
||||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
|
ARGS ${extraargs} -o ${out_rel} -MD -MT ${out_rel} -MF ${out_rel}.d
|
||||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
${inccli} ${cdefcli}
|
||||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
|
||||||
"-I${athena_SOURCE_DIR}/include" ${ins}
|
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
DEPFILE "${CMAKE_CURRENT_BINARY_DIR}/${out}.d"
|
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
|
# Use CMake's built-in dependency scanner for makefile targets
|
||||||
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
add_custom_command(OUTPUT ${out} COMMAND $<TARGET_FILE:atdna>
|
||||||
ARGS ${extraargs} -o ${out_rel}
|
ARGS ${extraargs} -o ${out_rel}
|
||||||
"$<$<BOOL:${incdirs}>:-I$<JOIN:${incdirs},;-I>>"
|
${inccli} ${cdefcli}
|
||||||
"$<$<BOOL:${cdefs}>:-D$<JOIN:${cdefs},;-D>>"
|
|
||||||
"-I${athena_SOURCE_DIR}/include" ${ins}
|
"-I${athena_SOURCE_DIR}/include" ${ins}
|
||||||
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
DEPENDS atdna ${ins} IMPLICIT_DEPENDS ${ins_impdeps}
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
using mode_t = int;
|
using mode_t = int;
|
||||||
|
#else
|
||||||
|
#include <sys/stat.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace athena {
|
namespace athena {
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#endif
|
#endif
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#if defined(GEKKO) || defined(__SWITCH__)
|
#if defined(GEKKO) || defined(__SWITCH__) || defined(EMSCRIPTEN)
|
||||||
#include "gekko_support.h"
|
#include "gekko_support.h"
|
||||||
typedef struct stat atStat64_t;
|
typedef struct stat atStat64_t;
|
||||||
#define atStat64 stat
|
#define atStat64 stat
|
||||||
|
|
Loading…
Reference in New Issue