VisualStudio용 StaticLib 적용하기를 도와주는 헬퍼 유틸

#include "ofApp.h"
#include "ofFileUtils.h"

//========================================================================

vector<string> each_lib_infos;
vector<string> include_dirs;
vector<string> lib_dirs;
const string ENDL = "\r\n";

string GetAllFileInDir(ofDirectory dir)
{
    stringstream ss;
    vector<ofFile> files = dir.getFiles();

    ss << ENDL;

    int found_include_count = 0;
    vector<string> lib_files;

    for (ofFile f : files)
    {
        if (f.isDirectory() == true)
        {
            GetAllFileInDir(ofDirectory(f.path()));
        }

        if (f.getExtension() == "lib")
        {
            lib_files.push_back(f.getFileName());
        }
        else if (f.getExtension() == "h" || f.getExtension() == "hpp" || f.getExtension() == "cpp")
        {
            found_include_count++;
        }
    }

    if (lib_files.size() > 0)
    {
        ss << "[ LIB LIST ] : " << ENDL;
        ss << "dir : " << dir.getAbsolutePath() << ENDL;
        ss << "=============================================" << ENDL;
        ss << ENDL;
        for (string str : lib_files)
        {
            ss << str << ENDL;
        }
        ss << ENDL;
        ss << "- short_cuts -" << ENDL;
        for (string str : lib_files)
        {
            ss << str << ";";
        }
        ss << ENDL;
        ss << ENDL;
        ss << ENDL;
        ss << ENDL;
        each_lib_infos.push_back(ss.str());

        lib_dirs.push_back(dir.getAbsolutePath());
    }

    if (found_include_count > 0)
    {
        include_dirs.push_back(dir.getAbsolutePath());
    }

    return ss.str();
}


int main() {
    of::priv::initutils(); // 중요
    ofDirectory dir(ofFilePath::getCurrentExeDir());

    GetAllFileInDir(dir);

    ofFile output_file("../output.txt", ofFile::WriteOnly);
    stringstream ss;


    //
    // short_cur_prints
    //
    ss.clear();
    ss << ENDL;
    ss << ENDL;
    ss << "★★★[ for Visual Studio Project Properites ]★★★" << ENDL;;
    ss << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << ENDL;
    ss << ENDL;
    output_file << ss << ENDL;

    if (include_dirs.size() > 0)
    {
        ss.clear();
        ss << "< Additional Include Directories > " << ENDL;
        for (string str : include_dirs)
        {
            ss << str << ";";
        }
        ss << ENDL;
        ss << ENDL;
        output_file << ss << ENDL;

    }



    if (lib_dirs.size() > 0)
    {
        ss.clear();
        ss << " < Additional Library Directories > " << ENDL;
        for (string str : lib_dirs)
        {
            ss << str << ";";
        }
        ss << ENDL;
        ss << ENDL;
        output_file << ss << ENDL;
    }

    ss.clear();
    ss << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << ENDL;
    output_file << ss << ENDL;



    //
    // actual paths and file list
    //

    ss.clear();
    ss << ENDL << ENDL << ENDL << ENDL << ENDL << ENDL;
    ss << "[ INCLUDE DIR LIST ]" << ENDL;
    ss << "------------------------------------------" << ENDL;
    ss << ENDL;
    for (string str : include_dirs)
    {
        ss << str << ENDL;
    }
    ss << ENDL;
    ss << ENDL;
    ss << "------------------------------------------" << ENDL;
    ss << ENDL;
    ss << ENDL;
    ss << ENDL;
    ss << ENDL;

    output_file << ss << ENDL;

    ss << ENDL << ENDL << ENDL;
    for (string str : each_lib_infos)
    {
        output_file << str << ENDL;
    }


    //output_file << "A" << "\r\n" << "B";
    output_file.close();
    return 0;
}



StaticLibSettingHelper.exe





 


결과 예제 


★★★[ for Visual Studio Project Properites ]★★★

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



< Additional Include Directories > 

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\calib3d;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\contrib;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\core;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\features2d;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\flann;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\gpu\device\detail;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\gpu\device;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\gpu;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\highgui;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\imgproc;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\legacy;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\ml;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\nonfree;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\objdetect;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\photo;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\stitching\detail;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\stitching;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\superres;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\ts;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\video;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\videostab;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2;



 < Additional Library Directories > 

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\Win32\Debug;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\Win32\Release;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\x64\Debug;I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\x64\Release;



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~








[ INCLUDE DIR LIST ]

------------------------------------------


I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\calib3d

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\contrib

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\core

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\features2d

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\flann

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\gpu\device\detail

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\gpu\device

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\gpu

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\highgui

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\imgproc

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\legacy

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\ml

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\nonfree

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\objdetect

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\photo

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\stitching\detail

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\stitching

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\superres

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\ts

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\video

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2\videostab

I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\include\opencv2



------------------------------------------







[ LIB LIST ] : 

dir : I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\Win32\Debug

=============================================


opencv_calib3d249d.lib

opencv_contrib249d.lib

opencv_core249d.lib

opencv_features2d249d.lib

