Browse Source

Build remove manual path searching

* Don't manually search for binaries on linux; let execvp() search
PATH for us
* Add Config_Linux.cake to fix hot-reloading script
* Comment cross-compilation test because it raises the minimum
requirements for new users (no longer need Mingw)
build-system-unification
Macoy Madson 5 months ago
parent
commit
2193012e5f
5 changed files with 10 additions and 53 deletions
  1. +2
    -2
      BuildAndRunTests.sh
  2. +2
    -3
      BuildHotReloadLib.sh
  3. +1
    -42
      src/Build.cpp
  4. +1
    -2
      src/Build.hpp
  5. +4
    -4
      src/ModuleManager.cpp

+ 2
- 2
BuildAndRunTests.sh View File

@ -20,8 +20,8 @@
runtime/Config_Linux.cake runtime/HotReloadingCodeModifier.cake runtime/TextAdventure.cake || exit $?
# TestMain is the loader. It doesn't care at all about fancy hot reloading macros, it just loads libs
./bin/cakelisp \
runtime/Config_Windows.cake runtime/HotLoader.cake || exit $?
# ./bin/cakelisp \
# runtime/Config_Windows.cake runtime/HotLoader.cake || exit $?
./bin/cakelisp \
runtime/Config_Linux.cake runtime/HotLoader.cake || exit $?


+ 2
- 3
BuildHotReloadLib.sh View File

@ -1,5 +1,4 @@
#!/bin/sh
jam -j4 || exit $?
./bin/cakelisp --verbose-processes --verbose-file-search \
runtime/HotReloadingCodeModifier.cake runtime/TextAdventure.cake
./bin/cakelisp \
runtime/Config_Linux.cake runtime/HotReloadingCodeModifier.cake runtime/TextAdventure.cake

+ 1
- 42
src/Build.cpp View File

@ -127,48 +127,7 @@ bool resolveExecutablePath(const char* fileToExecute, char* resolvedPathOut,
}
#endif
#ifdef UNIX
if (fileToExecute[0] == '/' || fileToExecute[0] == '.')
{
SafeSnprintf(resolvedPathOut, resolvedPathOutSize, "%s", fileToExecute);
if (!fileExists(resolvedPathOut))
{
Logf(
"error: failed to find '%s'. Checked exact path because it is directory-relative "
"or absolute\n",
fileToExecute);
return false;
}
}
else
{
// TODO: Use PATH environment variable instead
const char* pathsToCheck[] = {"/usr/local/sbin", "/usr/local/bin", "/usr/sbin",
"/usr/bin", "/sbin", "/bin"};
bool found = false;
for (int i = 0; i < ArraySize(pathsToCheck); ++i)
{
SafeSnprintf(resolvedPathOut, resolvedPathOutSize, "%s/%s", pathsToCheck[i],
fileToExecute);
if (fileExists(resolvedPathOut))
{
found = true;
break;
}
}
if (!found)
{
Logf("error: failed to find '%s'. Checked the following paths:\n", fileToExecute);
for (int i = 0; i < ArraySize(pathsToCheck); ++i)
Logf("\t%s\n", pathsToCheck[i]);
return false;
}
}
return true;
#endif
// Unix searches PATH automatically, thanks to the 'p' of execvp()
SafeSnprintf(resolvedPathOut, resolvedPathOutSize, "%s", fileToExecute);
return true;


+ 1
- 2
src/Build.hpp View File

@ -13,7 +13,6 @@ void makeDynamicLibraryOutputArgument(char* buffer, int bufferSize, const char*
const char* buildExecutable);
// On Windows, extra work is done to find the compiler and linker executables. This function handles
// looking up those environment variables to determine which executable to use. On Linux, this
// function might be a good place for executable search paths, e.g. check /usr/bin for g++
// looking up those environment variables to determine which executable to use
bool resolveExecutablePath(const char* fileToExecute, char* resolvedPathOut,
int resolvedPathOutSize);

+ 4
- 4
src/ModuleManager.cpp View File

@ -127,7 +127,7 @@ void moduleManagerInitialize(ModuleManager& manager)
{ProcessCommandArgumentType_ObjectInput, EmptyString}};
#else
// G++ by default
manager.environment.compileTimeBuildCommand.fileToExecute = "/usr/bin/g++";
manager.environment.compileTimeBuildCommand.fileToExecute = "g++";
manager.environment.compileTimeBuildCommand.arguments = {
{ProcessCommandArgumentType_String, "-g"},
{ProcessCommandArgumentType_String, "-c"},
@ -137,14 +137,14 @@ void moduleManagerInitialize(ModuleManager& manager)
{ProcessCommandArgumentType_CakelispHeadersInclude, EmptyString},
{ProcessCommandArgumentType_String, "-fPIC"}};
manager.environment.compileTimeLinkCommand.fileToExecute = "/usr/bin/g++";
manager.environment.compileTimeLinkCommand.fileToExecute = "g++";
manager.environment.compileTimeLinkCommand.arguments = {
{ProcessCommandArgumentType_String, "-shared"},
{ProcessCommandArgumentType_String, "-o"},
{ProcessCommandArgumentType_DynamicLibraryOutput, EmptyString},
{ProcessCommandArgumentType_ObjectInput, EmptyString}};
manager.environment.buildTimeBuildCommand.fileToExecute = "/usr/bin/g++";
manager.environment.buildTimeBuildCommand.fileToExecute = "g++";
manager.environment.buildTimeBuildCommand.arguments = {
{ProcessCommandArgumentType_String, "-g"},
{ProcessCommandArgumentType_String, "-c"},
@ -157,7 +157,7 @@ void moduleManagerInitialize(ModuleManager& manager)
{ProcessCommandArgumentType_IncludeSearchDirs, EmptyString},
{ProcessCommandArgumentType_AdditionalOptions, EmptyString}};
manager.environment.buildTimeLinkCommand.fileToExecute = "/usr/bin/g++";
manager.environment.buildTimeLinkCommand.fileToExecute = "g++";
manager.environment.buildTimeLinkCommand.arguments = {
{ProcessCommandArgumentType_String, "-o"},
{ProcessCommandArgumentType_ExecutableOutput, EmptyString},


Loading…
Cancel
Save