diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-01-03 18:34:29 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2018-01-03 18:36:13 +0100 |
commit | 46257ab7cf017f0f35a2025257ad5f45a9e985f0 (patch) | |
tree | 99000f35d7319b76d99acf700aa558496cf2dcf6 | |
parent | fb18bd235bc716963c72c1dd6358176cb50516ae (diff) |
CMake: Add all generated library files as dependency instead of the last
modified one
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | project.conf | 1 | ||||
-rw-r--r-- | src/CmakeModule.cpp | 64 |
3 files changed, 25 insertions, 41 deletions
@@ -38,7 +38,6 @@ lib = "windows/x86/static/release" [config.win64.static.debug] lib = "windows/x64/static/debug" -# cmake building is currrently not implemented, but it is intended to work like this [cmake] dir = "." args = ["ENTITYX_RUN_BENCHMARKS=0"] diff --git a/project.conf b/project.conf index 93665a5..2c3f04c 100644 --- a/project.conf +++ b/project.conf @@ -10,3 +10,4 @@ ignore_dirs = ["cmake"] [dependencies] libcurl = "7.57.0" libarchive = "3.3.2" +rapidjson = "1.1.0" diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp index e05a65f..7d5509c 100644 --- a/src/CmakeModule.cpp +++ b/src/CmakeModule.cpp @@ -133,55 +133,39 @@ namespace sibs if(config.getPackageType() != PackageType::EXECUTABLE) { - FileString libFile; - u64 libFileLastModified = 0; - string buildPathUtf8 = toUtf8(buildPath); - nprintf("Searching for library generate by cmake in build path: %s\n", buildPathUtf8.c_str()); - walkDirFiles(buildPath.c_str(), [&libFile, &libFileLastModified](tinydir_file *file) + nprintf("Searching for libraries generate by cmake in build path: %s\n", buildPathUtf8.c_str()); + walkDirFiles(buildPath.c_str(), + [&config, &staticLinkerFlagCallbackFunc, &dynamicLinkerFlagCallbackFunc](tinydir_file *file) { if(_tinydir_strcmp(file->extension, CONFIG_DYNAMIC_LIB_FILE_EXTENSION) == 0) { - u32 fileLastModified = getFileLastModifiedTime(file->path); - if(fileLastModified > libFileLastModified) + string libFileUtf8 = toUtf8(file->path); + nprintf("Library generated by cmake: %s\n", libFileUtf8.c_str()); + + switch(config.getPackageType()) { - libFileLastModified = fileLastModified; - libFile = file->path; + case PackageType::STATIC: + { + string libFileCmd = "\""; + libFileCmd += libFileUtf8; + libFileCmd += "\""; + staticLinkerFlagCallbackFunc(libFileCmd); + break; + } + case PackageType::DYNAMIC: + case PackageType::LIBRARY: + { + string libFileCmd = "\""; + libFileCmd += libFileUtf8; + libFileCmd += "\""; + dynamicLinkerFlagCallbackFunc(libFileCmd); + break; + } } } }); - if(libFileLastModified == 0) - { - string errMsg = "Package "; - errMsg += config.getPackageName(); - errMsg += " was built using cmake but no generated library was found"; - return Result<bool>::Err(errMsg); - } - string libFileUtf8 = toUtf8(libFile); - nprintf("Library generated by cmake: %s\n", libFileUtf8.c_str()); - - switch(config.getPackageType()) - { - case PackageType::STATIC: - { - string libFileCmd = "\""; - libFileCmd += libFileUtf8; - libFileCmd += "\""; - staticLinkerFlagCallbackFunc(libFileCmd); - break; - } - case PackageType::DYNAMIC: - case PackageType::LIBRARY: - { - string libFileCmd = "\""; - libFileCmd += libFileUtf8; - libFileCmd += "\""; - dynamicLinkerFlagCallbackFunc(libFileCmd); - break; - } - } - // TODO: Clean this up. The below code is indentical to code in Ninja.cpp....... string projectPathUtf8 = toUtf8(config.getProjectPath()); for (const string &globalIncludeDir : config.getGlobalIncludeDirs()) |