diff --git a/examples/prime/project.yml b/examples/prime/project.yml index a5c1099f..48bd6ce7 100644 --- a/examples/prime/project.yml +++ b/examples/prime/project.yml @@ -8,6 +8,6 @@ ldflags: | -L/usr/lib/x86_64-linux-gnu/ -lssl sources: - - php-src + - php-src* - ./cpp-src - main.php \ No newline at end of file diff --git a/src/Php/Translator.php b/src/Php/Translator.php index 5aae2c7e..51b3fb3d 100644 --- a/src/Php/Translator.php +++ b/src/Php/Translator.php @@ -176,13 +176,18 @@ class Translator extends Preprocessor foreach ($sources as $src) { $src = trim($src); if ($src[0] != '/') { - $src = $projectDir . '/' . $src; + $absPath = $projectDir . '/' . $src; + } else { + $absPath = $src; + } + $realPath = realpath($absPath); + if (!$realPath) { + $this->error('Source file not exists: `' . $src . '`'); } - $src = realpath($src); - if (is_file($src)) { - $list[] = $src; + if (is_file($realPath)) { + $list[] = $realPath; } else { - $tmp = $this->getFilesFromDir($src); + $tmp = $this->getFilesFromDir($realPath); $list = array_merge($list, $tmp); } } @@ -190,10 +195,18 @@ class Translator extends Preprocessor $list = $this->getFilesFromDir($projectDir); } if (!empty($cfg['cxxflags'])) { - $this->cxxflags = str_replace("\n", " ", $cfg['cxxflags']); + if (is_array($cfg['cxxflags'])) { + $this->cxxflags = implode(' ', $cfg['cxxflags']); + } else { + $this->cxxflags = str_replace("\n", " ", $cfg['cxxflags']); + } } if (!empty($cfg['ldflags'])) { - $this->ldflags = str_replace("\n", " ", $cfg['ldflags']); + if (is_array($cfg['ldflags'])) { + $this->ldflags = implode(' ', $cfg['ldflags']); + } else { + $this->ldflags = str_replace("\n", " ", $cfg['ldflags']); + } } if (!empty($cfg['name'])) { $this->setTargetName($cfg['name']);