Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not building with msc #117

Closed
trsh opened this issue Jan 2, 2024 · 9 comments
Closed

Not building with msc #117

trsh opened this issue Jan 2, 2024 · 9 comments

Comments

@trsh
Copy link

trsh commented Jan 2, 2024

Describe the bug

Untitled

Expected behavior
Building

Desktop (please complete the following information):

  • OS: windows 11 pro
@trsh trsh changed the title Not building with mvsc Not building with msc Jan 2, 2024
@trsh
Copy link
Author

trsh commented Jan 2, 2024

Build LC via

python bootstrap.py cmake -f dx -b

Did cmake --install . in build dir afterwards

Created a new c++ project in VS2022 and added include directory from installs. Also switched to C++20 standards

@Mike-Leo-Smith
Copy link
Contributor

Hi, @trsh

Directly including the installed directory in VS may lose some of the compile options and definitions we defined in the CMake build system. Therefore, you will have to manually add these missing definitions and options.

Here I collect some:

Compile Definitions:
#define _ENABLE_EXTENDED_ALIGNED_STORAGE 1
#define _CRT_SECURE_NO_WARNINGS 1
#define _UNICODE 1
#define LUISA_PLATFORM_WINDOWS 1
#define FMT_CONSTEVAL constexpr // missing of this causes the fmt error in this issue
#define FMT_EXCEPTIONS 0
#define FMT_HEADER_ONLY 1
#define FMT_USE_NOEXCEPT 1
#define XXH_INLINE_ALL 1

Compile Options:
/Zc:preprocessor
/Zc:__cplusplus

Additional definition if you enable the dsl feature when building:

#define LUISA_ENABLE_DSL 1

And for the gui feature:

#define LUISA_ENABLE_GUI 1
#define GLFW_INCLUDE_NONE 1

You may configure them in the VS project settings.

An alternative solution is to use CMake as your build system and add the LuisaCompute project directory (not the installed directory) as a subdirectory, so these configurations will be automatically propagated for you.

That said, maybe we should automatically generate a config header when installing to support other build systems. I will open an issue to track this need.

@trsh
Copy link
Author

trsh commented Jan 3, 2024

@Mike-Leo-Smith with these added now I only have problems with dsl/sugar

Screenshot 2024-01-03 110713

@trsh
Copy link
Author

trsh commented Jan 3, 2024

Ahh I messed up with the preprocessor, now I have only 1 error:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	C4996	'luisa::compute::Printer': The frontend-implemented `Printer` is deprecated in favor of the backend-implemented built-in function. Please use `device_log()` from <luisa/dsl/builtin.h>.	Lu	C:\Program Files\LuisaCompute\include\luisa\dsl\printer.h	143		

@Mike-Leo-Smith
Copy link
Contributor

Ahh I messed up with the preprocessor, now I have only 1 error:

Severity	Code	Description	Project	File	Line	Suppression State	Details
Error	C4996	'luisa::compute::Printer': The frontend-implemented `Printer` is deprecated in favor of the backend-implemented built-in function. Please use `device_log()` from <luisa/dsl/builtin.h>.	Lu	C:\Program Files\LuisaCompute\include\luisa\dsl\printer.h	143		

Looks like the deprecated warning is being treated as an error. Maybe adding a /wd4996 flag to the VS project settings will help?

@trsh
Copy link
Author

trsh commented Jan 3, 2024

@Mike-Leo-Smith yes, I just suppressed the warning, now I am down to linking libs.

Screenshot 2024-01-03 114523

Took it from reference, but smth is missing. Need to debug it properly

lc-vstl.lib
Shlwapi.lib
lc-osl.lib
lc-gui.lib
lc-dsl.lib
lc-api.lib
lc-runtime.lib
lc-ir.lib
luisa_compute_ir_static.lib
kernel32.lib
advapi32.lib
bcrypt.lib
ntdll.lib
userenv.lib
ws2_32.lib
lc-ir-v2.lib
lc-ast.lib
lc-core.lib
dbghelp.lib
lc-ext-stb.lib
lc-ext-imgui.lib
lc-ext-glfwdll.lib
lc-ext-eastl.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib

@trsh
Copy link
Author

trsh commented Jan 3, 2024

Got it working. There were missing pieces in pre-processor

@Mike-Leo-Smith
Copy link
Contributor

Got it working. There were missing pieces in pre-processor

Wonderful to hear that!

@Mike-Leo-Smith
Copy link
Contributor

I'm closing this issue since it's tracked in #118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants