* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __MSVC_H__
-#define __MSVC_H__
+
+#pragma once
#include <fstream>
#include <vector>
#include "../backend.h"
+#ifdef OUT
+#undef OUT
+#endif//OUT
+
+
class FileUnit
{
public:
enum OptimizationType
{
+ RosBuild,
Debug,
Release,
- Speed
+ Speed,
+};
+
+enum ConfigurationType
+{
+ ConfigUnknown,
+ ConfigApp,
+ ConfigDll,
+ ConfigEmpty,
+ ConfigLib
+};
+
+enum BinaryType
+{
+ BinUnknown,
+ Lib,
+ Dll,
+ Exe,
+ Sys
};
enum HeadersType
void OutputFolders();
void OutputFileUnits();
- std::string DspFileName ( const Module& module ) const;
std::string VcprojFileName ( const Module& module ) const;
- std::string DswFileName ( const Module& module ) const;
+ std::string VcxprojFileName ( const Module& module ) const;
std::string SlnFileName ( const Module& module ) const;
- std::string OptFileName ( const Module& module ) const;
std::string SuoFileName ( const Module& module ) const;
std::string NcbFileName ( const Module& module ) const;
int m_unitCount;
- FILE* m_dswFile;
- FILE* m_slnFile;
- FILE* m_rulesFile;
+ std::string _gen_guid();
- // functions in msvcmaker.cpp:
+ std::string _get_solution_version ( void );
+ std::string _get_studio_version ( void );
+ std::string _get_vc_dir ( void ) const;
- void _generate_dsp ( const Module& module );
- void _generate_dsw_header ( FILE* OUT );
- void _generate_dsw_project (
- FILE* OUT,
- const Module& module,
- std::string dsp_file,
- const std::vector<Dependency*>& dependencies );
+ void _clean_project_files ( void );
+ void _get_object_files ( const Module& module, std::vector<std::string>& out ) const;
+ void _get_def_files ( const Module& module, std::vector<std::string>& out ) const;
+ void _install_files ( const std::string& vcdir, const std::string& config );
+ bool _copy_file ( const std::string& inputname, const std::string& targetname ) const;
+ const Property* _lookup_property ( const Module& module, const std::string& name ) const;
+};
- void _generate_dsw_footer ( FILE* OUT );
- void _generate_wine_dsw ( FILE* OUT );
- // functions in vcprojmaker.cpp:
+// Abstract class
+class ProjMaker
+{
+ public:
+ ProjMaker ( );
+ ProjMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
+ virtual ~ProjMaker() {}
+
+ virtual void _generate_proj_file ( const Module& module ) = 0;
+ virtual void _generate_user_configuration ();
+
+ protected:
+ Configuration configuration;
+ std::vector<MSVCConfiguration*> m_configurations;
+ std::string vcproj_file;
+ FILE* OUT;
+
+ std::vector<std::string> header_files;
+ std::vector<std::string> includes;
+ std::vector<std::string> includes_ros;
+ std::vector<std::string> libraries;
+ std::set<std::string> common_defines;
+ std::string baseaddr;
+
+ std::string VcprojFileName ( const Module& module ) const;
+ std::string _get_vc_dir ( void ) const;
std::string _strip_gcc_deffile(std::string Filename, std::string sourcedir, std::string objdir);
std::string _get_solution_version ( void );
std::string _get_studio_version ( void );
- std::string _gen_guid();
- std::string _replace_str(
- std::string string1,
- const std::string &find_str,
- const std::string &replace_str);
+ std::string _replace_str( std::string string1, const std::string &find_str, const std::string &replace_str);
- std::string _get_vc_dir ( void ) const;
+ void _generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType );
+ void _generate_makefile_configuration( const Module& module, const MSVCConfiguration& cfg );
+};
- void _generate_vcproj ( const Module& module );
+class VCProjMaker : public ProjMaker
+{
+ public:
+ VCProjMaker ( );
+ VCProjMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
+ virtual ~VCProjMaker ();
+
+ void _generate_proj_file ( const Module& module );
+ void _generate_user_configuration ();
+
+ private:
+ void _generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType );
+ void _generate_makefile_configuration( const Module& module, const MSVCConfiguration& cfg );
+ std::string _get_file_path( FileLocation* file, std::string relative_path);
+};
+
+class VCXProjMaker : public ProjMaker
+{
+ public:
+ VCXProjMaker ( );
+ VCXProjMaker ( Configuration& buildConfig, const std::vector<MSVCConfiguration*>& msvc_configs, std::string filename );
+ virtual ~VCXProjMaker ();
+
+ void _generate_proj_file ( const Module& module );
+ void _generate_user_configuration ();
- void _generate_sln_header ( FILE* OUT );
- void _generate_sln_footer ( FILE* OUT );
- void _generate_sln ( FILE* OUT );
+ private:
+ void _generate_standard_configuration( const Module& module, const MSVCConfiguration& cfg, BinaryType binaryType );
+ void _generate_makefile_configuration( const Module& module, const MSVCConfiguration& cfg );
+};
+
+class SlnMaker
+{
+ public:
+ SlnMaker ( Configuration& buildConfig, Project& ProjectNode, const std::vector<MSVCConfiguration*>& configurations, std::string filename_sln );
+ ~SlnMaker ();
+
+ void _generate_sln ( std::string solution_version, std::string studio_version );
+
+ private:
+ Configuration m_configuration;
+ Project* m_ProjectNode;
+ std::vector<MSVCConfiguration*> m_configurations;
+ FILE* OUT;
+
+ void _generate_sln_header ( std::string solution_version, std::string studio_version );
+ void _generate_sln_footer ( );
//void _generate_rules_file ( FILE* OUT );
void _generate_sln_project (
- FILE* OUT,
const Module& module,
std::string vcproj_file,
std::string sln_guid,
std::string vcproj_guid,
const std::vector<Library*>& libraries );
- void _generate_sln_configurations (
- FILE* OUT,
- std::string vcproj_guid );
- void _clean_project_files ( void );
- void _get_object_files ( const Module& module, std::vector<std::string>& out ) const;
- void _get_def_files ( const Module& module, std::vector<std::string>& out ) const;
- void _install_files ( const std::string& vcdir, const std::string& config );
- bool _copy_file ( const std::string& inputname, const std::string& targetname ) const;
- const Property* _lookup_property ( const Module& module, const std::string& name ) const;
+ void _generate_sln_configurations ( std::string vcproj_guid );
};
-#endif // __MSVC_H__
+class PropsMaker
+{
+ public:
+ PropsMaker ( Configuration& buildConfig,
+ Project* ProjectNode,
+ std::string filename_props,
+ MSVCConfiguration* msvc_configs);
+
+ ~PropsMaker ();
+
+ void _generate_props ( std::string solution_version, std::string studio_version );
+
+ private:
+ Configuration m_configuration;
+ Project* m_ProjectNode;
+ FILE* OUT;
+ MSVCConfiguration* m_msvc_config;
+ bool debug;
+ bool release;
+ bool speed;
+ bool use_ros_headers;
+
+ void _generate_header();
+ void _generate_tools_defaults();
+ void _generate_macro(std::string Name, std::string Value, bool EvairomentVariable);
+ void _generate_global_includes();
+ void _generate_global_definitions();
+ void _generate_footer();
+
+};