Skip to content

Commit

Permalink
Fixes for windows (#45)
Browse files Browse the repository at this point in the history
* Fix MSVC compiler flags

* Build batches for sample on windows.

* Fix test build scripts for windows.

* Fix buildsample script

* Fix test launcher for windows

* Minor fix
  • Loading branch information
pecheny authored Aug 19, 2021
1 parent 45e35e8 commit 9fe359b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 22 deletions.
2 changes: 2 additions & 0 deletions samples/poc/build-hl-win.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
haxe -D ammer.hl.hlInclude=%HLPATH%/include -D ammer.hl.hlLibrary=%HLPATH% build-hl.hxml
copy native\adder.dll bin\hl\
2 changes: 2 additions & 0 deletions samples/poc/build-native.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd native
nmake Makefile.win
4 changes: 4 additions & 0 deletions samples/poc/run-hl-win.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
copy native/adder.dll bin/hl
copy dummy.txt bin\hl
cd bin/hl
hl sample.hl
12 changes: 6 additions & 6 deletions src/ammer/build/BuildTools.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BuildTools {
lb.ai('cp ${e.requires[0]} ${e.target}');
case CompileObjectC(opt):
if (Ammer.config.useMSVC) {
lb.ai('${Ammer.config.pathMSVC}cl /OUT:${e.target} /c ${e.requires.join(" ")}');
lb.ai('${Ammer.config.pathMSVC}cl /Fe:${e.target} /c ${e.requires.join(" ")}');
for (path in opt.includePaths)
lb.a(' /I "$path"');
} else {
Expand All @@ -57,7 +57,7 @@ class BuildTools {
}
case CompileObjectCpp(opt):
if (Ammer.config.useMSVC) {
lb.ai('${Ammer.config.pathMSVC}cl /OUT:${e.target} /c ${e.requires.join(" ")}');
lb.ai('${Ammer.config.pathMSVC}cl /Fe:${e.target} /c ${e.requires.join(" ")}');
for (path in opt.includePaths)
lb.a(' /I "$path"');
} else {
Expand All @@ -67,7 +67,7 @@ class BuildTools {
}
case LinkLibrary(opt):
if (Ammer.config.useMSVC) {
lb.ai('${Ammer.config.pathMSVC}cl /OUT:${e.target} /LD ${e.requires.join(" ")}');
lb.ai('${Ammer.config.pathMSVC}cl /Fe:${e.target} /LD ${e.requires.join(" ")}');
for (d in opt.defines)
lb.a(' /D$d');
lb.a(' /link');
Expand Down Expand Up @@ -148,7 +148,7 @@ class BuildTools {
File.copy(e.requires[0], e.target);
case CompileObjectC(opt):
if (Ammer.config.useMSVC) {
var args = ['/OUT:${e.target}', "/c"];
var args = ['/Fe:${e.target}', "/c"];
for (req in e.requires)
args.push(req);
for (path in opt.includePaths) {
Expand All @@ -168,7 +168,7 @@ class BuildTools {
}
case CompileObjectCpp(opt):
if (Ammer.config.useMSVC) {
var args = ['/OUT:${e.target}', "/c"];
var args = ['/Fe:${e.target}', "/c"];
for (req in e.requires)
args.push(req);
for (path in opt.includePaths) {
Expand All @@ -188,7 +188,7 @@ class BuildTools {
}
case LinkLibrary(opt):
if (Ammer.config.useMSVC) {
var args = ['/OUT:${e.target}', "/LD"];
var args = ['/Fe:${e.target}', "/LD"];
for (req in e.requires)
args.push(req);
for (d in opt.defines)
Expand Down
2 changes: 1 addition & 1 deletion tests/native/Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ templates.obj: templates.cpp
cl /c templates.cpp

tmp.native.h: native.h
cp native.h tmp.native.h
copy native.h tmp.native.h

.PHONY: all
43 changes: 28 additions & 15 deletions tests/test-windows.bat
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
@echo off


echo "building native library ..."
cd native
nmake /f Makefile.win
cd ..


echo "testing hl ..."
haxe build-hl.hxml
if errorrlevel 0 (
cd bin/hl
cp ../../native/native.dll .
hl test.hl
cd ../..
)
haxe -D ammer.hl.hlInclude=%HLPATH%/include -D ammer.hl.hlLibrary=%HLPATH% build-hl.hxml
IF %ERRORLEVEL% NEQ 0 ( echo "build of hl tests failed" && goto :cpp)
pushd bin\hl
copy ..\..\native\native.dll .
hl test.hl
popd
IF %ERRORLEVEL% NEQ 0 ( echo "hl tests failed" && goto :cpp)


:cpp

echo "testing cpp ..."
rd /q /s bin\cpp

haxe build-cpp.hxml
if errorrlevel 0 (
cd bin/cpp
cp ../../native/native.dll .
./Main
cd ../..
)
IF %ERRORLEVEL% NEQ 0 ( echo "build of cpp tests failed" && goto :eval)

cd bin\cpp
copy ..\..\native\native.dll .
Main.exe
cd ../..
IF %ERRORLEVEL% NEQ 0 ( echo "cpp tests failed" && goto :eval)


:eval


echo "testing eval ..."
cp native/native.dll .
haxe -D ammer.eval.hxDir=%TEST_HXDIR% build-cpp.hxml
copy native\native.dll .
haxe -D ammer.eval.haxeDir=%HAXEPATH% build-eval.hxml
IF %ERRORLEVEL% NEQ 0 ( echo "eval tests failed")

0 comments on commit 9fe359b

Please sign in to comment.