Skip to content

Commit

Permalink
Hacking emcc internals to try to build libcxx and libcxxapi on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
juj committed May 1, 2012
1 parent 6257dbd commit 304ff3d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 9 deletions.
5 changes: 3 additions & 2 deletions emcc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ LLVM_OPT_LEVEL = {
3: 3,
}

DEBUG = os.environ.get('EMCC_DEBUG')
DEBUG = 1#os.environ.get('EMCC_DEBUG')
TEMP_DIR = os.environ.get('EMCC_TEMP_DIR')
LEAVE_INPUTS_RAW = os.environ.get('EMCC_LEAVE_INPUTS_RAW') # Do not compile .ll files into .bc, just compile them with emscripten directly
# Not recommended, this is mainly for the test runner, or if you have some other
Expand Down Expand Up @@ -768,7 +768,8 @@ try:
libcxxabi_symbols = filter(lambda symbol: symbol not in dlmalloc_symbols, libcxxabi_symbols)
libcxxabi_symbols = set(libcxxabi_symbols)

force = False # If we have libcxx, we must force inclusion of dlmalloc, since libcxx uses new internally. Note: this is kind of hacky
# force = False # If we have libcxx, we must force inclusion of dlmalloc, since libcxx uses new internally. Note: this is kind of hacky
force = True # If we have libcxx, we must force inclusion of dlmalloc, since libcxx uses new internally. Note: this is kind of hacky

for name, create, fix, library_symbols in [('libcxx', create_libcxx, fix_libcxx, libcxx_symbols),
('libcxxabi', create_libcxxabi, fix_libcxxabi, libcxxabi_symbols),
Expand Down
5 changes: 2 additions & 3 deletions system/lib/libcxx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ OBJECTS = \
debug.bc \
hash.bc \
mutex.bc \
readme.txt \
string.bc \
thread.bc \
valarray.bc \
Expand All @@ -27,8 +26,8 @@ OBJECTS = \
all: libcxx.bc

%.bc: %.cpp
$(CXX) $< -o $@
$(CXX) $< -std=c++0x -DEMSCRIPTEN -D__STDC__ -U_WIN32 -UWIN32 -U__i386__ -U__x86_64__ -U__i386 -U__x86_64 -U__SSE__ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUNDING -UHAVE_GCC_ASM_FOR_X87 -U__STRICT_ANSI__ -U__CYGWIN__ -U__APPLE__ -Xclang -isystemC:/Projects/emscripten/system/include -Xclang -isystemC:/Projects/emscripten/system/include/bsd -Xclang -isystemC:/Projects/emscripten/system/include/libc -Xclang -isystemC:/Projects/emscripten/system/include/libcxx -Xclang -isystemC:/Projects/emscripten/system/include/gfx -Xclang -isystemC:/Projects/emscripten/system/include/net -Xclang -isystemC:/Projects/emscripten/system/include/SDL -m32 -Xclang -triple=i386-pc-linux-gnu -c -nostdinc -Xclang -nobuiltininc -Xclang -nostdinc++ -Xclang -nostdsysteminc -emit-llvm -o $@

libcxx.bc: $(OBJECTS)
$(CXX) $(OBJECTS) -o libcxx.bc
$(CXXLINK) $(OBJECTS) -v -o libcxx.bc

4 changes: 2 additions & 2 deletions system/lib/libcxxabi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ OBJECTS = \
all: libcxxabi.bc

%.bc: %.cpp
$(CXX) -I./include $< -o $@
$(CXX) -I./include $< -std=c++0x -DEMSCRIPTEN -D__STDC__ -U_WIN32 -UWIN32 -U__i386__ -U__x86_64__ -U__i386 -U__x86_64 -U__SSE__ -U__SSE2__ -U__MMX__ -UX87_DOUBLE_ROUNDING -UHAVE_GCC_ASM_FOR_X87 -U__STRICT_ANSI__ -U__CYGWIN__ -U__APPLE__ -Xclang -isystemC:/Projects/emscripten/system/include -Xclang -isystemC:/Projects/emscripten/system/include/bsd -Xclang -isystemC:/Projects/emscripten/system/include/libc -Xclang -isystemC:/Projects/emscripten/system/include/libcxx -Xclang -isystemC:/Projects/emscripten/system/include/gfx -Xclang -isystemC:/Projects/emscripten/system/include/net -Xclang -isystemC:/Projects/emscripten/system/include/SDL -m32 -Xclang -triple=i386-pc-linux-gnu -c -nostdinc -Xclang -nobuiltininc -Xclang -nostdinc++ -Xclang -nostdsysteminc -emit-llvm -o $@

libcxxabi.bc: $(OBJECTS)
$(CXX) $(OBJECTS) -o libcxxabi.bc
$(CXXLINK) $(OBJECTS) -o libcxxabi.bc

17 changes: 15 additions & 2 deletions tests/msvc10/hello_libcxx.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|vs-tool'">
<PlatformToolset>emcc</PlatformToolset>
<ConfigurationType>HTMLPage</ConfigurationType>
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|vs-tool'">
<PlatformToolset>emcc</PlatformToolset>
Expand Down Expand Up @@ -80,8 +80,21 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|vs-tool'">
<ClCompile>
<EchoCommandLines>true</EchoCommandLines>
<VerboseOutput>VerboseOutputMode</VerboseOutput>
<CatchUndefinedBehavior>false</CatchUndefinedBehavior>
<GenerateLLVMByteCode>false</GenerateLLVMByteCode>
</ClCompile>
<Link>
<EchoCommandLines>true</EchoCommandLines>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\hello_libcxx.cpp" />
<ClCompile Include="..\hello_libcxx.cpp">
<OptimizationLevel Condition="'$(Configuration)|$(Platform)'=='Debug|vs-tool'">OptimizationNotSet</OptimizationLevel>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down

0 comments on commit 304ff3d

Please # to comment.