Add support for -static flag, initially on Windows
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
<haxelib name="lime-console-pc" if="console-pc" />
|
||||
|
||||
<haxedef name="lime-opengl" unless="lime-console" />
|
||||
<haxedef name="lime-openal" unless="lime-console" />
|
||||
<haxedef name="lime-openal" unless="lime-console || static_link" />
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class System {
|
||||
#if !disable_cffi
|
||||
#if sys
|
||||
|
||||
#if (iphone || emscripten || android)
|
||||
#if (iphone || emscripten || android || static_link)
|
||||
return cpp.Lib.load (library, method, args);
|
||||
#end
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
|
||||
<set name="DEBUGEXTRA" value="-debug" if="fulldebug" />
|
||||
|
||||
<target id="lime" output="${LIBPREFIX}lime${MSVC_LIB_VERSION}${DEBUGEXTRA}${LIBEXTRA}" tool="linker" toolid="${STD_MODULE_LINK}">
|
||||
<target id="lime" output="${LIBPREFIX}lime${DEBUGEXTRA}${LIBEXTRA}" tool="linker" toolid="${STD_MODULE_LINK}">
|
||||
|
||||
<outdir name="${OUTPUT_DIR}/${BINDIR}" />
|
||||
|
||||
|
||||
91
templates/cpp/static/BuildMain.xml
Normal file
91
templates/cpp/static/BuildMain.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<xml>
|
||||
|
||||
<include name="${HXCPP}/build-tool/BuildCommon.xml" />
|
||||
|
||||
<files id="main">
|
||||
|
||||
<file name="Main.cpp" />
|
||||
|
||||
</files>
|
||||
|
||||
<target id="main" output="Main${DBG}" tool="linker" toolid="exe">
|
||||
|
||||
<files id="main" />
|
||||
|
||||
<lib name="ApplicationMain${DBG}${LIBEXT}" />
|
||||
|
||||
::foreach ndlls::
|
||||
<lib name="::path::" />::end::
|
||||
|
||||
<section if="windows">
|
||||
|
||||
<lib name="gdi32.lib" />
|
||||
<lib name="opengl32.lib" />
|
||||
<lib name="user32.lib" />
|
||||
<lib name="kernel32.lib" />
|
||||
<lib name="advapi32.lib" />
|
||||
<lib name="winmm.lib" />
|
||||
<lib name="imm32.lib" />
|
||||
<lib name="ole32.lib" />
|
||||
<lib name="oleaut32.lib" />
|
||||
<lib name="version.lib" />
|
||||
<lib name="ws2_32.lib" />
|
||||
<lib name="wldap32.lib" />
|
||||
<lib name="shell32.lib" />
|
||||
<lib name="comdlg32.lib" />
|
||||
|
||||
</section>
|
||||
|
||||
<section if="linux">
|
||||
|
||||
<lib name="${HXCPP}/lib/${BINDIR}/liblinuxcompat.a" />
|
||||
<lib name="-lpthread" />
|
||||
<lib name="-lrt" />
|
||||
|
||||
<lib name="-lgc" if="LIME_NEKO" />
|
||||
<lib name="-lm" if="LIME_NEKO" />
|
||||
|
||||
</section>
|
||||
|
||||
<section if="mac">
|
||||
|
||||
<vflag name="-l" value="iconv"/>
|
||||
<vflag name="-framework" value="IOKit" />
|
||||
<vflag name="-framework" value="Foundation" />
|
||||
<vflag name="-framework" value="CoreAudio" />
|
||||
<vflag name="-framework" value="Cocoa" />
|
||||
<vflag name="-framework" value="OpenGL" />
|
||||
<vflag name="-framework" value="AudioToolbox" />
|
||||
<vflag name="-framework" value="AudioUnit" />
|
||||
<vflag name="-framework" value="ForceFeedback" />
|
||||
<vflag name="-framework" value="Carbon" />
|
||||
<vflag name="-framework" value="AppKit" />
|
||||
<vflag name="-framework" value="OpenAL"/>
|
||||
|
||||
<lib name="/opt/local/lib/libgc.a" if="LIME_NEKO" />
|
||||
<lib name="-lm" if="LIME_NEKO" />
|
||||
|
||||
</section>
|
||||
|
||||
<section if="android">
|
||||
|
||||
<lib name="-Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit" if="LIME_SDL"/>
|
||||
<lib name="-ldl" />
|
||||
<lib name="-llog" />
|
||||
<lib name="-landroid" />
|
||||
<lib name="-lEGL" />
|
||||
<lib name="-lGLESv2" />
|
||||
<lib name="-lGLESv1_CM" />
|
||||
<lib name="-lOpenSLES" />
|
||||
|
||||
</section>
|
||||
|
||||
</target>
|
||||
|
||||
<target id="default">
|
||||
|
||||
<target id="main" />
|
||||
|
||||
</target>
|
||||
|
||||
</xml>
|
||||
37
templates/cpp/static/Main.cpp
Normal file
37
templates/cpp/static/Main.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
extern "C" const char *hxRunLibrary ();
|
||||
extern "C" void hxcpp_set_top_of_stack ();
|
||||
|
||||
::foreach ndlls::::if (registerStatics)::
|
||||
extern "C" int ::name::_register_prims ();::end::::end::
|
||||
|
||||
|
||||
#ifdef HX_WINDOWS
|
||||
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
|
||||
#else
|
||||
extern "C" int main(int argc, char *argv[]) {
|
||||
#endif
|
||||
|
||||
hxcpp_set_top_of_stack ();
|
||||
|
||||
::foreach ndlls::::if (registerStatics)::
|
||||
::name::_register_prims ();::end::::end::
|
||||
|
||||
const char *err = NULL;
|
||||
err = hxRunLibrary ();
|
||||
|
||||
if (err) {
|
||||
|
||||
printf("Error: %s\n", err);
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user