SoftwareNetwork / sw

Software Manager. Build System, Build System Generator and Package Manager. C/C++ and other languages. Tools and libraries for Software Management.
https://software-network.org
Other
118 stars 25 forks source link

Generate a JSON Compilation Database file #21

Closed Telokis closed 4 years ago

Telokis commented 4 years ago

Is there a way to make SW generate a compile_commands.json (https://clang.llvm.org/docs/JSONCompilationDatabase.html) somewhere predictable?

This would be very useful in order to let a custom IDE find the include directories.
(I'm using VSCode and it's the way they recommend for complex toolchains)

egorpugin commented 4 years ago

sw generate -g compdb ?

egorpugin commented 4 years ago

And db will be in .sw/g/compdb/.

Telokis commented 4 years ago

Thank you, I was sure you already had thought of it!
May I ask you what will trigger a change within the file?
Especially regarding the include directories and the hash-based directory structure within it: if I always use the same version of a specific dependency, will it always be stored in the same path in storage?

Telokis commented 4 years ago

Ok, it properly generated the file but it only contains null.

Moreover, is there a way to ask sw to put it inside a predictable directory? Right now I got be5d4471 but I don't know when it'll change.

egorpugin commented 4 years ago

May I ask you what will trigger a change within the file?

What file?

if I always use the same version of a specific dependency, will it always be stored in the same path in storage?

Yes, if storage schema is the same. I consider it changeable in the future. There will be some api like getRootDirectory(package) later, so you don't need to know exact locations prior to package dir.

Ok, it properly generated the file but it only contains null.

I've uploaded the fix.

Moreover, is there a way to ask sw to put it inside a predictable directory? Right now I got be5d4471 but I don't know when it'll change.

I decided to use hashed dirs, because there's no way to express all config in one line. Length become near 150-200 chars, which may cause issues in many cases. It is possible to assign a name to config, so it will be like .sw/out/cfgname or .sw/g/cfgname, but currently it cannot be assigned from command line.

Telokis commented 4 years ago

What file?

I was talking about the compile_commands.json but I figured it out by myself. It will change when anything in the build process change like if I add a file or something like this.

Yes, if storage schema is the same.

Ok, I understand.

I decided to use hashed dirs, because there's no way to express all config in one line.

I totally understand what you mean, there. But like my question regarding --output-dir, it is sometimes convenient for specific environments to be able to definitely know where files will be placed whatever the config is.
(For example, I could ask sw to do something like sw generate -g compdb --name compdb and it would result in this file: .sw/g/compdb/compdb/compile_commands.json, replacing the hash with my custom --name.

Telokis commented 4 years ago

The generated file seem to have an issue but I'm not 100% sure about it.
My C++ extension says MainWindow.cpp not found in compile_commands.json and when I look for it, it doesn't seem to be part of it. What I see if this section:

{
    "arguments": [
      "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe",
      "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe",
      "-nologo",
      "-c",
      "-FoC:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/t/72b288/647289/obj/MainWindow.cpp.731c06ae.obj",
      "-TP",
      "-std:c++17",
      "-Zi",
      "-EHsc",
      "C:/Users/Telokis/Documents/Dev/Git/Rayon/Projects/GUI/Source/MainWindow.cpp",
      "-O2",
      "-MD",
      "-showIncludes",
      "-FS",
      "-DALIGNOF_GUINT32=4",
      "-DALIGNOF_GUINT64=8",
      "-DANGLE_ENABLE_D3D11",
      "-DANGLE_ENABLE_D3D9",
      "-DANGLE_ENABLE_GLSL",
      "-DANGLE_ENABLE_HLSL",
      "-DANGLE_EXPORT=SW_IMPORT",
      "-DBOOST_FILESYSTEM_DYN_LINK",
      "-DBOOST_FILESYSTEM_USE_DLL",
      "-DBOOST_USE_INTRIN_H",
      "-DBOOST_USE_WINDOWS_H",
      "-DBZ_IMPORT",
      "-DBZ_SHARED",
      "-DCAIRO_FEATURES_H=1",
      "-DCAIRO_HAS_BEOS_SURFACE=0",
      "-DCAIRO_HAS_COGL_SURFACE=0",
      "-DCAIRO_HAS_DIRECTFB_SURFACE=0",
      "-DCAIRO_HAS_DRM_SURFACE=0",
      "-DCAIRO_HAS_EGL_FUNCTIONS=0",
      "-DCAIRO_HAS_FC_FONT=1",
      "-DCAIRO_HAS_FT_FONT=1",
      "-DCAIRO_HAS_GALLIUM_SURFACE=0",
      "-DCAIRO_HAS_GLESV2_SURFACE=0",
      "-DCAIRO_HAS_GLX_FUNCTIONS=0",
      "-DCAIRO_HAS_GL_SURFACE=0",
      "-DCAIRO_HAS_GOBJECT_FUNCTIONS=0",
      "-DCAIRO_HAS_INTERPRETER=1",
      "-DCAIRO_HAS_OS2_SURFACE=0",
      "-DCAIRO_HAS_PDF_SURFACE=1",
      "-DCAIRO_HAS_PNG_FUNCTIONS=1",
      "-DCAIRO_HAS_PS_SURFACE=1",
      "-DCAIRO_HAS_QT_SURFACE=0",
      "-DCAIRO_HAS_QUARTZ_FONT=0",
      "-DCAIRO_HAS_QUARTZ_IMAGE_SURFACE=0",
      "-DCAIRO_HAS_QUARTZ_SURFACE=0",
      "-DCAIRO_HAS_SCRIPT_SURFACE=1",
      "-DCAIRO_HAS_SKIA_SURFACE=0",
      "-DCAIRO_HAS_SVG_SURFACE=1",
      "-DCAIRO_HAS_SYMBOL_LOOKUP=0",
      "-DCAIRO_HAS_TEE_SURFACE=0",
      "-DCAIRO_HAS_TEST_SURFACES=0",
      "-DCAIRO_HAS_TRACE=0",
      "-DCAIRO_HAS_VG_SURFACE=0",
      "-DCAIRO_HAS_WGL_FUNCTIONS=0",
      "-DCAIRO_HAS_WIN32_FONT=1",
      "-DCAIRO_HAS_WIN32_SURFACE=1",
      "-DCAIRO_HAS_XCB_SHM_FUNCTIONS=0",
      "-DCAIRO_HAS_XCB_SURFACE=0",
      "-DCAIRO_HAS_XLIB_SURFACE=0",
      "-DCAIRO_HAS_XLIB_XCB_FUNCTIONS=0",
      "-DCAIRO_HAS_XLIB_XRENDER_SURFACE=0",
      "-DCAIRO_HAS_XML_SURFACE=0",
      "-DCPPAN_LIBINTL_DLL_EXPORT=SW_IMPORT",
      "-DEGLAPIENTRY=__cdecl",
      "-DFC_CACHEDIR=\"LOCAL_APPDATA_FONTCONFIG_CACHE\"",
      "-DFC_DEFAULT_FONTS=\"WINDOWSFONTDIR\"",
      "-DFLEXIBLE_ARRAY_MEMBER=1",
      "-DGETTEXT_PACKAGE=\"\"",
      "-DGLIB_BINARY_AGE=2",
      "-DGLIB_INTERFACE_AGE=2",
      "-DGLIB_LOCALE_DIR=\"\"",
      "-DG_ATOMIC_LOCK_FREE",
      "-DG_OS_WIN32",
      "-DHAVE_CONFIG_H",
      "-DHAVE_DIRENT_H=1",
      "-DHAVE_FT_GET_BDF_PROPERTY=1",
      "-DHAVE_FT_GET_NEXT_CHAR=1",
      "-DHAVE_FT_GET_PS_FONT_INFO=1",
      "-DHAVE_FT_HAS_PS_GLYPH_NAMES=1",
      "-DHAVE_FT_SELECT_SIZE=1",
      "-DHD_EXTERN=SW_IMPORT",
      "-DICONV_CONST=const",
      "-DLIBCHARSET_DLL_EXPORTED=SW_IMPORT",
      "-DLIBDIR=\".\"",
      "-DLIBICONV_DLL_EXPORTED=SW_IMPORT",
      "-DLOCALEDIR=\"./locale\"",
      "-DNDEBUG",
      "-DNOMINMAX",
      "-DPCRE2_CODE_UNIT_WIDTH=16",
      "-DPNG_IMPEXP=SW_IMPORT",
      "-DQT_COMPILER_SUPPORTS_F16C",
      "-DQT_COMPILER_SUPPORTS_SIMD_ALWAYS",
      "-DQT_SHARED",
      "-DQT_VERSION_MAJOR=5",
      "-DQT_VERSION_MINOR=14",
      "-DQT_VERSION_PATCH=0",
      "-DQT_VERSION_STR=\"5.14.0\"",
      "-DRAYON_ENGINE_API=",
      "-DSUPPORT_UCP",
      "-DSUPPORT_UTF",
      "-DSW_EXPORT=__declspec(dllexport)",
      "-DSW_FONTCONFIG_LIBRARY_API=SW_IMPORT",
      "-DSW_FREETYPE_LIBRARY_API=SW_IMPORT",
      "-DSW_IMPORT=__declspec(dllimport)",
      "-DSW_PCRE_EXP_VAR=__declspec(dllimport)",
      "-DTHREADS_WIN32",
      "-DUSE_SYSTEM_PCRE",
      "-DU_EXPORT=SW_EXPORT",
      "-DU_IMPORT=SW_IMPORT",
      "-DU_USING_ICU_NAMESPACE=1",
      "-DWIN32",
      "-DYAML_CPP_API=SW_IMPORT",
      "-DZSTD_DLL_IMPORT",
      "-D_ENABLE_EXTENDED_ALIGNED_STORAGE",
      "-Dcairo_public=SW_IMPORT",
      "-IC:/Users/Telokis/Documents/Dev/Git/Rayon/Projects/GUI/Include/",
      "-IC:/Users/Telokis/Documents/Dev/Git/Rayon/Dependencies/glm/include",
      "-IC:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/t/72b288/647289/bd/moc/7b7d8123",
      "-IC:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/t/72b288/647289/bdp",
      "-IC:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/t/72b288/647289/bd",
      "-IC:/Users/Telokis/Documents/Dev/Git/Rayon/Projects/Engine/Include",
      "-IC:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/t/72b288/1a141d/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/92/c3/c856/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/92/c3/c856/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6b/18/b021/src/sdir/src/plugins/platforms/windows",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6b/18/b021/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/a9/c2/5933/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/a9/c2/5933/obj/bld/72b288/bd/include/QtWidgets",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/a9/c2/5933/obj/bld/72b288/bd/include/QtWidgets/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/a9/c2/5933/obj/bld/72b288/bd/include/QtWidgets/5.14.0/QtWidgets",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/a9/c2/5933/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/8b/2c/18b9/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/8b/2c/18b9/obj/bld/72b288/bd/include/QtGui",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/8b/2c/18b9/obj/bld/72b288/bd/include/QtGui/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/8b/2c/18b9/obj/bld/72b288/bd/include/QtGui/5.14.0/QtGui",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/8b/2c/18b9/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d1/7d/2bab/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d1/7d/2bab/obj/bld/72b288/bd/include/QtAccessibilitySupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d1/7d/2bab/obj/bld/72b288/bd/include/QtAccessibilitySupport/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d1/7d/2bab/obj/bld/72b288/bd/include/QtAccessibilitySupport/5.14.0/QtAccessibilitySupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d1/7d/2bab/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/14/30/e91a/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/14/30/e91a/obj/bld/72b288/bd/include/QtEventDispatcherSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/14/30/e91a/obj/bld/72b288/bd/include/QtEventDispatcherSupport/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/14/30/e91a/obj/bld/72b288/bd/include/QtEventDispatcherSupport/5.14.0/QtEventDispatcherSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/14/30/e91a/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/52/7c/4f4a/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/52/7c/4f4a/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/52/7c/4f4a/obj/bld/72b288/bd/include/QtThemeSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/52/7c/4f4a/obj/bld/72b288/bd/include/QtThemeSupport/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/52/7c/4f4a/obj/bld/72b288/bd/include/QtThemeSupport/5.14.0/QtThemeSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/52/7c/4f4a/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/e2/4693/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/e2/4693/obj/bld/72b288/bd/include/QtWindowsUIAutomationSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/e2/4693/obj/bld/72b288/bd/include/QtWindowsUIAutomationSupport/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/e2/4693/obj/bld/72b288/bd/include/QtWindowsUIAutomationSupport/5.14.0/QtWindowsUIAutomationSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/e2/4693/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/d5/c554/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/d5/c554/obj/bld/72b288/bd/include/QtFontDatabaseSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/d5/c554/obj/bld/72b288/bd/include/QtFontDatabaseSupport/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/d5/c554/obj/bld/72b288/bd/include/QtFontDatabaseSupport/5.14.0/QtFontDatabaseSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/d5/c554/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/01/d5/c554/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/4f/04/1c6e/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/4f/04/1c6e/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/99/cf/d5fd/src/sdir/src/3rdparty/wintab",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/99/cf/d5fd/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/be/b3/0903/src/sdir/src/3rdparty/iaccessible2/generated",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/be/b3/0903/src/sdir/src/3rdparty/iaccessible2/generated/amd64",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/be/b3/0903/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/a5/76/31d5/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/a5/76/31d5/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/53/9a/32e5/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/53/9a/32e5/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/49/44/ba92/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/49/44/ba92/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d0/e3/cb43/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d0/e3/cb43/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/38/17/815d/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/38/17/815d/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/0d/f3/3700/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/0d/f3/3700/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/1d/f5/42dd/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/1d/f5/42dd/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6e/75/f1cf/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6e/75/f1cf/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/49/24/85ca/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/49/24/85ca/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/cf/f2/9ff5/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/cf/f2/9ff5/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/8f/99/bb2e/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/8f/99/bb2e/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ce/30/4d3f/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ce/30/4d3f/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/c0/af/5f1e/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/c0/af/5f1e/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/ae/b957/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/ae/b957/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/3d/f2/f30f/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/3d/f2/f30f/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/af/5c/cf0c/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/af/5c/cf0c/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/94/f0/084c/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/94/f0/084c/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ba/e0/f079/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ba/e0/f079/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ca/9e/73cd/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ca/9e/73cd/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/dd/2a/598b/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/dd/2a/598b/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6f/37/f154/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6f/37/f154/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/b4/99/d310/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/b4/99/d310/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/0a/ab/3b90/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/0a/ab/3b90/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/66/6c/54e8/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/66/6c/54e8/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/7c/a6/2f50/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/7c/a6/2f50/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/61/2f/d6e5/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/61/2f/d6e5/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/b4/e3/ca17/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/b4/e3/ca17/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/28/39/9564/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/28/39/9564/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/9f/80/6a06/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/9f/80/6a06/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/src/sdir/mkspecs/win32-msvc",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd/include/QtCore",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd/include/QtCore/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd/include/QtCore/5.14.0/QtCore",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd/include/QtPlatformHeaders",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd/include/QtPlatformHeaders/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd/include/QtPlatformHeaders/5.14.0/QtPlatformHeaders",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/aa/4d/96e6/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f8/fe/27ed/obj/bld/72b288/bd/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f8/fe/27ed/obj/bld/72b288/bd/include/QtFontDatabaseSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f8/fe/27ed/obj/bld/72b288/bd/include/QtFontDatabaseSupport/5.14.0",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f8/fe/27ed/obj/bld/72b288/bd/include/QtFontDatabaseSupport/5.14.0/QtFontDatabaseSupport",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f8/fe/27ed/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/59/f9/70f1/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/59/f9/70f1/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6b/48/219d/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/6b/48/219d/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ce/99/b2f8/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ce/99/b2f8/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/e5/c2/65d5/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/e5/c2/65d5/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d7/34/7000/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d7/34/7000/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d9/a8/53ec/src/sdir/.",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d9/a8/53ec/src/sdir/glib",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d9/a8/53ec/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f0/44/f780/src/sdir/source/i18n",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f0/44/f780/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/08/6a/c228/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/08/6a/c228/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/34/b9/8e8a/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/34/b9/8e8a/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/76/c7/435a/src/sdir/lib",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/76/c7/435a/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/7f/5a/ed52/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/7f/5a/ed52/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f8/2a/433a/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f8/2a/433a/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f4/1a/6bce/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/f4/1a/6bce/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/23/5e/afe8/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/23/5e/afe8/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ba/7f/ccd1/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ba/7f/ccd1/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/e0/61/1338/src/sdir/src/third_party/khronos",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/e0/61/1338/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/92/d6/99c4/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/92/d6/99c4/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/eb/0c/8faa/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/eb/0c/8faa/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ac/a3/6b2b/src/sdir/.",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ac/a3/6b2b/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/ac/a3/6b2b/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/68/ff/afd6/src/sdir/pixman",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/68/ff/afd6/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/62/10/a26b/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/62/10/a26b/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/86/96/0213/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/86/96/0213/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/74/e3/db5d/src/sdir/source/common",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/74/e3/db5d/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/9a/77/5850/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/9a/77/5850/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/11/28/0d91/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/11/28/0d91/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/54/b0/22b4/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/54/b0/22b4/src/sdir/src",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/54/b0/22b4/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/e9/6f/ade7/src/sdir/expat/lib",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/e9/6f/ade7/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/21/28/e31a/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/21/28/e31a/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/41/dd/3fd5/src/sdir/include",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/41/dd/3fd5/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/c3/80/3ee7/src/sdir/source/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/c3/80/3ee7/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d4/c2/86d6/src/sdir/src/common/third_party/base",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/d4/c2/86d6/obj/bld/72b288/bd",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/5f/22/3837/src/sdir/",
      "-IC:/Users/Telokis/Documents/Dev/sw/storage/pkg/5f/22/3837/obj/bld/72b288/bd",
      "-IC:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/include",
      "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/ucrt",
      "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/um",
      "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/shared",
      "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17763.0/winrt"
    ],
    "directory": "C:/Users/Telokis/Documents/Dev/Git/Rayon/.sw/t/72b288/647289/obj",
    "file": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.24.28314/bin/Hostx64/x64/cl.exe"
  }

which has a strange file property. (Does it mean cl.exe is the input file, there?)

egorpugin commented 4 years ago

a strange file property

It is just state the first input.

Does it mean cl.exe is the input file, there?

Yes, if cl.exe is changed, re-run the command. We need just more clever input detection.

egorpugin commented 4 years ago

See https://github.com/SoftwareNetwork/sw/blob/master/src/sw/client/cli/generator/generator.cpp#L962

Telokis commented 4 years ago

It is just state the first input.

Ok but it means there is no entry for my MainWindow.cpp file and the intellisense can't determine its include directories. (I wonder why it works for (most of) my other cpp files. I haven't checked every single one but a lot of them seem to have a proper file entry.

egorpugin commented 4 years ago

sw generate -g compdb --name compdb

Something like sw -cfgname X .... But it won't work for multiconfig builds.


Uploaded new client. Try it out.

Telokis commented 4 years ago

Something like sw -cfgname X .... But it won't work for multiconfig builds.

Yes, that's what I'm thinking about. It would work for multiconfig builds but the user would have to call sw multiple times with different --cfgname, no?

Uploaded new client. Try it out.

That did the trick for my MainWindow.cpp! I'm not sure it fixed 100% but is seems better.
Did you find a reliable way to alter the line https://github.com/SoftwareNetwork/sw/blob/master/src/sw/client/cli/generator/generator.cpp#L962 ?

egorpugin commented 4 years ago

multiple times with different --cfgname

True. Seems, I'll implement that for now.


Did you find a reliable way to alter the line

See https://github.com/SoftwareNetwork/sw/commit/84fc21e700c97c70a63df6bd3b7fe0be9579b4d3

egorpugin commented 4 years ago

Algo is:

  1. select first c/cpp input
  2. otherwise select first input that is not command
Telokis commented 4 years ago

That does the trick, indeed.
Shouldn't you add another fallback to input.begin() in case you didn't find a suitable file?

By the way, this snippet of code made me think about something: do you only 100% intend sw to build C++? (I think about this because of the

    static const std::set<String> exts{
        ".c", ".cpp", ".cxx", ".c++", ".cc", ".CPP", ".C++", ".CXX", ".C", ".CC"
    };
egorpugin commented 4 years ago

I do not know what other langs require. I only implement things like this as far as I know them. No need to go on 100%, just a dummy stubs this and there as proof of concept (or 80%/20%). When user asks, I improve code. I don't have time for everything.

egorpugin commented 4 years ago

multiple times with different --cfgname

Also not 100% solution. If you write sw -static -shared -cfgname static,shared ..., internal code may create shared config first and assign static name for it.

Telokis commented 4 years ago

Yes, I 100% understand and agree. There seems to still be a lot of work even though the project is in pretty good shape already!
I always recommanded cppan to my friends/colleagues/people in the street when anything related to C++ came up in conversationd and now I'll recommend sw!
The simple fact that I can do gui.Private += "org.sw.demo.boost.filesystem-1.72.0"_dep; to retrieve, setup and link boost is pretty magical in itself, that's why I like that so much. (Even more true for something as complex and intricate as Qt and all its RCC/MOC/UI stuff that you handled quite nicely.

Making the sw.cpp for Qt and boost must have been a real challenge, hasn't it?

Telokis commented 4 years ago

multiple times with different --cfgname

Also not 100% solution. If you write sw -static -shared -cfgname static,shared ..., internal code may create shared config first and assign static name for it.

You're right, this is not perfect but it's a starting point that will probably cover the 80% use cases. (Or at least that's the goal).

Seeing directories called 1d56c3 can be quite surprising at first. Even more so if we have no way to know what determines the name itself.

egorpugin commented 4 years ago

Making the sw.cpp for Qt and boost must have been a real challenge, hasn't it?

Take a look at them. (You saw qt probably already). https://software-network.org/org.sw.demo.boost.accumulators/1.72.0/specification

Boost spec is mostly autogenerated (commits & deps). Qt was harder, but I refactor it from time to time to get more automation, move repeated code into functions.

Yes, these things did not shape up in a blink, but work over several year, starting when cppan was active.

Boost deps is generated using this tool. https://github.com/egorpugin/boost_dependencies

egorpugin commented 4 years ago

The simple fact that I can do gui.Private += "org.sw.demo.boost.filesystem-1.72.0"_dep; to retrieve, setup and link boost is pretty magical

That is the whole philosophy of SW project. Solve things in one click. After architecture work, I plan to investigate creation of linux distribution driven by sw. (Like NixOS or Guix.) But again, this needs very strong architecture.

Telokis commented 4 years ago

Making the sw.cpp for Qt and boost must have been a real challenge, hasn't it?

Take a look at them. (You saw qt probably already). https://software-network.org/org.sw.demo.boost.accumulators/1.72.0/specification

Boost spec is mostly autogenerated (commits & deps). Qt was harder, but I refactor it from time to time to get more automation, move repeated code into functions.

Yes, these things did not shape up in a blink, but work over several year, starting when cppan was active.

Boost deps is generated using this tool. https://github.com/egorpugin/boost_dependencies

Yes, I took a look at both of them anyway (I'm very curious and I thought would probably the most complex specs among everything) but I didn't dive too deep in it, it's quite overwhelming.


That is the whole philosophy of SW project. Solve things in one click.

That the reason I was so happy when I discovered cppan back in 2017.
When I first saw you talk about cppan v2, I wasn't too sure why you wanted to change stuff since it seemed to work perfectly fine for my very narrow purposes. I was especially skeptic regarding the "config in cpp" thing but now that I've given it a fair try, I totally understand and there is no doubt regarding the giant leap forward there has been. It's a very impressive job you've managed to do with both of these projects.

After architecture work, I plan to investigate creation of linux distribution driven by sw. (Like NixOS or Guix.) But again, this needs very strong architecture.

That's a total other step, indeeed! I hope you'll manage!

egorpugin commented 4 years ago

See https://github.com/SoftwareNetwork/sw/commit/5fa2344ecbbce38f22e309864df7ea1c7d7d75c9 for --config-name option. Tried it like sw -md -mt -config-name md,mt build. Did not work on other subcommands like sw generate at the moment. There's no common code to select dirname currently. (Update sw client to try it.)

Telokis commented 4 years ago

Ok it works but it doesn't rename the directory of the generate command (I still have .sw/g/compdb/be5d4471/compile_commands.json when I do sw --config-name compdb generate -g compdb).

What is used to determine the hash be5d4471 for a given project?

egorpugin commented 4 years ago

Ok it works but it doesn't rename the directory of the generate command

Yes, as I wrote: Did not work on other subcommands like sw generate at the moment.

With generators there is a problem that multiple configs goes into one directory with build hash name. Example: sw -static -shared generate -g ninja. We cannot name each config here, because whole build is used to build two configs and not one.

What is used to determine the hash be5d4471 for a given project?

This is SwBuild::getHash() or hash of the build = hash of the inputs. Hash of the input = path hash + hash of settings for this input.

In other words, it is a unique value for current build.


So, it seems we may add --build-name option which, if provided, replaces SwBuild::getHash() result.

egorpugin commented 4 years ago

--build-name

Done!

Telokis commented 4 years ago

That did the trick!
But is it expected that it doesn't change the output of the binaries?
I still get .sw/out/d1c3d1/*.exe if I don't specify --output-dir

egorpugin commented 4 years ago

Yes. Binaries go to their dirs. If you have -static -shared you can't put them into single dir.

egorpugin commented 4 years ago

I still get .sw/out/d1c3d1/*.exe if I don't specify --output-dir

--config-name works here.

egorpugin commented 4 years ago

--output-dir changes directly output dir in single config builds. --config-name renames out/X/ dirs in any build.

Telokis commented 4 years ago

Ok, thanks. That's a lot of options to rename stuff, though

egorpugin commented 4 years ago

Fine tune setup :)

egorpugin commented 4 years ago

Please test and report back any issues. Remember to upgrade to the latest client.

Telokis commented 4 years ago

It works as expected on my end!