aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CmakeModule.cpp20
-rw-r--r--src/main.cpp1
2 files changed, 18 insertions, 3 deletions
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp
index a573e85..ed04e26 100644
--- a/src/CmakeModule.cpp
+++ b/src/CmakeModule.cpp
@@ -2,6 +2,7 @@
#include "../include/Exec.hpp"
#include "../include/GlobalLib.hpp"
#include "../include/PkgConfig.hpp"
+#include "../backend/BackendUtils.hpp"
#if OS_FAMILY == OS_FAMILY_POSIX
#define nprintf printf
@@ -10,9 +11,17 @@
#endif
using namespace std;
+using namespace backend;
namespace sibs
{
+ static FileString cmakePath = TINYDIR_STRING("cmake");
+
+ void CmakeModule::setCmakePath(const FileString &path)
+ {
+ cmakePath = path;
+ }
+
Result<bool> CmakeModule::compile(const SibsConfig &config, const FileString &buildPath, LinkerFlagCallbackFunc staticLinkerFlagCallbackFunc, LinkerFlagCallbackFunc dynamicLinkerFlagCallbackFunc, GlobalIncludeDirCallbackFunc globalIncludeDirCallback)
{
// TODO: Make packaging work with cmake projects
@@ -128,7 +137,8 @@ namespace sibs
if (createBuildDirResult.isErr())
return createBuildDirResult;
- FileString cmd = TINYDIR_STRING("cmake ");
+ FileString cmd = cmakePath;
+ cmd += TINYDIR_STRING(" ");
if(config.getCompiler() == Compiler::GCC)
{
if(config.getSanitize())
@@ -207,12 +217,16 @@ namespace sibs
if(config.getPackageType() != PackageType::EXECUTABLE)
{
+ const _tinydir_char_t *dynamicLibExtension = TINYDIR_STRING(CONFIG_DYNAMIC_LIB_FILE_EXTENSION);
+ if(config.getCompiler() == Compiler::MINGW_W64)
+ dynamicLibExtension = TINYDIR_STRING("dll");
+
string buildPathUtf8 = toUtf8(buildPath);
nprintf("Searching for libraries generate by cmake in build path: %s\n", buildPathUtf8.c_str());
walkDirFilesRecursive(buildPath.c_str(),
- [&config, &parentProjStaticLinkerFlagCallbackFunc, &parentProjDynamicLinkerFlagCallbackFunc](tinydir_file *file)
+ [&config, &parentProjStaticLinkerFlagCallbackFunc, &parentProjDynamicLinkerFlagCallbackFunc, dynamicLibExtension](tinydir_file *file)
{
- if(_tinydir_strcmp(file->extension, CONFIG_DYNAMIC_LIB_FILE_EXTENSION) == 0 || _tinydir_strcmp(file->extension, CONFIG_STATIC_LIB_FILE_EXTENSION) == 0)
+ if(_tinydir_strcmp(file->extension, dynamicLibExtension) == 0 || _tinydir_strcmp(file->extension, CONFIG_STATIC_LIB_FILE_EXTENSION) == 0)
{
string libFileUtf8 = toUtf8(file->path);
nprintf("Library generated by cmake: %s\n", libFileUtf8.c_str());
diff --git a/src/main.cpp b/src/main.cpp
index 1265d3d..c8e9b27 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -559,6 +559,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv)
{
compiler = Compiler::MINGW_W64;
PkgConfig::setPkgConfigPath(TINYDIR_STRING("x86_64-w64-mingw32-pkg-config"));
+ CmakeModule::setCmakePath(TINYDIR_STRING("x86_64-w64-mingw32-cmake"));
}
#else
Compiler compiler = Compiler::MSVC;