-
Notifications
You must be signed in to change notification settings - Fork 25
Fix Windows build compatibility (MSVC cl.exe and clang-cl) #53
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
Open
lorisercole
wants to merge
6
commits into
wavefunction91:master
Choose a base branch
from
lorisercole:fix/msvc-build
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8828179
Add MSVC native cl.exe build support
lorisercole 3829995
Silence noisy MSVC warnings
lorisercole 7d83223
manage warnings
lorisercole a266e2a
avoid clang warning: strdup
lorisercole 601f72e
formatting
lorisercole 871fcc1
Revert strdup and silence warning
lorisercole File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # patch_libxc_work_mgga.cmake | ||
| # Portable replacement for: | ||
| # sed -i -e "s/p->info->family != XC_KINETIC/p->info->kind != XC_KINETIC/g" src/work_mgga_inc.c | ||
| # Run from the libxc source directory via PATCH_COMMAND. | ||
|
|
||
| set(_file "src/work_mgga_inc.c") | ||
| if(NOT EXISTS "${_file}") | ||
| message(FATAL_ERROR "patch_libxc_work_mgga.cmake: ${_file} not found (cwd=${CMAKE_CURRENT_SOURCE_DIR})") | ||
| endif() | ||
|
|
||
| file(READ "${_file}" _content) | ||
| string(REPLACE "p->info->family != XC_KINETIC" "p->info->kind != XC_KINETIC" _content "${_content}") | ||
| file(WRITE "${_file}" "${_content}") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,7 +70,6 @@ struct kernel_traits<Deorbitalized<XCEF,KEDF>> { | |
| static constexpr bool needs_laplacian = true; | ||
| static constexpr bool is_kedf = false; | ||
| static constexpr bool is_epc = false; | ||
| static constexpr double exx_coeff = xc_traits::exx_coeff + ke_traits::exx_coeff; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ? |
||
|
|
||
| BUILTIN_KERNEL_EVAL_RETURN | ||
| eval_exc_unpolar( double rho, double sigma, double lapl, double tau, double& eps ) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,54 @@ add_library( exchcxx ${EXCHCXX_SOURCES} ) | |
| # TARGET properties | ||
|
|
||
| target_compile_features( exchcxx PUBLIC cxx_std_17 ) | ||
| if(MSVC) | ||
| target_compile_definitions( exchcxx PUBLIC _USE_MATH_DEFINES _CRT_NONSTDC_NO_DEPRECATE ) | ||
| if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") # clang-cl | ||
| target_compile_options( exchcxx PUBLIC | ||
| -Wno-c++98-compat | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per offline - let's keep these minimal to adhere to best practices rather than suppressing all warnings. |
||
| -Wno-c++98-compat-local-type-template-args | ||
| -Wno-c++98-compat-pedantic | ||
| -Wno-deprecated-declarations | ||
| -Wno-exit-time-destructors | ||
| -Wno-extra-semi | ||
| -Wno-extra-semi-stmt | ||
| -Wno-float-conversion | ||
| -Wno-float-equal | ||
| -Wno-global-constructors | ||
| -Wno-inconsistent-missing-destructor-override | ||
| -Wno-missing-prototypes | ||
| -Wno-missing-variable-declarations | ||
| -Wno-old-style-cast | ||
| -Wno-pre-c++14-compat | ||
| -Wno-pre-c++17-compat | ||
| -Wno-reserved-macro-identifier | ||
| -Wno-sign-conversion | ||
| -Wno-suggest-destructor-override | ||
| -Wno-switch-enum | ||
| -Wno-undefined-func-template | ||
| -Wno-unsafe-buffer-usage | ||
| -Wno-unsafe-buffer-usage-in-libc-call | ||
| -Wno-unused-macros | ||
| -Wno-unused-parameter | ||
| -Wno-unused-variable | ||
| ) | ||
|
lorisercole marked this conversation as resolved.
|
||
| else() # cl | ||
| target_compile_options( exchcxx PUBLIC | ||
| /wd4003 # not enough actual parameters for macro 'identifier' | ||
| /wd4061 # enumerator 'enumerator' in switch of enum 'enumeration' is not explicitly handled by a case label | ||
| /wd4244 # conversion from 'type1' to 'type2', possible loss of data | ||
| /wd4266 # no override available for virtual member function from base 'class'; function is hidden | ||
| /wd4267 # conversion from 'size_t' to 'type', possible loss of data | ||
| /wd4365 # conversion from 'type1' to 'type2', signed/unsigned mismatch | ||
| /wd4514 # unreferenced inline function has been removed | ||
| /wd4710 # function 'function' not inlined | ||
| /wd4711 # function 'function' selected for automatic inline expansion | ||
| /wd4800 # forcing value to bool 'true' or 'false' (performance warning) | ||
| /wd4820 # 'bytes' bytes padding added after construct 'member_name' | ||
| /wd5246 # C-style struct initialization may not be portable | ||
| ) | ||
| endif() | ||
| endif() | ||
| if( EXCHCXX_ENABLE_LIBXC ) | ||
| target_link_libraries( exchcxx PUBLIC Libxc::xc ) | ||
| endif() | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.