opencv_flann249d.lib

opencv_gpu249d.lib

opencv_highgui249d.lib

opencv_imgproc249d.lib

opencv_legacy249d.lib

opencv_ml249d.lib

opencv_nonfree249d.lib

opencv_objdetect249d.lib

opencv_photo249d.lib

opencv_stitching249d.lib

opencv_superres249d.lib

opencv_ts249d.lib

opencv_video249d.lib

opencv_videostab249d.lib

zlibd.lib


- short_cuts -

opencv_calib3d249d.lib;opencv_contrib249d.lib;opencv_core249d.lib;opencv_features2d249d.lib;opencv_flann249d.lib;opencv_gpu249d.lib;opencv_highgui249d.lib;opencv_imgproc249d.lib;opencv_legacy249d.lib;opencv_ml249d.lib;opencv_nonfree249d.lib;opencv_objdetect249d.lib;opencv_photo249d.lib;opencv_stitching249d.lib;opencv_superres249d.lib;opencv_ts249d.lib;opencv_video249d.lib;opencv_videostab249d.lib;zlibd.lib;






[ LIB LIST ] : 

dir : I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\Win32\Release

=============================================


opencv_calib3d249.lib

opencv_contrib249.lib

opencv_core249.lib

opencv_features2d249.lib

opencv_flann249.lib

opencv_gpu249.lib

opencv_highgui249.lib

opencv_imgproc249.lib

opencv_legacy249.lib

opencv_ml249.lib

opencv_nonfree249.lib

opencv_objdetect249.lib

opencv_photo249.lib

opencv_stitching249.lib

opencv_superres249.lib

opencv_ts249.lib

opencv_video249.lib

opencv_videostab249.lib

zlib.lib


- short_cuts -

opencv_calib3d249.lib;opencv_contrib249.lib;opencv_core249.lib;opencv_features2d249.lib;opencv_flann249.lib;opencv_gpu249.lib;opencv_highgui249.lib;opencv_imgproc249.lib;opencv_legacy249.lib;opencv_ml249.lib;opencv_nonfree249.lib;opencv_objdetect249.lib;opencv_photo249.lib;opencv_stitching249.lib;opencv_superres249.lib;opencv_ts249.lib;opencv_video249.lib;opencv_videostab249.lib;zlib.lib;






[ LIB LIST ] : 

dir : I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\x64\Debug

=============================================


opencv_calib3d249d.lib

opencv_contrib249d.lib

opencv_core249d.lib

opencv_features2d249d.lib

opencv_flann249d.lib

opencv_gpu249d.lib

opencv_highgui249d.lib

opencv_imgproc249d.lib

opencv_legacy249d.lib

opencv_ml249d.lib

opencv_nonfree249d.lib

opencv_objdetect249d.lib

opencv_photo249d.lib

opencv_stitching249d.lib

opencv_superres249d.lib

opencv_ts249d.lib

opencv_video249d.lib

opencv_videostab249d.lib

zlibd.lib


- short_cuts -

opencv_calib3d249d.lib;opencv_contrib249d.lib;opencv_core249d.lib;opencv_features2d249d.lib;opencv_flann249d.lib;opencv_gpu249d.lib;opencv_highgui249d.lib;opencv_imgproc249d.lib;opencv_legacy249d.lib;opencv_ml249d.lib;opencv_nonfree249d.lib;opencv_objdetect249d.lib;opencv_photo249d.lib;opencv_stitching249d.lib;opencv_superres249d.lib;opencv_ts249d.lib;opencv_video249d.lib;opencv_videostab249d.lib;zlibd.lib;






[ LIB LIST ] : 

dir : I:/Work\OFWork\of_v0.9_vs_release\apps\myApps\Work\StaticLibSettingUtil\bin\opencv\lib\vs\x64\Release

=============================================


opencv_calib3d249.lib

opencv_contrib249.lib

opencv_core249.lib

opencv_features2d249.lib

opencv_flann249.lib

opencv_gpu249.lib

opencv_highgui249.lib

opencv_imgproc249.lib

opencv_legacy249.lib

opencv_ml249.lib

opencv_nonfree249.lib

opencv_objdetect249.lib

opencv_photo249.lib

opencv_stitching249.lib

opencv_superres249.lib

opencv_ts249.lib

opencv_video249.lib

opencv_videostab249.lib

zlib.lib


- short_cuts -

opencv_calib3d249.lib;opencv_contrib249.lib;opencv_core249.lib;opencv_features2d249.lib;opencv_flann249.lib;opencv_gpu249.lib;opencv_highgui249.lib;opencv_imgproc249.lib;opencv_legacy249.lib;opencv_ml249.lib;opencv_nonfree249.lib;opencv_objdetect249.lib;opencv_photo249.lib;opencv_stitching249.lib;opencv_superres249.lib;opencv_ts249.lib;opencv_video249.lib;opencv_videostab249.lib;zlib.lib;






Yamecoder 야매코더_
C++(일반) 2016. 3. 19. 01:36

댓글을 달아 주세요

Powerd by Tistory, designed by criuce
rss