Skip to content

Commit 97eb294

Browse files
committed
对luaclib编译的动态库提供静态支持
1 parent 164d121 commit 97eb294

4 files changed

Lines changed: 182 additions & 1 deletion

File tree

luaclib/common/Makefile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
.PHONY: all clean
3+
CC = g++
4+
RM = rm -rf
5+
##PLATFORM ?= linux
6+
7+
TARGET = libcommon.a
8+
all: $(TARGET)
9+
10+
## source file path
11+
SRC_PATH := ../../src
12+
13+
## used headers file path
14+
INCLUDE_PATH := ../../src ../../deps/lua ../../deps/uv/include
15+
16+
## define CFLAGS
17+
CFLAGS += -g -O3 -Wall -Wextra -Wno-unused-parameter -fpic -std=c++0x -D LUA_COMPAT_5_2 -D LUA_COMPAT_5_1
18+
19+
ifeq (RELEASE,$(RELEASE))
20+
CFLAGS += -D RELEASE
21+
endif
22+
23+
## get all source files
24+
SRCS += buffer.cpp
25+
26+
## all .o based on all .cpp
27+
OBJS := $(SRCS:.cpp=.o)
28+
29+
## get all include path
30+
CFLAGS += $(foreach dir, $(INCLUDE_PATH), -I$(dir))
31+
.cpp.o:
32+
$(CC) -c $(CFLAGS) -o $@ $<
33+
34+
$(TARGET): $(OBJS)
35+
ar cr $@ $(OBJS)
36+
37+
clean:
38+
$(RM) *.o $(TARGET)

luaclib/common/common.vcxproj

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<ProjectGuid>{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}</ProjectGuid>
15+
<RootNamespace>common</RootNamespace>
16+
</PropertyGroup>
17+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
18+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
19+
<ConfigurationType>StaticLibrary</ConfigurationType>
20+
<UseDebugLibraries>true</UseDebugLibraries>
21+
<PlatformToolset>v120</PlatformToolset>
22+
<CharacterSet>MultiByte</CharacterSet>
23+
</PropertyGroup>
24+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
25+
<ConfigurationType>StaticLibrary</ConfigurationType>
26+
<UseDebugLibraries>false</UseDebugLibraries>
27+
<PlatformToolset>v120</PlatformToolset>
28+
<WholeProgramOptimization>true</WholeProgramOptimization>
29+
<CharacterSet>MultiByte</CharacterSet>
30+
</PropertyGroup>
31+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
32+
<ImportGroup Label="ExtensionSettings">
33+
</ImportGroup>
34+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
35+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
36+
</ImportGroup>
37+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
38+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
39+
</ImportGroup>
40+
<PropertyGroup Label="UserMacros" />
41+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
42+
<OutDir>$(ProjectDir)</OutDir>
43+
<TargetName>$(ProjectName)</TargetName>
44+
</PropertyGroup>
45+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
46+
<OutDir>$(ProjectDir)</OutDir>
47+
<TargetName>$(ProjectName)</TargetName>
48+
</PropertyGroup>
49+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
50+
<ClCompile>
51+
<WarningLevel>Level3</WarningLevel>
52+
<Optimization>Disabled</Optimization>
53+
<SDLCheck>true</SDLCheck>
54+
<AdditionalIncludeDirectories>..\..\src;..\..\deps\lua;..\..\deps\uv\include;</AdditionalIncludeDirectories>
55+
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
56+
</ClCompile>
57+
<Link>
58+
<GenerateDebugInformation>true</GenerateDebugInformation>
59+
</Link>
60+
<PostBuildEvent>
61+
<Command>copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)</Command>
62+
</PostBuildEvent>
63+
</ItemDefinitionGroup>
64+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
65+
<ClCompile>
66+
<WarningLevel>Level3</WarningLevel>
67+
<Optimization>MaxSpeed</Optimization>
68+
<FunctionLevelLinking>true</FunctionLevelLinking>
69+
<IntrinsicFunctions>true</IntrinsicFunctions>
70+
<SDLCheck>true</SDLCheck>
71+
<AdditionalIncludeDirectories>..\..\src;..\..\deps\lua;..\..\deps\uv\include;</AdditionalIncludeDirectories>
72+
</ClCompile>
73+
<Link>
74+
<GenerateDebugInformation>true</GenerateDebugInformation>
75+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
76+
<OptimizeReferences>true</OptimizeReferences>
77+
</Link>
78+
<PostBuildEvent>
79+
<Command>copy $(OutDir)$(TargetName)$(TargetExt) $(SolutionDir)</Command>
80+
</PostBuildEvent>
81+
</ItemDefinitionGroup>
82+
<ItemGroup>
83+
<ClCompile Include="..\..\src\buffer.cpp" />
84+
</ItemGroup>
85+
<ItemGroup>
86+
<ClInclude Include="..\..\src\buffer.h" />
87+
</ItemGroup>
88+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
89+
<ImportGroup Label="ExtensionTargets">
90+
</ImportGroup>
91+
</Project>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="src">
5+
<UniqueIdentifier>{a2d77115-a008-4b21-97b7-dba07a17574c}</UniqueIdentifier>
6+
</Filter>
7+
</ItemGroup>
8+
<ItemGroup>
9+
<ClCompile Include="..\..\src\buffer.cpp">
10+
<Filter>src</Filter>
11+
</ClCompile>
12+
</ItemGroup>
13+
<ItemGroup>
14+
<ClInclude Include="..\..\src\buffer.h">
15+
<Filter>src</Filter>
16+
</ClInclude>
17+
</ItemGroup>
18+
</Project>

