simple http client
This commit is contained in:
76
http/build.cpp
Normal file
76
http/build.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
#include "helper.h"
|
||||
#include "c.h"
|
||||
#include "ld.h"
|
||||
#include "tier1/utlstring.h"
|
||||
#include "tier1/commandline.h"
|
||||
|
||||
ADD_DEPENDENCY_BUILD_FILE(tier0, "../tier0/build.cpp")
|
||||
ADD_DEPENDENCY_BUILD_FILE(tier1, "../tier1/build.cpp")
|
||||
ADD_DEPENDENCY_BUILD_FILE(tier2, "../tier2/build.cpp")
|
||||
|
||||
DECLARE_BUILD_STAGE(funnyhttp)
|
||||
{
|
||||
CProject_t compileProject = {};
|
||||
LinkProject_t ldProject = {};
|
||||
|
||||
compileProject.m_szName = "funnyhttp";
|
||||
compileProject.files = {
|
||||
"client.cpp"
|
||||
};
|
||||
compileProject.includeDirectories = {"../public"};
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = ccompiler->Compile(&compileProject);
|
||||
ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier1, "tier1")});
|
||||
ldProject.objects.AppendTail({GET_PROJECT_LIBRARY(tier2, "tier2")});
|
||||
ldProject.libraries = {
|
||||
"ssl",
|
||||
"crypto",
|
||||
};
|
||||
ldProject.linkType = ELINK_DYNAMIC_LIBRARY;
|
||||
|
||||
CUtlString szOutputDir = linker->Link(&ldProject);
|
||||
|
||||
ADD_OUTPUT_OBJECT("funnyhttp", szOutputDir)
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
DECLARE_BUILD_STAGE(test)
|
||||
{
|
||||
|
||||
CProject_t compileProject = {};
|
||||
LinkProject_t ldProject = {};
|
||||
|
||||
filesystem2->MakeDirectory("build");
|
||||
filesystem2->CopyFile("build",GET_PROJECT_LIBRARY(funnyhttp, "funnyhttp"));
|
||||
filesystem2->CopyFile("build",GET_PROJECT_LIBRARY(tier0, "tier0"));
|
||||
|
||||
compileProject.m_szName = "funnyhttptest";
|
||||
compileProject.files = {
|
||||
"test.cpp"
|
||||
};
|
||||
compileProject.includeDirectories = {"../public"};
|
||||
compileProject.bFPIC = true;
|
||||
ldProject = ccompiler->Compile(&compileProject);
|
||||
ldProject.libraryObjects = {
|
||||
GET_PROJECT_LIBRARY(tier1, "tier1"),
|
||||
GET_PROJECT_LIBRARY(tier2, "tier2"),
|
||||
};
|
||||
ldProject.libraries = {
|
||||
"tier0",
|
||||
};
|
||||
ldProject.libraryDirectories = {
|
||||
"build",
|
||||
};
|
||||
ldProject.linkType = ELINK_EXECUTABLE;
|
||||
CUtlString szOutputDir = linker->Link(&ldProject);
|
||||
|
||||
filesystem2->CopyFile("build",szOutputDir);
|
||||
|
||||
|
||||
CUtlVector<CUtlString> args = {};
|
||||
runner->Run("build/funnyhttptest", args);
|
||||
runner->Wait();
|
||||
|
||||
return 0;
|
||||
};
|
||||
Reference in New Issue
Block a user