当前位置: 首页 > news >正文

站长网站优点服务器代理加盟

站长网站优点,服务器代理加盟,wordpress 企业主页,昆明做网站需要多少钱文章目录 1、简介2、下载和安装2.1 下载2.3 快速入门 3、使用3.1 支持的工程文件Project Files3.2 构建设置Build Settings3.3 链接Linking3.4 配置Configurations3.5 平台Platforms3.6 过滤Filters3.7 预设值Tokens 4、测试4.1 测试1#xff1a;入门例子4.2 测试2#xff1a… 文章目录 1、简介2、下载和安装2.1 下载2.3 快速入门 3、使用3.1 支持的工程文件Project Files3.2 构建设置Build Settings3.3 链接Linking3.4 配置Configurations3.5 平台Platforms3.6 过滤Filters3.7 预设值Tokens 4、测试4.1 测试1入门例子4.2 测试2入门例子24.3 测试3glfw例子4.3.1 准备第三方库glfw4.3.2 新建封装库项目ExampleDll4.3.3 新建测试项目ExampleTest4.3.4 新建构建脚本4.3.5 执行构建命令 结语 1、简介 Premake是一个命令行实用程序它读取软件项目的脚本定义最常见的是使用它为Visual StudioXcode或GNU Make等工具集生成项目文件。 官网地址 https://premake.github.io/ 什么是构建系统 构建系统BuildSystem是用来从源码生成用户可以使用的目标Targets的自动化工具。目标可以包括库可执行文件或者生成的脚本等等。 项目模块依赖关系维护 目标的可配置化不同系统WindowsMac…不同平台Win32Win64Amd64…目标生成的自动化 常见的构建系统 主流的可以跨平台支持C的构建系统 CMakeSconsPremakeGNU MakeGNU autotoolsApache Ant主要用于JavaGradle主要用于Java Premake生成的目标工程 Premake 5.0 的当前开发版本可以生成针对以下目标的 C、C 或 C# 项目 Microsoft Visual Studio 2005-2019GNU Make, including Cygwin and MinGWXcodeCodelite 2、下载和安装 2.1 下载 https://premake.github.io/download 这里我们下载编译好的sdk开发包解压如下 2.3 快速入门 1、新建测试文件夹test mkdir test cd test2、新建构建脚本premake5.lua premake5.lua的内容如下 workspace XiaomuWorkspaceconfigurations { Debug, Release }project XiaomuProjectkind ConsoleApplanguage Cfiles { **.h, **.cpp }filter { configurations:Debug }defines { DEBUG }symbols Onfilter { configurations:Release }defines { NDEBUG }optimize On3、执行构建命令生成指定工程 Premake5 vs2017生成文件如下 3、使用 3.1 支持的工程文件Project Files ActionDescriptionvs2022Generate Visual Studio 2022 project filesvs2019Generate Visual Studio 2019 project filesvs2017Generate Visual Studio 2017 project filesvs2015Generate Visual Studio 2015 project filesvs2013Generate Visual Studio 2013 project filesvs2012Generate Visual Studio 2012 project filesvs2010Generate Visual Studio 2010 project filesvs2008Generate Visual Studio 2008 project filesvs2005Generate Visual Studio 2005 project filesgmakeGenerate GNU Makefiles (This generator is deprecated by gmake2)gmake2Generate GNU Makefiles (including Cygwin and MinGW)xcode4XCode projectscodeliteCodeLite projects 若要生成 Visual Studio 2013 项目文件请使用以下命令 premake5 vs20133.2 构建设置Build Settings 设置名称设置标志指定二进制类型可执行文件、库kind指定源代码文件files, removefiles定义编译器或预处理器符号defines找到包含文件includedirs设置预编译标头pchheader, pchsource链接库、框架或其他项目links, libdirs启用调试信息symbols针对尺寸或速度进行优化optimize添加任意构建标志buildoptions, linkoptions设置已编译目标的名称或位置targetname, targetdir defines { DEBUG, TRACE } defines { CALLSPEC__dllexport }includedirs { ../lua/include, ../zlib } includedirs { ../includes/** }pchheader myproject.hoptimize Speedfilter { system:linux, action:gmake }buildoptions { wx-config --cxxflags, -ansi, -pedantic }targetname mytarget3.3 链接Linking 1链接到外部库是通过links 功能完成的。 links { png, zlib }2links 指令的位置在project 下面设置。 workspace MyWorkspaceproject MyLibraryProject-- ...project settings here...project MyExecutableProject-- ...project settings here...links { MyLibraryProject }3而查找库则使用如下指令。 libdirs { libs, ../mylibs } # or libdirs { os.findlib(X11) }3.4 配置Configurations 配置是要应用于构建的设置集合包括标志和开关、头文件和库搜索目录等。每个工作区定义自己的配置名称列表;大多数 IDE 提供的默认值是“调试”和“发布”。 workspace MyWorkspaceconfigurations { Debug, Release }workspace MyWorkspaceconfigurations { Debug, DebugDLL, Release, ReleaseDLL }workspace MyWorkspaceconfigurations { Froobniz, Fozbat, Cthulhu }workspace HelloWorldconfigurations { Debug, Release }filter configurations:Debugdefines { DEBUG }flags { Symbols }filter configurations:Releasedefines { NDEBUG }optimize On3.5 平台Platforms “平台”在这里有点用词不当;我再次遵循Visual Studio命名法。实际上平台只是另一组构建配置名称提供了另一个方向用于配置项目。 configurations { Debug, Release } platforms { Win32, Win64, Xbox360 }configurations { Debug, Release } platforms { Win32, Win64, Xbox360 }filter { platforms:Win32 }system Windowsarchitecture x86filter { platforms:Win64 }system Windowsarchitecture x86_64filter { platforms:Xbox360 }system Xbox360configurations { Debug, Release } platforms { Static, DLL }filter { platforms:Static }kind StaticLibfilter { platforms:DLL }kind SharedLibdefines { DLL_EXPORTS }3.6 过滤Filters project MyProjectfilter { configurations:Debug }targetdir bin/debugfilter { configurations:Release }targetdir bin/release3.7 预设值Tokens wks.name wks.location -- (location where the workspace/solution is written, not the premake-wks.lua file)prj.name prj.location -- (location where the project is written, not the premake-prj.lua file) prj.language prj.groupcfg.longname cfg.shortname cfg.kind cfg.architecture cfg.platform cfg.system cfg.buildcfg cfg.buildtarget -- (see [target], below) cfg.linktarget -- (see [target], below) cfg.objdirfile.path file.abspath file.relpath file.directory file.reldirectory file.name file.basename -- (file part without extension) file.extension -- (including .; eg .cpp)-- These values are available on build and link targets -- Replace [target] with one of cfg.buildtarget or cfg.linktarget -- Eg: %{cfg.buildtarget.abspath} [target].abspath [target].relpath [target].directory [target].name [target].basename -- (file part without extension) [target].extension -- (including .; eg .cpp) [target].bundlename [target].bundlepath [target].prefix [target].suffix4、测试 4.1 测试1入门例子 新建文件夹test001 mkdir test001 cd test001新建代码文件hello.c /* hello.c */ #include stdio.hint main(void) {puts(Hello, world! 爱看书的小沐);return 0; }新建构建脚本文件premake5.lua -- premake5.lua workspace XiaoMuProjectconfigurations { Debug, Release }project XiaoMu001kind ConsoleApplanguage Ctargetdir bin/%{cfg.buildcfg}files { **.h, **.c }filter configurations:Debugdefines { DEBUG }symbols Onfilter configurations:Releasedefines { NDEBUG }optimize On执行构建命令如下 # premake5 --fileMyProjectScript.lua vs2013 premake5 vs2017结果如下 用vs2017打开上面生成的工程文件 4.2 测试2入门例子2 premake5.lua workspace XiaMuTest002 -- 解决方案startproject Test -- 开始项目configurations{Debug,Release}platforms{Win32,Win64}filter platforms:Win32system Windowsarchitecture x32filter platforms:Win64system Windowsarchitecture x86_64outputdir %{cfg.platform}/%{cfg.buildcfg}/%{prj.name} project XiaMuTest002kind ConsoleApplanguage Cfiles{./**.cpp,*.c}targetdir(../bin/ .. outputdir)objdir(../obj/ .. outputdir)4.3 测试3glfw例子 4.3.1 准备第三方库glfw https://github.com/glfw/glfw/releases 下载完毕之后解压到文件夹如下 4.3.2 新建封装库项目ExampleDll ExampleDll.h #ifndef EXAMPLE_DLL_HPP #define EXAMPLE_DLL_HPP 1#include string #include memory struct GLFWwindow;namespace ExDLL { class _declspec(dllexport) Window{public:Window(int width, int height, const std::string title);~Window();bool shouldClose() const noexcept;void pollEvents() const noexcept;void swapBuffers() const noexcept;std::pairint, int getWindowSize() const noexcept; private:GLFWwindow* wnd;}; } #endifExampleDll.cpp #include ExampleDll.h #include GLFW/glfw3.hnamespace ExDLL {Window::Window(int width, int height, const std::string title){glfwInit();wnd glfwCreateWindow(width, height, title.c_str(), nullptr, nullptr);glfwMakeContextCurrent(wnd);}Window::~Window(){glfwDestroyWindow(wnd);glfwTerminate();}bool Window::shouldClose() const noexcept{return glfwWindowShouldClose(wnd) ! 0;}void Window::pollEvents() const noexcept{glfwPollEvents();}void Window::swapBuffers() const noexcept{glfwSwapBuffers(wnd);}std::pairint, int Window::getWindowSize() const noexcept{std::pairint, int sz{};glfwGetWindowSize(wnd, sz.first, sz.second);return sz;} }4.3.3 新建测试项目ExampleTest main.cpp #include ExampleDll.h#if defined _WIN32#include Windows.h#pragma comment(linker,/subsystem:\windows\ /entry:\mainCRTStartup\) #endif #include gl/GL.h//导入ExampleDll中的Window类 class _declspec(dllimport) ExDLL::Window;int main() {ExDLL::Window window{ 1000, 600, Hello World! 爱看书的小沐,2023 };while (!window.shouldClose()){// 事件更新window.pollEvents();// 绘图glBegin(GL_TRIANGLES);glColor3f(1.0, 0.0, 0.0);glVertex2f(-0.5f, -0.5f);glColor3f(1.0, 1.0, 0.0);glVertex2f(0.5f, -0.5f);glColor3f(1.0, 0.0, 1.0);glVertex2f(0, 0.5f);glEnd();// 渲染更新window.swapBuffers();}return 0; }4.3.4 新建构建脚本 premake5.lua workspace XiaoMuTest003startproject ExampleTest -- 开始项目location vslanguage Carchitecture x64configurations {Debug,Release}filter {configurations:Debug}symbols Onfilter {configurations:Release}optimize On-- 重置过滤器的其他设定filter {}targetdir (build/target/%{prj.name}/%{cfg.longname})objdir (build/obj/%{prj.name}/%{cfg.longname})postbuildcommands{({COPY} %{cfg.buildtarget.relpath} \../bin/\)}-- 定义函数包含glfw三方库头文件可被其他工程调用 function includeGLFW()includedirs ../3rd/glfw-3.3.8.bin.WIN64/include end-- 定义函数链接glfw三方库 function linkGLFW()libdirs ../3rd/glfw-3.3.8.bin.WIN64/lib-vc2017links glfw3dll end-- ExampleDll项目 project ExampleDllkind SharedLibfiles src/ExampleDll/**includeGLFW()linkGLFW()-- 定义函数链接ExampleDll动态库 function useExampleDLL()includedirs src/ExampleDlllinks ExampleDll end-- App应用程序 project ExampleTestkind ConsoleAppfiles src/ExampleTest/**useExampleDLL()filter system:windowslinks {OpenGL32}4.3.5 执行构建命令 最后构建的文件夹和里面存放的文件组织如下 premake5 vs2017vs2017打开生成的工程文件如下 编译和运行后 结语 如果您觉得该方法或代码有一点点用处可以给作者点个赞或打赏杯咖啡╮(▽)╭ 如果您感觉方法或代码不咋地//(ㄒoㄒ)//就在评论处留言作者继续改进o_O??? 如果您需要相关功能的代码定制化开发可以留言私信作者(✿◡‿◡) 感谢各位大佬童鞋们的支持( ´ ▽´ ) ( ´ ▽´)っ
http://www.dnsts.com.cn/news/227816.html

