Skip to content

Commit

Permalink
fix module compilation with clang on windows when std module is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthapz committed Oct 20, 2023
1 parent 7f5de9a commit 24569f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion module/argparse.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,22 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

module;

#ifndef ARGPARSE_MODULE_USE_STD_MODULE
#include <argparse/argparse.hpp>
#endif

export module argparse;

#ifdef ARGPARSE_MODULE_USE_STD_MODULE
import std;
#endif

extern "C++" {
#include <argparse/argparse.hpp>
}
#endif


export namespace argparse {
using argparse::nargs_pattern;
Expand Down
5 changes: 4 additions & 1 deletion xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set_project("argparse")
set_version("2.9.0", { build = "%Y%m%d%H%M" })

option("enable_module")
option("enable_std_import", { defines = "ARGPARSE_MODULE_USE_STD_MODULE" })
option("enable_tests")
option("enable_samples")

Expand All @@ -28,7 +29,9 @@ target("argparse", function()
if get_config("enable_module") then
set_languages("c++20")
set_kind("static") -- static atm because of a XMake bug, headeronly doesn't generate package module metadata
else
end

add_options("enable_std_import")

add_includedirs("include", { public = true })
add_headerfiles("include/argparse/argparse.hpp")
Expand Down

0 comments on commit 24569f6

Please sign in to comment.