POV-Ray : Newsgroups : povray.programming : Interested in CMake support (build system, IDE integration) Server Time
30 May 2024 07:54:36 EDT (-0400)
  Interested in CMake support (build system, IDE integration) (Message 21 to 25 of 25)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: LanuHum
Subject: Re: Interested in CMake support (build system, IDE integration)
Date: 22 Oct 2016 06:45:00
Message: <web.580b4292dc6ec2767a3e03fe0@news.povray.org>
For example, the structure is different from the master and hgpovray.
Now I understand why stupid written configuration files gnumake.
CMakeListsGenerator.py

import os,sys

external_library = ['SDL','ILMBASE','OPENEXR','JPEG','PNG','TIFF']
pkg_modules = ['sdl','IlmBase','OpenEXR','libtiff-4']
cmake_names = ['SDL','ILMBASE','OPENEXR','TIFF']
cmake_packages = ['PkgConfig','JPEG','PNG']

cmakelist = open('CMakeLists.txt','w')
cmakelist.write('cmake_minimum_required(VERSION 2.8)\n\n')
cmakelist.write('project(povanim)\n\n')
if sys.platform in {'linux'}:
    cmakelist.write('set( CMAKE_CXX_FLAGS "-pipe -Wno-multichar \\\n')
    cmakelist.write('   -Wno-write-strings -fno-enforce-eh-specs \\\n')
    cmakelist.write('   -Wno-non-template-friend -s -O3 \\\n')
    cmakelist.write('   -ffast-math -march=native -pthread")\n\n')

sources = {}
unix_source_folders = {'source', 'platform', 'unix', 'vfe'}
win_source_folders = {'source', 'platform', 'windows', 'vfe'}
if sys.platform in {'linux'}:
    source_folders = unix_source_folders

if sys.platform[:3] == 'win':
    source_folders = win_source_folders
root_dir = os.getcwd()
root = root_dir.split('/')[-1]

prefix='POVRAY'

for folder in source_folders:
    source_key = folder.upper()
    source_key = prefix + '_' + source_key
    source_dir1 = os.path.join(root_dir,folder)
    value = source_dir1.split('/')
    plus = False
    source_value = ''
    for v in value:
        if v == root:
            plus = True
            continue
        if plus:
            source_value += v
            plus = False
    sources[source_key] = source_value
    src1 = os.listdir(source_dir1)
    for ob in src1:
        source_dir2 = os.path.join(source_dir1,ob)
        source_key1 = source_key
        if os.path.isdir(source_dir2):
            src2 = os.listdir(source_dir2)
            isCPP = False
            for ob1 in src2:
                if ob1.endswith('.cpp'):
                    isCPP = True
                    break
            if isCPP:
                source_key1 += ('_' + ob.upper())
                source_value1 = source_value
                source_value1 += ('/' + ob)
                sources[source_key1] = source_value1
                for ob1 in src2:
                    source_dir3 = os.path.join(source_dir2,ob1)
                    source_key2 = source_key1
                    if os.path.isdir(source_dir3):
                        src3 = os.listdir(source_dir3)
                        isCPP1 = False
                        for ob2 in src3:
                            if ob2.endswith('.cpp'):
                                isCPP1 = True
                                break
                        if isCPP1:
                            source_key2 += ('_' + ob1.upper())
                            source_value2 = source_value1
                            source_value2 += ('/' + ob1)
                            sources[source_key2] = source_value2
                        else:
                            continue
            else:
                continue

for i,k in enumerate(sources):
    cmakelist.write('set(%s    %s)\n'%(k,sources[k]))
cmakelist.write('\n\n')

for i,k in enumerate(sources):
    aux = k.replace('_','')
    cmakelist.write('aux_source_directory( ${%s}    %s)\n'%(k,aux))
cmakelist.write('\n\n')

for pack in cmake_packages:
    cmakelist.write('find_package(%s REQUIRED)\n'%pack)
cmakelist.write('\n\n')

for i,mod in enumerate(pkg_modules):
    cmake_name = mod.upper()
    cmakelist.write('pkg_search_module(%s REQUIRED %s)\n'%(cmake_names[i],mod))
cmakelist.write('\n\n')

cmakelist.write('include_directories(\n')
for i,k in enumerate(sources):
    aux = k.split('_')
    if len(aux) == 2:
        cmakelist.write('       ${%s}\n'%(k))
for lib in external_library:
    cmakelist.write('       ${%s_INCLUDE_DIRS}\n'%lib)
cmakelist.write(')\n')
cmakelist.write('\n\n')

cmakelist.write('add_executable(\n')
cmakelist.write('       ${PROJECT_NAME}\n')
for i,k in enumerate(sources):
    aux = k.replace('_','')
    cmakelist.write('       ${%s}\n'%(aux))
cmakelist.write(')\n')
cmakelist.write('\n\n')

cmakelist.write('target_link_libraries(\n')
cmakelist.write('       ${PROJECT_NAME}\n')

for lib in external_library:
    cmakelist.write('       ${%s_LIBRARIES}\n'%lib)
cmakelist.write('       -lz -lm boost_thread boost_system\n')
cmakelist.write(')\n')

