rez include paths

This commit is contained in:
Wolfgang Thaller 2021-11-25 00:40:36 +01:00
parent 273f7eacba
commit c0dbb90b0b
3 changed files with 36 additions and 2 deletions

View File

@ -136,6 +136,18 @@ int main(int argc, const char *argv[])
for(std::string path : options["include"].as<std::vector<std::string>>())
lexer.addIncludePath(path);
if(const char *path = getenv("REZ_INCLUDE_PATH"))
{
while(const char* end = strchr(path, ':'))
{
if(end != path)
lexer.addIncludePath(std::string(path, end));
path = end + 1;
}
if(*path)
lexer.addIncludePath(path);
}
if(world.verboseFlag)
{
std::cerr << "Compiling " << fn << "...\n";

View File

@ -23,11 +23,15 @@ function(add_application name)
set(files)
set(rsrc_files)
set(rez_files)
set(rez_include_options ${REZ_INCLUDE_PATH})
list(TRANSFORM rez_include_options PREPEND -I)
foreach(f ${ARGS_FILES})
if(${f} MATCHES "\\.r$")
add_custom_command(
OUTPUT ${f}.rsrc.bin
COMMAND ${REZ} ${REZ_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${f} -I ${REZ_INCLUDE_PATH} -o ${f}.rsrc.bin
COMMAND ${REZ} ${REZ_FLAGS} ${CMAKE_CURRENT_SOURCE_DIR}/${f} ${rez_include_options} -o ${f}.rsrc.bin
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${f})
list(APPEND rsrc_files "${CMAKE_CURRENT_BINARY_DIR}/${f}.rsrc.bin")
list(APPEND rez_files "${f}")

View File

@ -241,7 +241,6 @@
set(CMAKE_CROSSCOMPILING TRUE)
set( REZ "${pkgs.buildPackages.retro68_tools}/bin/Rez" )
set( REZ_INCLUDE_PATH "${pkgs.multiversal}/RIncludes" )
include(${self + "/cmake/add_application.cmake"})
'';
@ -250,6 +249,25 @@
name = "retro68_setup_hook";
text = ''
export CMAKE_TOOLCHAIN_FILE=${toolchain}
retro68_addRIncludes() {
echo "retro68_addRIncludes: $1 $depHostOffset"
case $depHostOffset in
-1) local role='BUILD_' ;;
0) local role="" ;;
1) local role='TARGET_' ;;
*) echo "retro68_addRIncludes: Error: Cannot be used with $depHostOffset-offset deps" >2;
return 1 ;;
esac
if [[ -d "$1/RIncludes" ]]; then
export REZ_INCLUDE_PATH+=":$1/RIncludes"
fi
}
echo "targetOffset: $targetOffset"
addEnvHooks "$targetOffset" retro68_addRIncludes
'' + (pkgs.lib.optionalString (systemName == "Retro68") ''
export RETRO68_LD_WRAPPER_Retro68="${pkgs.buildPackages.retro68_tools}/bin/Elf2Mac"
export RETRO68_REAL_LD="${pkgs.buildPackages.retro68_binutils}/bin/m68k-apple-macos-ld.real"