How to build C++ code using scons for solaris compatible OS using jenkins?

断了今生、忘了曾经 提交于 2020-12-15 05:49:06

问题


Here is my C++ code:

#include<iostream>
int main()
{
   std::cout<<"Starting Program"<<std::endl;
   int a = 10;
   int b = 20;
   int c = a + b;
   std::cout<<"Sum of A and B is "<<c<<std::endl;
   std::cout<<"Ending Program"<<std::endl;
   return 0;
}

Here is my SConstruct script file:

env = Environment(platform='sunos')
env.Program('hello.C')

Does above SConstruct file is correct to build hello.C for solaris ? Will this work. Any suggestions.


回答1:


This is how I would do it:

  1. Setup a Solaris machine x86/SPARC
  2. Install SCons, GCC, other dependencies
  3. Set it up as a Jenkins node

I believe SCons will select the GCC toolchain on any non-windows host, so no need for platform='sunos' environment.




回答2:


No need to specify platform

env = Environment()
env.Program('hello.C')

Should suffice.

It doesn't matter what platform your jenkins is running on, as long as your build worker is on Solaris, SCons will detect that and try to build.



来源:https://stackoverflow.com/questions/64693630/how-to-build-c-code-using-scons-for-solaris-compatible-os-using-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!