相关文章:

  • 网站建设是不是无形资产网站建设项目可行性研究报告
  • 英文书 影印版 网站开发太原网站 制作
  • 开发区网站开发语言我是一条龙
  • wordpress大站自己可以做装修效果图的网站
  • 昌吉网站建设哪家便宜长春网络营销
  • 个人网站名称创意大全手机设计画图软件
  • 移动网站不备案吗网站建设最高管理权限
  • 池州网站建设有哪些公司app下载官网入口
  • 新开传奇网站一盐城做网站哪家公司好
  • 网站服务建设公司平面设计公司网站
  • 青岛城阳网站建设一个公司的管理流程
  • 济南街道办网站建设井陉网站建设
  • 建设银行官网首页网站购纪念币wordpress超链接插件
  • 北京网站设计入门国际展览有限公司
  • 网站建设流程是这样的深圳设计网站排名
  • 陕西省建设执业注册中心网站惠州外贸网站建设推广
  • 免费个人网站制作设计装一个erp系统多少钱
  • 简单的网站开发流程图在网上做国际快递淘宝网站
  • 互联网网站建设趋势用html5做网站百度经验
  • wap网站 什么意思数字营销成功案例
  • 哪些网站可以做引流深圳seo网站推广方案
  • 网站页面模板 建设中北京网站建设文章
  • 天津建设网站天津市地铁规划图TOP域名是什么网站
  • 网站被现在做网站还有用吗
  • 网站开发开发语言建设ftp网站怎么创建数据库
  • 模板网站有利于优化企业内训
  • 外贸做网站用什么简述制作网站的步骤和过程
  • 网站方案建设书模板上海手机网站建设哪家专业
  • 免费炫酷企业网站源码广西住房和城乡建设厅网上办事大厅
  • 广东省网站备案济南营销网站建设公司