diff --git a/include/mcl/bn256_if.h b/include/mcl/bn256_if.h index 0461a39..a7870f4 100644 --- a/include/mcl/bn256_if.h +++ b/include/mcl/bn256_if.h @@ -44,6 +44,9 @@ typedef struct BN256_GT BN256_GT; #define BN256_DLL_API __declspec(dllexport) #else #define BN256_DLL_API __declspec(dllimport) +#ifndef MCL_NO_AUTOLINK + #pragma comment(lib, "bn256_if.lib") +#endif #endif #else #define BN256_DLL_API diff --git a/mk.bat b/mk.bat old mode 100755 new mode 100644 index 352e448..b2e88ab --- a/mk.bat +++ b/mk.bat @@ -1,2 +1,9 @@ @echo off -cl /MT /DNOMINMAX /Ox /DNDEBUG /W4 /Zi /EHsc -I ./include -I../xbyak -I../cybozulib/include -I../cybozulib_ext/include %1 %2 /link /LIBPATH:..\cybozulib_ext\lib /LIBPATH:.\lib +call setvar.bat +set SRC=%1 +set EXE=%SRC:.cpp=.exe% +set EXE=%EXE:.c=.exe% +set EXE=%EXE:test\=bin\% +set EXE=%EXE:sample\=bin\% +echo cl %CFLAGS% %1 %2 %3 /Fe:%EXE% /link %LDFLAGS% +cl %CFLAGS% %1 %2 %3 /Fe:%EXE% /link %LDFLAGS% diff --git a/mklib.bat b/mklib.bat old mode 100755 new mode 100644 index 793df08..fa2f603 --- a/mklib.bat +++ b/mklib.bat @@ -1,15 +1,14 @@ @echo off -set CFLAGS=/MT /DNOMINMAX /Ox /DNDEBUG /W4 /Zi /EHsc -I ./include -I../xbyak -I../cybozulib/include -I../cybozulib_ext/include -set LDFLAGS=/link /LIBPATH:..\cybozulib_ext\lib /LIBPATH:.\lib +call setvar.bat rem nasm -f win64 -D_WIN64 src\asm\low_x86-64.asm rem lib /OUT:lib\mcl.lib /nodefaultlib fp.obj src\asm\low_x86-64.obj -echo cl /c %CFLAGS% src\fp.cpp -cl /c %CFLAGS% src\fp.cpp -echo lib /OUT:lib\mcl.lib /nodefaultlib fp.obj -lib /OUT:lib\mcl.lib /nodefaultlib fp.obj +echo cl /c %CFLAGS% src\fp.cpp /Foobj\fp.obj +cl /c %CFLAGS% src\fp.cpp /Foobj\fp.obj +echo lib /nologo /OUT:lib\mcl.lib /nodefaultlib obj\fp.obj +lib /nologo /OUT:lib\mcl.lib /nodefaultlib obj\fp.obj -echo cl /c %CFLAGS% src\bn256_if.cpp -cl /c %CFLAGS% src\bn256_if.cpp -echo cl /LD /Febin\bn256_if.dll bn256_if.obj fp.obj %LDFLAGS% -cl /LD /Febin\bn256_if.dll bn256_if.obj fp.obj %LDFLAGS% +echo cl /c %CFLAGS% src\bn256_if.cpp /Foobj\bn256_if.obj +cl /c %CFLAGS% src\bn256_if.cpp /Foobj\bn256_if.obj +echo link /nologo /DLL /OUT:bin\bn256_if.dll obj\bn256_if.obj obj\fp.obj %LDFLAGS% /implib:lib\bn256_if.lib +link /nologo /DLL /OUT:bin\bn256_if.dll obj\bn256_if.obj obj\fp.obj %LDFLAGS% /implib:lib\bn256_if.lib diff --git a/readme.md b/readme.md index be2abbd..e3bfb90 100644 --- a/readme.md +++ b/readme.md @@ -62,6 +62,7 @@ mklib.bat 2) make exe binary of sample\pairing.cpp ``` mk sample\pairing.cpp +bin/bn_test.exe ``` open mcl.sln and build or if you have msbuild.exe diff --git a/setvar.bat b/setvar.bat new file mode 100644 index 0000000..c5465ec --- /dev/null +++ b/setvar.bat @@ -0,0 +1,2 @@ +set CFLAGS=/MT /DNOMINMAX /Ox /DNDEBUG /W4 /Zi /EHsc /nologo -I ./include -I../xbyak -I../cybozulib/include -I../cybozulib_ext/include +set LDFLAGS=/LIBPATH:..\cybozulib_ext\lib /LIBPATH:.\lib