Permalink
Browse files

build: support building with msvc

  • Loading branch information...
1 parent 2fdde0b commit 480bd4689cf4f4e093b54ce291f86cf5a4887037 @piscisaureus piscisaureus committed with bnoordhuis Mar 14, 2012
Showing with 93 additions and 5 deletions.
  1. +1 −1 deps/smjs
  2. +6 −4 luvmonkey.gyp
  3. +86 −0 vcbuild.bat
Submodule smjs updated 3 files
+11 −0 .gitignore
+39 −2 smjs.gyp
+99 −0 vcbuild.bat
View
@@ -47,6 +47,12 @@
'defines': [ '_GNU_SOURCE' ],
'libraries': [ '-lrt' ],
}],
+ ['OS!="win"', {
+ 'libraries': [
+ '-ldl',
+ '-lm',
+ ],
+ }],
],
'include_dirs': [
'src',
@@ -55,10 +61,6 @@
'deps/mozilla-central/js/src',
'<(SHARED_INTERMEDIATE_DIR)' # for js_scripts.h
],
- 'libraries': [
- '-ldl',
- '-lm',
- ],
'sources': [
'src/luv_handle.c',
'src/luv_stream.c',
View
@@ -0,0 +1,86 @@
+@echo off
+
+cd %~dp0
+
+if /i "%1"=="help" goto help
+if /i "%1"=="--help" goto help
+if /i "%1"=="-help" goto help
+if /i "%1"=="/help" goto help
+if /i "%1"=="?" goto help
+if /i "%1"=="-?" goto help
+if /i "%1"=="--?" goto help
+if /i "%1"=="/?" goto help
+
+@rem Process arguments.
+set config=Debug
+set target=Build
+set target_arch=ia32
+set noprojgen=
+set nobuild=
+
+:next-arg
+if "%1"=="" goto args-done
+if /i "%1"=="debug" set config=Debug&goto arg-ok
+if /i "%1"=="release" set config=Release&goto arg-ok
+if /i "%1"=="clean" set target=Clean&goto arg-ok
+if /i "%1"=="ia32" set target_arch=ia32&goto arg-ok
+if /i "%1"=="x86" set target_arch=ia32&goto arg-ok
+if /i "%1"=="x64" set target_arch=x64&goto arg-ok
+if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok
+if /i "%1"=="nobuild" set nobuild=1&goto arg-ok
+
+echo Warning: ignoring invalid command line option `%1`.
+
+:arg-ok
+shift
+goto next-arg
+:args-done
+
+:project-gen
+@rem Skip project generation if requested.
+if defined noprojgen goto msbuild
+
+@rem Generate project files.
+call tools\gyp\gyp.bat -Icommon.gypi luvmonkey.gyp -f msvs -G msvs_version=2010 --depth=. -Dtarget_arch=%target_arch% -Dlibrary=static_library
+if errorlevel 1 goto create-msvs-files-failed
+if not exist luvmonkey.sln goto create-msvs-files-failed
+echo Project files generated.
+
+:msbuild
+@rem Skip build if requested.
+if defined nobuild goto run
+
+@rem Bail out early if not running in VS build env.
+if defined VCINSTALLDIR goto msbuild-found
+if not defined VS100COMNTOOLS goto msbuild-not-found
+if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
+call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat"
+if not defined VCINSTALLDIR goto msbuild-not-found
+goto msbuild-found
+
+:msbuild-not-found
+echo Build skipped. To build, this file needs to run from VS cmd prompt.
+goto run
+
+:msbuild-found
+@rem Build the sln with msbuild.
+msbuild luvmonkey.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
+if errorlevel 1 goto exit
+
+:run
+@rem Nothing to run yet
+goto exit
+
+:create-msvs-files-failed
+echo Failed to create vc project files.
+goto exit
+
+:help
+echo vcbuild.bat [debug/release] [clean] [noprojgen] [nobuild]
+echo Examples:
+echo vcbuild.bat : Build debug build.
+echo vcbuild.bat nobuild: Generate visual studio project, don't build.
+echo vcbuild.bat release: Build release build.
+goto exit
+
+:exit

0 comments on commit 480bd46

Please sign in to comment.