Skip to content

Commit

Permalink
add all
Browse files Browse the repository at this point in the history
  • Loading branch information
setuppf committed Dec 3, 2019
1 parent 3a74c2a commit fc80123
Show file tree
Hide file tree
Showing 5,716 changed files with 1,696,867 additions and 1 deletion.
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 13 additions & 0 deletions 00_01_gcc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 2.8)
project(test)
set(CMAKE_BUILD_TYPE Debug)

aux_source_directory(. SRCS)
include_directories(/usr/include)

set(CMAKE_CXX_FLAGS "-Wall -std=c++14")
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -O0 -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

Link_directories(/usr/local/lib)
add_executable(test ${SRCS})
6 changes: 6 additions & 0 deletions 00_01_gcc/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <cstdio>

int main( int argc, char *argv[] ) {
printf("Hello, world!\n");
return 0;
}
23 changes: 23 additions & 0 deletions 00_02_gdb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 2.8)

set(CMAKE_BUILD_TYPE Debug)
set(MyProjectName core_null_d)

project(${MyProjectName})

message(STATUS "CMAKE_BINARY_DIR:${CMAKE_BINARY_DIR}")
message(STATUS "CMAKE_BUILD_TYPE:${CMAKE_BUILD_TYPE}")
message(STATUS "MyProjectName:${MyProjectName}")


aux_source_directory(. SRCS)

include_directories(/usr/include)

set(CMAKE_CXX_FLAGS "-Wall -std=c++14")
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -O0 -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

link_directories(/usr/local/lib)

add_executable(${MyProjectName} ${SRCS})
10 changes: 10 additions & 0 deletions 00_02_gdb/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <stdio.h>

int main( void ) {
printf("hello world! dump core. /n");
char* pChar;
*pChar = '0';

return 0;

}
31 changes: 31 additions & 0 deletions 01_01_network_first/make-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
args=$1

buildType="Debug"
clean=false

if [ ${args}v = "release"v ];then
buildType="Release"
elif [ ${args}v = "clean"v ];then
clean=true
fi


build(){
for i in `ls -d */`;do
cd $i
if ${clean};then
rm CMakeCache.txt
make clean
else
cmake3 -DCMAKE_BUILD_TYPE=${buildType} ./
make
fi
cd ..
done
}

cd src/libs/
build

cd ../apps/
build
68 changes: 68 additions & 0 deletions 01_01_network_first/network.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client", "src\apps\client\client.vcxproj", "{D0100874-4D7E-49FD-9CD6-BF66578962FD}"
ProjectSection(ProjectDependencies) = postProject
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5} = {07CE9E74-2C56-4379-88C5-A7086A8DBCD5}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "server", "src\apps\server\server.vcxproj", "{D8E72A12-90E3-4C20-A725-16662DB439CA}"
ProjectSection(ProjectDependencies) = postProject
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5} = {07CE9E74-2C56-4379-88C5-A7086A8DBCD5}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apps", "apps", "{03909E62-0FD5-44B3-8553-AA6B4A8C07DE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{F93E11B6-8D8F-4DF8-B2C9-51F116FF48E4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "network", "src\libs\network\network.vcxproj", "{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{39BBC6EA-B9B3-4DE3-82EB-FADA8FC8761B}"
ProjectSection(SolutionItems) = preProject
make-all.sh = make-all.sh
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Debug|x64.ActiveCfg = Debug|x64
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Debug|x64.Build.0 = Debug|x64
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Debug|x86.ActiveCfg = Debug|Win32
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Debug|x86.Build.0 = Debug|Win32
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Release|x64.ActiveCfg = Release|x64
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Release|x64.Build.0 = Release|x64
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Release|x86.ActiveCfg = Release|Win32
{D0100874-4D7E-49FD-9CD6-BF66578962FD}.Release|x86.Build.0 = Release|Win32
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Debug|x64.ActiveCfg = Debug|x64
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Debug|x64.Build.0 = Debug|x64
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Debug|x86.ActiveCfg = Debug|Win32
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Debug|x86.Build.0 = Debug|Win32
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Release|x64.ActiveCfg = Release|x64
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Release|x64.Build.0 = Release|x64
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Release|x86.ActiveCfg = Release|Win32
{D8E72A12-90E3-4C20-A725-16662DB439CA}.Release|x86.Build.0 = Release|Win32
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Debug|x64.ActiveCfg = Debug|x64
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Debug|x64.Build.0 = Debug|x64
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Debug|x86.ActiveCfg = Debug|Win32
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Debug|x86.Build.0 = Debug|Win32
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Release|x64.ActiveCfg = Release|x64
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Release|x64.Build.0 = Release|x64
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Release|x86.ActiveCfg = Release|Win32
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D0100874-4D7E-49FD-9CD6-BF66578962FD} = {03909E62-0FD5-44B3-8553-AA6B4A8C07DE}
{D8E72A12-90E3-4C20-A725-16662DB439CA} = {03909E62-0FD5-44B3-8553-AA6B4A8C07DE}
{07CE9E74-2C56-4379-88C5-A7086A8DBCD5} = {F93E11B6-8D8F-4DF8-B2C9-51F116FF48E4}
EndGlobalSection
EndGlobal
32 changes: 32 additions & 0 deletions 01_01_network_first/src/apps/client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 2.8)