cmakelist.close()


Post a reply to this message

From: clipka
Subject: Re: Interested in CMake support (build system, IDE integration)
Date: 22 Oct 2016 18:36:32
Message: <580be9f0$1@news.povray.org>
Am 22.10.2016 um 12:42 schrieb LanuHum:
> For example, the structure is different from the master and hgpovray.
> Now I understand why stupid written configuration files gnumake.
> CMakeListsGenerator.py

So instead of an Automake script we'd get a Python script?

I'm not sure if this is really a win -- most notably since Automake does
a lot more than just determine what files to compile and what libraries
to link, such as detecting whether particular semi-standard include
files, data types or functions are available (defining all those
HAVE_SOMETHING macros you find scattered throughout the POV-Ray source
code).


Post a reply to this message

From: LanuHum
Subject: Re: Interested in CMake support (build system, IDE integration)
Date: 23 Oct 2016 05:10:00
Message: <web.580c7dd8dc6ec2767a3e03fe0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 22.10.2016 um 12:42 schrieb LanuHum:
> > For example, the structure is different from the master and hgpovray.
> > Now I understand why stupid written configuration files gnumake.
> > CMakeListsGenerator.py
>
> So instead of an Automake script we'd get a Python script?
>
> I'm not sure if this is really a win -- most notably since Automake does
> a lot more than just determine what files to compile and what libraries
> to link, such as detecting whether particular semi-standard include
> files, data types or functions are available (defining all those
> HAVE_SOMETHING macros you find scattered throughout the POV-Ray source
> code).


I do not reinvent the wheel. I just do not know Automake, but need to build the
program. I do not know where I have to write the changes to be included in your
project my files. I found a solution to the primitive, but it works.

My posts on this thread are just an idea.
Someone might want to develop it.
The source code of the blender always had several options for building:
cmake, make and scons.
Scons uses python.


:)


Post a reply to this message

From: Mr
Subject: Re: Interested in CMake support (build system, IDE integration)
Date: 11 Jun 2020 10:55:01
Message: <web.5ee2459ddc6ec2766adeaecb0@news.povray.org>
"LanuHum" <Lan### [at] yandexru> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Am 22.10.2016 um 12:42 schrieb LanuHum:
> > > For example, the structure is different from the master and hgpovray.
> > > Now I understand why stupid written configuration files gnumake.
> > > CMakeListsGenerator.py
> >
> > So instead of an Automake script we'd get a Python script?
> >
> > I'm not sure if this is really a win -- most notably since Automake does
> > a lot more than just determine what files to compile and what libraries
> > to link, such as detecting whether particular semi-standard include
> > files, data types or functions are available (defining all those
> > HAVE_SOMETHING macros you find scattered throughout the POV-Ray source
> > code).
>
>
> I do not reinvent the wheel. I just do not know Automake, but need to build the
> program. I do not know where I have to write the changes to be included in your
> project my files. I found a solution to the primitive, but it works.
>
> My posts on this thread are just an idea.
> Someone might want to develop it.
> The source code of the blender always had several options for building:
> cmake, make and scons.
> Scons uses python.
>
>
> :)


The first CMake repository provided by ideasman42 has been removed :-( I asked
if he had kept an archive and no he didn't ... would any compulsive downloader
have kept a version somwhere? I tried the Internet Archive to no success as
well.


Post a reply to this message

From: Thomas Debe
Subject: Re: Interested in CMake support (build system, IDE integration)
Date: 12 Jun 2020 10:46:26
Message: <5ee39542$1@news.povray.org>
Am 11.06.20 um 16:54 schrieb Mr:
> "LanuHum" <Lan### [at] yandexru> wrote:
>> clipka <ano### [at] anonymousorg> wrote:
>>> Am 22.10.2016 um 12:42 schrieb LanuHum:
>>>> For example, the structure is different from the master and hgpovray.
>>>> Now I understand why stupid written configuration files gnumake.
>>>> CMakeListsGenerator.py
>>>
>>> So instead of an Automake script we'd get a Python script?
>>>
>>> I'm not sure if this is really a win -- most notably since Automake does
>>> a lot more than just determine what files to compile and what libraries
>>> to link, such as detecting whether particular semi-standard include
>>> files, data types or functions are available (defining all those
>>> HAVE_SOMETHING macros you find scattered throughout the POV-Ray source
>>> code).
>>
>>
>> I do not reinvent the wheel. I just do not know Automake, but need to build the
>> program. I do not know where I have to write the changes to be included in your
>> project my files. I found a solution to the primitive, but it works.
>>
>> My posts on this thread are just an idea.
>> Someone might want to develop it.
>> The source code of the blender always had several options for building:
>> cmake, make and scons.
>> Scons uses python.
>>
>>
>> :)
> 
> 
> The first CMake repository provided by ideasman42 has been removed :-( I asked
> if he had kept an archive and no he didn't ... would any compulsive downloader
> have kept a version somwhere? I tried the Internet Archive to no success as
> well.
> 
> 
> 
> 
Hello !
Look at
<5ee393f7$1@news.povray.org>

povray.binaries.programming

regards
Thomas


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.