Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,20 @@ if exist "%root_dir%.cache\cpp2\source\_build\cpp2b.ixx" (

setlocal enableextensions disabledelayedexpansion

set "search=@CPP2B_PROJECT_ROOT@"
set "replace=%root_dir%"

set "inputFile=%root_dir%share\cpp2b.cppm.tpl"
set "outputFile=%root_dir%.cache\cpp2\source\_build\cpp2b.ixx"

set "compiler_subst=@CPP2B_COMPILER@"
set "compiler_value=msvc"
set "project_root_subst=@CPP2B_PROJECT_ROOT@"
set "project_root_value=%root_dir%"
for /f "delims=" %%i in ('type "%inputFile%"') do (
set "line=%%i"
setlocal enabledelayedexpansion
>>"%outputFile%" echo(!line:%search%=%replace%!
call set "line=!line:%compiler_subst%=%compiler_value%!"
call set "line=!line:%project_root_subst%=%project_root_value%!"
>>"%outputFile%" echo(!line!
endlocal
)
endlocal
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ if [ -f "$ROOT_DIR/.cache/cpp2/source/_build/cpp2b.cppm" ]; then
fi

cat "$ROOT_DIR/share/cpp2b.cppm.tpl" | sed "s\`@CPP2B_PROJECT_ROOT@\`$ROOT_DIR\`g" > "$ROOT_DIR/.cache/cpp2/source/_build/cpp2b.cppm"
cat "$ROOT_DIR/share/cpp2b.cppm.tpl" | sed "s\`@CPP2B_COMPILER@\`clang\`g" > "$ROOT_DIR/.cache/cpp2/source/_build/cpp2b.cppm"

$CPP2B_COMPILER \
-stdlib=libc++ \
Expand Down
10 changes: 1 addition & 9 deletions share/cpp2b.cppm.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,7 @@ constexpr auto target_platform() -> platform {
}

constexpr auto compiler() -> compiler_type {
#if defined(_MSC_VER)
return compiler_type::msvc;
#elif defined(__clang__)
return compiler_type::clang;
#elif defined(__GNUC__)
return compiler_type::gcc;
#else
# error unknown compiler
#endif
return compiler_type::@CPP2B_COMPILER@;
}

constexpr auto build() -> build_type {
Expand Down
Loading
Loading