if (CMAKE_BUILD_TYPE STREQUAL Release)
set(MyProjectName client)
set(MyLibNetWorkName network.a)
else()
set(CMAKE_BUILD_TYPE Debug)
set(MyProjectName clientd)
set(MyLibNetWorkName networkd.a)
endif()

message(STATUS "CMAKE_BINARY_DIR:${CMAKE_BINARY_DIR}")
message(STATUS "CMAKE_BUILD_TYPE:${CMAKE_BUILD_TYPE}")
message(STATUS "ProjectName:${MyProjectName}")
message(STATUS "NetworklibName:${MyLibNetWorkName}")

project(${MyProjectName})

aux_source_directory(. SRCS)

include_directories(../../libs)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../../../bin")

set(CMAKE_CXX_FLAGS "-Wall -std=c++14")
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -O0 -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")

link_directories(${CMAKE_BINARY_DIR}/../../../libs)

add_executable(${MyProjectName} ${SRCS})
target_link_libraries(${MyProjectName} ${MyLibNetWorkName})
43 changes: 43 additions & 0 deletions 01_01_network_first/src/apps/client/client.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@


#include <iostream>

#include "network/network.h"

int main(int argc, char *argv[])
{
_sock_init();
SOCKET socket = ::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (socket == INVALID_SOCKET)
{
std::cout << "::socket failed. err:" << _sock_err() << std::endl;
return 1;
}

sockaddr_in addr;
memset(&addr, 0, sizeof(sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_port = htons(2233);
::inet_pton(AF_INET, "127.0.0.1", &addr.sin_addr.s_addr);

if (::connect(socket, (struct sockaddr *)&addr, sizeof(sockaddr)) < 0)
{
std::cout << "::connect failed. err:" << _sock_err() << std::endl;
return 1;
}

std::string msg = "ping";
::send(socket, msg.c_str(), msg.length(), 0);

std::cout << "::send msg:" << msg.c_str() << std::endl;

char buffer[1024];
memset(&buffer, 0, sizeof(buffer));
::recv(socket, buffer, 1024, 0);
std::cout << "::recv msg:" << buffer << std::endl;

_sock_close(socket);
_sock_exit();
return 0;
}

161 changes: 161 additions & 0 deletions 01_01_network_first/src/apps/client/client.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D0100874-4D7E-49FD-9CD6-BF66578962FD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>client</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<IncludePath>../../libs/;$(IncludePath)</IncludePath>
<LibraryPath>../../../libs/$(Configuration)/;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)bin\$(Configuration)\</OutDir>
<LibraryPath>../../../libs/$(Configuration)/;$(LibraryPath)</LibraryPath>
<IncludePath>../../libs/;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;network.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>ws2_32.lib;network.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="client.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Loading

0 comments on commit fc80123

Please sign in to comment.