├── CMakeLists.txt ├── LICENSE_1_0.txt ├── README.md └── src ├── cmake ├── CMakeConfigTemplateWriter.cpp ├── CMakeConfigTemplateWriter.hpp ├── CMakeListsWriter.cpp ├── CMakeListsWriter.hpp ├── CMakeMsc.cpp ├── CMakeMsc.hpp ├── CMakeSubDirRegistering.cpp └── CMakeSubDirRegistering.hpp ├── main.cpp └── vcx ├── VCXParser.cpp ├── VCXParser.hpp └── VCXStructs.hpp /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(proj2cmake) 4 | 5 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX) 6 | ADD_DEFINITIONS(-std=c++11) 7 | ADD_DEFINITIONS(-Wall) 8 | endif() 9 | 10 | #if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 11 | # ADD_DEFINITIONS(-stdlib=libc++) 12 | # SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -stdlib=libc++") 13 | #endif() 14 | 15 | FIND_PACKAGE (Boost COMPONENTS system filesystem REQUIRED) 16 | 17 | if (Boost_FOUND) 18 | include_directories( 19 | ${Boost_INCLUDE_DIRS} 20 | ) 21 | endif() 22 | 23 | AUX_SOURCE_DIRECTORY(src/ vcparser_SRC) 24 | AUX_SOURCE_DIRECTORY(src/vcx vcparser_SRC) 25 | AUX_SOURCE_DIRECTORY(src/cmake vcparser_SRC) 26 | 27 | ADD_EXECUTABLE(proj2cmake 28 | ${vcparser_SRC}) 29 | 30 | TARGET_LINK_LIBRARIES(proj2cmake 31 | ${Boost_SYSTEM_LIBRARY} 32 | ${Boost_FILESYSTEM_LIBRARY} 33 | ) 34 | -------------------------------------------------------------------------------- /LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # proj2cmake 2 | Convert an entire Visual Studio solution and all contained projects to CMake. 3 | 4 | The output is split into multiple files: 5 | - CMake files that contain the lists of sources and dependencies between the projects in the solution 6 | - CMake files that can be edited by the user and where the platform specific settings and compiler settings belong 7 | 8 | Only the first onces will be overwritten on further runs of proj2cmake. So it is designed to keep the CMake files in sync with the VS solution. 9 | 10 | This project is currently in an early state and may not work correctly for your Visual Studio projects. 11 | 12 | ## Usage 13 | Call proj2cmake with your solution file as the argument: 14 | ``` 15 | # create cmake files 16 | proj2cmake ~/projects/MyMsVcProject/MyMsVcProject.sln 17 | # edit the settings 18 | vim ~/projects/MyMsVcProject/cmake_config/MyMsVcProject.cmake 19 | # run cmake 20 | cmake /projects/MyMsVcProject 21 | ``` 22 | 23 | ## License 24 | Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 25 | -------------------------------------------------------------------------------- /src/cmake/CMakeConfigTemplateWriter.cpp: -------------------------------------------------------------------------------- 1 | #include "CMakeConfigTemplateWriter.hpp" 2 | 3 | using namespace proj2cmake; 4 | 5 | void cmake::ConfigTemplateWriter::operator()(std::ostream& os) 6 | { 7 | os << R"|( 8 | SET(SOLUTION_GENERAL_DEPS 9 | # Add libraries here, that will be linked to every target 10 | ) 11 | 12 | SET(SOLUTION_APP_DEPS 13 | # Add libraries here, that will be linked to every application target 14 | ) 15 | 16 | SET(SOLUTION_STATIC_LIB_DEPS 17 | # Add libraries here, that will be linked to every static lib target 18 | ) 19 | 20 | SET(SOLUTION_SHARED_LIB_DEPS 21 | # Add libraries here, that will be linked to every shared lib target 22 | ) 23 | 24 | )|"; 25 | } 26 | -------------------------------------------------------------------------------- /src/cmake/CMakeConfigTemplateWriter.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "../vcx/VCXStructs.hpp" 7 | 8 | namespace proj2cmake 9 | { 10 | namespace cmake 11 | { 12 | 13 | class ConfigTemplateWriter 14 | { 15 | private: 16 | vcx::Solution mSolution; 17 | 18 | public: 19 | ConfigTemplateWriter(vcx::Solution solution) 20 | : mSolution(std::move(solution)) 21 | {} 22 | 23 | void operator()(std::ostream& os); 24 | }; 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/cmake/CMakeListsWriter.cpp: -------------------------------------------------------------------------------- 1 | #include "CMakeListsWriter.hpp" 2 | 3 | #include "CMakeMsc.hpp" 4 | 5 | using namespace proj2cmake; 6 | 7 | void cmake::ListsWriter::operator()(std::ostream& os) 8 | { 9 | os << "SET(" << cmake::tokenize(mProject.first.name) << "_SRC" << std::endl; 10 | for(auto&& f : mProject.second.compileFiles) 11 | { 12 | os << " " << f << std::endl; 13 | } 14 | os << " )" << std::endl; 15 | 16 | os << std::endl; 17 | 18 | os << "SET(" << cmake::tokenize(mProject.first.name) << "_DEPS" << std::endl; 19 | for(auto&& proc : mProject.second.referencedProjects) 20 | { 21 | os << " " << cmake::tokenize(proc.name) << std::endl; 22 | } 23 | os << " )" << std::endl; 24 | } 25 | -------------------------------------------------------------------------------- /src/cmake/CMakeListsWriter.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "../vcx/VCXStructs.hpp" 7 | 8 | namespace proj2cmake 9 | { 10 | namespace cmake 11 | { 12 | 13 | class ListsWriter 14 | { 15 | private: 16 | vcx::ProjectPair mProject; 17 | 18 | public: 19 | ListsWriter(vcx::ProjectPair project) 20 | : mProject(std::move(project)) 21 | {} 22 | 23 | void operator()(std::ostream& os); 24 | }; 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/cmake/CMakeMsc.cpp: -------------------------------------------------------------------------------- 1 | #include "CMakeMsc.hpp" 2 | 3 | using namespace proj2cmake; 4 | 5 | const char* cmake::cmakeTypeCaption(vcx::ConfigurationType type) 6 | { 7 | switch(type) 8 | { 9 | case vcx::ConfigurationType::Application: 10 | return "APP"; 11 | case vcx::ConfigurationType::StaticLibrary: 12 | return "STATIC_LIB"; 13 | case vcx::ConfigurationType::DynamicLibrary: 14 | return "SHARED_LIB"; 15 | case vcx::ConfigurationType::Utility: 16 | return "UTILITY"; 17 | case vcx::ConfigurationType::Makefile: 18 | return "MAKEFILE"; 19 | } 20 | 21 | throw std::logic_error("Unhandled config type! (cmake::cmakeTypeCaption)"); 22 | } 23 | 24 | std::string cmake::cmakeStartType(const std::string& name, vcx::ConfigurationType type) 25 | { 26 | std::string res; 27 | if(type == vcx::ConfigurationType::Application) 28 | res = "ADD_EXECUTABLE("; 29 | else 30 | res = "ADD_LIBRARY("; 31 | 32 | res += cmake::tokenize(name); 33 | 34 | if(type == vcx::ConfigurationType::StaticLibrary) 35 | res += " STATIC"; 36 | else if(type == vcx::ConfigurationType::DynamicLibrary) 37 | res += " SHARED"; 38 | 39 | return res; 40 | } 41 | 42 | std::string cmake::tokenize(const std::string& name) 43 | { 44 | std::string res; 45 | 46 | for(char c : name) 47 | { 48 | switch(c) 49 | { 50 | case ' ': 51 | res += '_'; 52 | break; 53 | case '(': 54 | case ')': 55 | break; 56 | default: 57 | res += c; 58 | break; 59 | } 60 | } 61 | 62 | return res; 63 | } 64 | -------------------------------------------------------------------------------- /src/cmake/CMakeMsc.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../vcx/VCXStructs.hpp" 6 | 7 | namespace proj2cmake 8 | { 9 | namespace cmake 10 | { 11 | 12 | const char* cmakeTypeCaption(vcx::ConfigurationType type); 13 | 14 | std::string cmakeStartType(const std::string& name, vcx::ConfigurationType type); 15 | 16 | std::string tokenize(const std::string& name); 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/cmake/CMakeSubDirRegistering.cpp: -------------------------------------------------------------------------------- 1 | #include "CMakeSubDirRegistering.hpp" 2 | 3 | #include 4 | 5 | using namespace proj2cmake; 6 | 7 | void cmake::CMakeSubDirRegistering::operator()(const boost::filesystem::path& subDir) 8 | { 9 | mOs << "ADD_SUBDIRECTORY(" << subDir; 10 | 11 | if (boost::contains(subDir.string(), "..")) 12 | { 13 | mOs << " " << subDir.filename(); 14 | } 15 | 16 | mOs << ")" << std::endl; 17 | } 18 | -------------------------------------------------------------------------------- /src/cmake/CMakeSubDirRegistering.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace proj2cmake 6 | { 7 | namespace cmake 8 | { 9 | 10 | class CMakeSubDirRegistering 11 | { 12 | private: 13 | std::ostream& mOs; 14 | 15 | public: 16 | CMakeSubDirRegistering(std::ostream& os) 17 | : mOs(os) 18 | {} 19 | 20 | void operator()(const boost::filesystem::path& subDir); 21 | }; 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "vcx/VCXParser.hpp" 2 | 3 | #include "cmake/CMakeListsWriter.hpp" 4 | #include "cmake/CMakeConfigTemplateWriter.hpp" 5 | #include "cmake/CMakeMsc.hpp" 6 | #include "cmake/CMakeSubDirRegistering.hpp" 7 | 8 | #include 9 | 10 | using namespace proj2cmake; 11 | namespace fs = boost::filesystem; 12 | using ProjectsPaths = std::map>; 13 | 14 | void writeGeneratedNote(std::ostream& os, const char* procName) 15 | { 16 | os << "#" << std::endl; 17 | os << "# This file was genared by " << procName << " and will be overwritten on it's next run!" << std::endl; 18 | os << "# Please put all configurations in the cmake_conf/*.cmake files." << std::endl; 19 | os << "#" << std::endl; 20 | os << std::endl; 21 | } 22 | 23 | void writeProject(std::ofstream& os, const vcx::Solution& solution, const ProjectsPaths& dirToProj) 24 | { 25 | os << "PROJECT(" << solution.name << ")" << std::endl; 26 | os << std::endl; 27 | 28 | fs::path confFile = "cmake_conf"; 29 | confFile /= (solution.name + ".cmake"); 30 | 31 | //os << "IF(EXISTS \"${" << solution.name << "_SOURCE_DIR}/cmake_conf/" << solution.name << ".cmake\")" << std::endl; 32 | os << "INCLUDE(\"${" << solution.name << "_SOURCE_DIR}/" + confFile.string() + "\")" << std::endl; 33 | //os << "ENDIF()" << std::endl; 34 | os << std::endl; 35 | 36 | auto fullConfPath = solution.basePath / confFile; 37 | if(fs::exists(fullConfPath) == false) 38 | { 39 | fs::create_directories(fullConfPath.parent_path()); 40 | cmake::ConfigTemplateWriter writer(solution); 41 | std::ofstream os(fullConfPath.native()); 42 | writer(os); 43 | } 44 | 45 | cmake::CMakeSubDirRegistering subDirRegister(os); 46 | for(auto&& subDir : dirToProj) 47 | { 48 | if (solution.basePath == subDir.first) 49 | continue; 50 | 51 | subDirRegister(subDir.second[0]->first.projectFile.parent_path()); 52 | } 53 | os << std::endl; 54 | } 55 | 56 | int main(int argc, char** argv) 57 | { 58 | namespace fs = boost::filesystem; 59 | 60 | auto procName = argv[0]; 61 | 62 | if(argc < 2) 63 | { 64 | std::cerr << "Usage: " << procName << " " << std::endl; 65 | return 1; 66 | } 67 | 68 | auto solutionFile = argv[1]; 69 | 70 | if(boost::iends_with(solutionFile, ".sln") == false) 71 | { 72 | std::cerr << "The first parameter has to be a Visual Studio solution file (*.sln)" << std::endl; 73 | return 1; 74 | } 75 | 76 | vcx::SolutionParser parser(solutionFile); 77 | auto solution = parser(); 78 | 79 | ProjectsPaths dirToProj; 80 | 81 | for(auto&& p : solution.projects) 82 | { 83 | auto&& pInfo = p.first; 84 | auto&& project = p.second; 85 | 86 | if(project.compileFiles.empty()) 87 | continue; 88 | 89 | auto cmakeSrcFile = solution.basePath / pInfo.projectFile; 90 | cmakeSrcFile.replace_extension(".cmake"); 91 | cmake::ListsWriter writer(p); 92 | 93 | std::ofstream os(cmakeSrcFile.native()); 94 | writeGeneratedNote(os, procName); 95 | writer(os); 96 | 97 | dirToProj[cmakeSrcFile.parent_path()].push_back(&p); 98 | } 99 | 100 | bool hasProject = false; 101 | 102 | for(auto&& p : dirToProj) 103 | { 104 | auto f = p.first / "CMakeLists.txt"; 105 | std::ofstream os(f.native()); 106 | writeGeneratedNote(os, procName); 107 | 108 | os << "cmake_minimum_required(VERSION 2.8)" << std::endl; 109 | os << std::endl; 110 | if(p.first == solution.basePath) 111 | { 112 | writeProject(os, solution, dirToProj); 113 | hasProject = true; 114 | } 115 | 116 | for(auto&& pr : p.second) 117 | { 118 | auto&& pInfo = pr->first; 119 | auto&& project = pr->second; 120 | 121 | os << std::endl; 122 | 123 | auto cmakeSrcFile = solution.basePath / pInfo.projectFile; 124 | cmakeSrcFile.replace_extension(".cmake"); 125 | 126 | os << "INCLUDE(\"" + cmakeSrcFile.filename().string() + "\")" << std::endl; 127 | os << std::endl; 128 | os << cmake::cmakeStartType(pInfo.name, project.type) << std::endl; 129 | os << " ${" << cmake::tokenize(pInfo.name) << "_SRC})" << std::endl; 130 | os << std::endl; 131 | os << "TARGET_LINK_LIBRARIES(" << cmake::tokenize(pInfo.name) << std::endl; 132 | os << " ${" << cmake::tokenize(pInfo.name) << "_DEPS}" << std::endl; 133 | os << " ${" << cmake::tokenize(pInfo.name) << "_ADDITIONAL_DEPS}" << std::endl; 134 | os << " ${SOLUTION_" << cmake::cmakeTypeCaption(project.type) << "_DEPS}" << std::endl; 135 | os << " ${SOLUTION_GENERAL_DEPS})" << std::endl; 136 | os << std::endl; 137 | } 138 | } 139 | 140 | if (!hasProject) 141 | { 142 | auto f = solution.basePath / "CMakeLists.txt"; 143 | std::ofstream os(f.native()); 144 | writeProject(os, solution, dirToProj); 145 | } 146 | 147 | return 0; 148 | } 149 | -------------------------------------------------------------------------------- /src/vcx/VCXParser.cpp: -------------------------------------------------------------------------------- 1 | #include "VCXParser.hpp" 2 | #include 3 | 4 | using namespace proj2cmake::vcx; 5 | 6 | namespace 7 | { 8 | inline std::string pathToNative(std::string&& in) 9 | { 10 | for(auto& c : in) 11 | if(c == '\\') 12 | c = '/'; 13 | return in; 14 | } 15 | 16 | inline void toUpper(char& c) 17 | { 18 | if(c >= 'a' && c <= 'z') 19 | c += 'A' - 'a'; 20 | } 21 | 22 | inline std::string toUpper(std::string&& in) 23 | { 24 | for(auto& c : in) 25 | toUpper(c); 26 | return in; 27 | } 28 | } 29 | 30 | fs::path SolutionParser::basePath() const 31 | { 32 | return mSlnFile.parent_path(); 33 | } 34 | 35 | SolutionParser::SolutionParser(fs::path slnFile) 36 | : mSlnFile(std::move(slnFile)) 37 | {} 38 | 39 | Solution SolutionParser::operator()() 40 | { 41 | Solution res; 42 | 43 | res.basePath = basePath(); 44 | res.name = mSlnFile.stem().string(); 45 | 46 | auto infos = parseSolution(mSlnFile); 47 | for(auto&& projInfo : infos) 48 | res.projects[projInfo] = parseProject(projInfo); 49 | 50 | for(auto&& proj : res.projects) 51 | { 52 | for(auto&& refProj : proj.second.referencedProjects) 53 | { 54 | auto itr = res.projects.find(refProj); 55 | if(itr == res.projects.end()) 56 | std::cerr << "Warning: Project " << refProj.guid << " is referenced but can not be found" << std::endl; 57 | else 58 | refProj.name = itr->first.name; 59 | } 60 | } 61 | 62 | return res; 63 | } 64 | 65 | Project SolutionParser::parseProject(const ProjectInfo& projInfo) 66 | { 67 | Project res; 68 | 69 | auto projFilePath = projInfo.projectFile; 70 | if(!projFilePath.is_absolute()) 71 | projFilePath = basePath() / projFilePath; 72 | 73 | boost::property_tree::ptree pt; 74 | std::cout << "Parsing file: " << projFilePath << std::endl; 75 | if(fs::exists(projFilePath) == false) 76 | throw std::runtime_error("Project file '"+ projFilePath.string() + "' not found!"); 77 | boost::property_tree::xml_parser::read_xml(projFilePath.native(), pt); 78 | 79 | std::string type; 80 | 81 | auto project = pt.get_child("Project"); 82 | for(auto&& pp : project) 83 | { 84 | if(type.empty() && pp.first == "PropertyGroup") 85 | { 86 | type = pp.second.get("ConfigurationType", ""); 87 | continue; 88 | } 89 | else if(pp.first != "ItemGroup") 90 | continue; 91 | 92 | for(auto&& ip : pp.second) 93 | { 94 | if(ip.first == "ClCompile") 95 | { 96 | auto f = ip.second.get(".Include"); 97 | f = pathToNative(std::move(f)); 98 | res.compileFiles.push_back(f); 99 | } 100 | else if(ip.first == "ClInclude") 101 | { 102 | auto f = ip.second.get(".Include"); 103 | f = pathToNative(std::move(f)); 104 | res.includeFiles.push_back(f); 105 | } 106 | else if(ip.first == "ProjectReference") 107 | { 108 | ProjectInfo pInfo; 109 | auto f = ip.second.get(".Include"); 110 | pInfo.projectFile = pathToNative(std::move(f)); 111 | pInfo.guid = toUpper(ip.second.get("Project")); 112 | res.referencedProjects.push_back(pInfo); 113 | } 114 | } 115 | } 116 | 117 | if(type == "Application") 118 | res.type = ConfigurationType::Application; 119 | else if(type == "DynamicLibrary") 120 | res.type = ConfigurationType::DynamicLibrary; 121 | else if(type == "StaticLibrary") 122 | res.type = ConfigurationType::StaticLibrary; 123 | else if(type == "Utility") 124 | res.type = ConfigurationType::Utility; 125 | else if(type == "Makefile") 126 | res.type = ConfigurationType::Makefile; 127 | else 128 | throw std::runtime_error("Project '" + projInfo.name + "' has an invalid ConfigurationType ('" + type + "')"); 129 | 130 | std::cout << " Type: " << type << ", CompileFiles: " << res.compileFiles.size() << ", IncludeFiles: " << res.includeFiles.size() << ", ProjectReferences: " << res.referencedProjects.size() << std::endl; 131 | 132 | std::sort(begin(res.compileFiles), end(res.compileFiles)); 133 | std::sort(begin(res.includeFiles), end(res.includeFiles)); 134 | std::sort(begin(res.referencedProjects), end(res.referencedProjects)); 135 | 136 | return res; 137 | } 138 | 139 | std::vector SolutionParser::parseSolution(std::istream& is) 140 | { 141 | std::vector res; 142 | 143 | while(is.good()) 144 | { 145 | std::string line; 146 | 147 | std::getline(is, line); 148 | 149 | if(boost::starts_with(line, "Project(")) 150 | { 151 | ProjectInfo sol; 152 | 153 | auto pos = line.find(" = "); 154 | if(pos == std::string::npos) 155 | throw std::runtime_error("Invalid solution file!"); 156 | 157 | auto val = line.substr(pos+4); 158 | auto end = val.find('\"'); 159 | sol.name = val.substr(0, end); 160 | 161 | val = val.substr(end+1); 162 | val = val.substr(val.find('\"')+1); 163 | end = val.find('\"'); 164 | auto projFile = pathToNative(val.substr(0, end)); 165 | if(boost::iends_with(projFile, ".vcxproj") == false) 166 | continue; 167 | sol.projectFile = projFile; 168 | 169 | val = val.substr(end+1); 170 | val = val.substr(val.find('\"')+1); 171 | sol.guid = toUpper(val.substr(0, val.find('\"'))); 172 | 173 | res.push_back(sol); 174 | } 175 | } 176 | 177 | return res; 178 | } 179 | 180 | std::vector SolutionParser::parseSolution(const fs::path& solutionFile) 181 | { 182 | std::fstream is(solutionFile.native()); 183 | return parseSolution(is); 184 | } 185 | -------------------------------------------------------------------------------- /src/vcx/VCXParser.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "VCXStructs.hpp" 4 | 5 | namespace proj2cmake 6 | { 7 | namespace vcx 8 | { 9 | 10 | class SolutionParser 11 | { 12 | private: 13 | fs::path mSlnFile; 14 | 15 | fs::path basePath() const; 16 | 17 | public: 18 | SolutionParser(fs::path slnFile); 19 | 20 | Solution operator()(); 21 | 22 | Project parseProject(const ProjectInfo& projInfo); 23 | 24 | std::vector parseSolution(std::istream& is); 25 | 26 | std::vector parseSolution(const fs::path& solutionFile); 27 | }; 28 | 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/vcx/VCXStructs.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace proj2cmake 14 | { 15 | namespace vcx 16 | { 17 | 18 | namespace fs = boost::filesystem; 19 | 20 | enum class ConfigurationType 21 | { 22 | StaticLibrary, 23 | DynamicLibrary, 24 | Application, 25 | Utility, 26 | Makefile 27 | }; 28 | 29 | struct ProjectInfo 30 | { 31 | std::string guid; 32 | std::string name; 33 | fs::path projectFile; 34 | 35 | bool operator<(const ProjectInfo& other) const 36 | { 37 | return guid < other.guid; 38 | } 39 | 40 | bool operator==(const ProjectInfo& other) const 41 | { 42 | return guid == other.guid; 43 | } 44 | }; 45 | 46 | struct Project 47 | { 48 | ConfigurationType type; 49 | 50 | std::vector compileFiles; 51 | std::vector includeFiles; 52 | std::vector referencedProjects; 53 | }; 54 | 55 | using ProjectPair = std::pair; 56 | 57 | struct Solution 58 | { 59 | fs::path basePath; 60 | std::string name; 61 | std::map projects; 62 | }; 63 | 64 | } 65 | } 66 | --------------------------------------------------------------------------------