luaclib/luaclib.sln

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,68 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lpeg", "lpeg\lpeg.vcxproj",
1111
EndProject
1212
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mime", "mime\mime.vcxproj", "{2691C520-B01B-46AB-B585-716767F72A9F}"
1313
EndProject
14-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pbc", "pb\pbc.vcxproj", "{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}"
14+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "protobuf", "pb\pbc.vcxproj", "{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}"
15+
EndProject
16+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common\common.vcxproj", "{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}"
1517
EndProject
1618
Global
1719
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20+
Debug|ARM = Debug|ARM
1821
Debug|Win32 = Debug|Win32
22+
Debug|x64 = Debug|x64
23+
Release|ARM = Release|ARM
1924
Release|Win32 = Release|Win32
25+
Release|x64 = Release|x64
2026
EndGlobalSection
2127
GlobalSection(ProjectConfigurationPlatforms) = postSolution
28+
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Debug|ARM.ActiveCfg = Debug|Win32
2229
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Debug|Win32.ActiveCfg = Debug|Win32
2330
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Debug|Win32.Build.0 = Debug|Win32
31+
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Debug|x64.ActiveCfg = Debug|Win32
32+
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Release|ARM.ActiveCfg = Release|Win32
2433
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Release|Win32.ActiveCfg = Release|Win32
2534
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Release|Win32.Build.0 = Release|Win32
35+
{933BAD43-4B46-4BC1-A943-7825C5946B23}.Release|x64.ActiveCfg = Release|Win32
36+
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Debug|ARM.ActiveCfg = Debug|Win32
2637
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Debug|Win32.ActiveCfg = Debug|Win32
2738
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Debug|Win32.Build.0 = Debug|Win32
39+
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Debug|x64.ActiveCfg = Debug|Win32
40+
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Release|ARM.ActiveCfg = Release|Win32
2841
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Release|Win32.ActiveCfg = Release|Win32
2942
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Release|Win32.Build.0 = Release|Win32
43+
{BB87BCAD-A936-4A83-8A9C-1BCFE8B7393E}.Release|x64.ActiveCfg = Release|Win32
44+
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Debug|ARM.ActiveCfg = Debug|Win32
3045
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Debug|Win32.ActiveCfg = Debug|Win32
3146
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Debug|Win32.Build.0 = Debug|Win32
47+
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Debug|x64.ActiveCfg = Debug|Win32
48+
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Release|ARM.ActiveCfg = Release|Win32
3249
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Release|Win32.ActiveCfg = Release|Win32
3350
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Release|Win32.Build.0 = Release|Win32
51+
{3350DD32-C039-442E-94D5-DAB4E4A0A4C8}.Release|x64.ActiveCfg = Release|Win32
52+
{2691C520-B01B-46AB-B585-716767F72A9F}.Debug|ARM.ActiveCfg = Debug|Win32
3453
{2691C520-B01B-46AB-B585-716767F72A9F}.Debug|Win32.ActiveCfg = Debug|Win32
3554
{2691C520-B01B-46AB-B585-716767F72A9F}.Debug|Win32.Build.0 = Debug|Win32
55+
{2691C520-B01B-46AB-B585-716767F72A9F}.Debug|x64.ActiveCfg = Debug|Win32
56+
{2691C520-B01B-46AB-B585-716767F72A9F}.Release|ARM.ActiveCfg = Release|Win32
3657
{2691C520-B01B-46AB-B585-716767F72A9F}.Release|Win32.ActiveCfg = Release|Win32
3758
{2691C520-B01B-46AB-B585-716767F72A9F}.Release|Win32.Build.0 = Release|Win32
59+
{2691C520-B01B-46AB-B585-716767F72A9F}.Release|x64.ActiveCfg = Release|Win32
60+
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Debug|ARM.ActiveCfg = Debug|Win32
3861
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Debug|Win32.ActiveCfg = Debug|Win32
3962
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Debug|Win32.Build.0 = Debug|Win32
63+
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Debug|x64.ActiveCfg = Debug|Win32
64+
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Release|ARM.ActiveCfg = Release|Win32
4065
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Release|Win32.ActiveCfg = Release|Win32
4166
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Release|Win32.Build.0 = Release|Win32
67+
{EB20378F-8EE9-4DF1-9EE7-87BFB769F2FE}.Release|x64.ActiveCfg = Release|Win32
68+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Debug|ARM.ActiveCfg = Debug|Win32
69+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Debug|Win32.ActiveCfg = Debug|Win32
70+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Debug|Win32.Build.0 = Debug|Win32
71+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Debug|x64.ActiveCfg = Debug|Win32
72+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Release|ARM.ActiveCfg = Release|Win32
73+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Release|Win32.ActiveCfg = Release|Win32
74+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Release|Win32.Build.0 = Release|Win32
75+
{F09D4DFA-1E4E-4D19-8FBD-95F602ACC371}.Release|x64.ActiveCfg = Release|Win32
4276
EndGlobalSection
4377
GlobalSection(SolutionProperties) = preSolution
4478
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)