From f7828a0718b730ffdc6b9f25e5d11cbfd666acf1 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Mon, 8 Feb 2021 15:12:35 -0500 Subject: got windows pcre build to work --- .gitignore | 1 + README.md | 5 ++++- main.c | 1 + make.bat | 20 +++++++++++++------- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index feb6ce6..db8b238 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ TAGS *.obj *.exe *.dll +*.lib *.pdb *.ilk *.res diff --git a/README.md b/README.md index 7e17462..4e94168 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,11 @@ a simple editor that starts up practically instantaneously, and performs well on On Linux, run `make`. On Windows, you will need the SDL2 VC development libraries: https://www.libsdl.org/download-2.0.php -Copy SDL2-2.x.y into the ted directory, and rename it to SDL2. Additionally, copy SDL2\lib\x64\SDL2.dll +Copy SDL2-2.x.y into the ted directory, and rename it to SDL2. Also copy SDL2\lib\x64\SDL2.dll to the ted directory. +You will also need PCRE2. Download it here: https://ftp.pcre.org/pub/pcre/pcre2-10.36.zip, +unzip it, and put pcre2-10.36 in the same folder as ted. + Then run `make.bat`. ## Version history diff --git a/main.c b/main.c index e8d41b4..976593f 100644 --- a/main.c +++ b/main.c @@ -18,6 +18,7 @@ no_warn_end #if _WIN32 #include #endif +#define PCRE2_STATIC #define PCRE2_CODE_UNIT_WIDTH 32 #include "pcre2.h" diff --git a/make.bat b/make.bat index 991d023..80c7990 100644 --- a/make.bat +++ b/make.bat @@ -3,12 +3,18 @@ if _%VCVARS% == _ ( set VCVARS=1 call vcvarsall x64 ) - -SET CFLAGS=/nologo /W4 /wd4200 /wd4204 /wd4221 /wd4706 /wd4214 /D_CRT_SECURE_NO_WARNINGS /I SDL2/include SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib opengl32.lib shell32.lib ole32.lib -rc /nologo ted.rc +if not exist pcre2-32.lib ( + pushd pcre2-10.36 + cmake -D PCRE2_BUILD_PCRE2_8=OFF -D PCRE2_BUILD_TESTS=OFF -D PCRE2_BUILD_PCRE2_32=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_GENERATOR_PLATFORM=x64 -D PCRE2_STATIC=ON . + cmake --build . --config Release + popd + copy pcre2-10.36\Release\pcre2-32.lib +) +SET C_FLAGS=/nologo /W4 /MD /wd4200 /wd4204 /wd4221 /wd4706 /wd4214 /D_CRT_SECURE_NO_WARNINGS /I pcre2-10.36 /I SDL2/include SDL2/lib/x64/SDL2main.lib SDL2/lib/x64/SDL2.lib opengl32.lib shell32.lib ole32.lib pcre2-32.lib +rc /nologo ted.rc if _%1 == _ ( - cl main.c ted.res /DDEBUG /DEBUG /Zi %CFLAGS% /Fe:ted + cl main.c ted.res /DDEBUG /DEBUG /Zi %C_FLAGS% /Fe:ted ) -if _%1 == _release cl main.c ted.res /O2 %CFLAGS% /Fe:ted -if _%1 == _release_with_debug_info cl main.c ted.res /DEBUG /Zi /O2 %CFLAGS% /Fe:ted -if _%1 == _profile cl main.c ted.res /O2 /DPROFILE %CFLAGS% /Fe:ted +if _%1 == _release cl main.c ted.res /O2 %C_FLAGS% /Fe:ted +if _%1 == _release_with_debug_info cl main.c ted.res /DEBUG /Zi /O2 %C_FLAGS% /Fe:ted +if _%1 == _profile cl main.c ted.res /O2 /DPROFILE %C_FLAGS% /Fe:ted -- cgit v1.2.3