How to create a Visual Studio Solution from a Makefile?

Manda Rajo 141 Reputation points
2022-04-06T12:33:42.113+00:00

My project with that CMakeLists.txt is almost 9 months of hard work, and I was always wondering how to create a Visual Studio Solution from a Makefile because most of examples from the internet use Makefile instead of CMakeLists.txt, and I can prove below that I know how to create the Visual Studio Solution from a CMakeLists.txt:

The file _build_windows.bat
It creates the folder "_build_windows" where a Visual Studio Solution named "emc-engine.sln" for example is located.
That batch file needs the file CMakeLists.txt and if that file doesn't exist then there is no build.
(Question: Is there an alternative method for Makefile?)

   set BUILD_FOLDER="_build_windows"  
   cmake -S . -B %BUILD_FOLDER% -A x64  

190601-cmakeliststxt.png

The reason I ask that question is it's difficult for me to fix it, question for almost almost 9 months. And the Makefile in the folder tests/test_glsl-parser cannot be manually forced turned into CMakeLists.txt, because I tried and it failed to compile with failed library.

Off-topic: I said before that most of examples from the internet use Makefile, for example in that folder tests, there is a sub folder test_glsl-parser which has a Makefile, that project lexes/parses a .glsl file into a tree of nodes. My goal is to build my own programming language (or script) by modifying that test_glsl-parser, and I want that my own language is 99% close to GPU language, because I need a CPU & GPU language at the same time.
Reason: C++ is very close to CPU but the future of computer science is GPU (.glsl instead of C++).

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,078 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,709 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 30,541 Reputation points Microsoft Vendor
    2022-04-07T12:45:54.313+00:00

    Hi @Manda Rajo ,

    Welcome to Microsoft Q&A forum.

    As far as I know, there are four choices, if you have an existing makefile project, but I’m not sure if they or any of them meet your requirements. Please kindly check this doc: Create a C++ makefile project.

    If you have an existing makefile project, you have these choices if you want to edit, build, and debug in the Visual Studio IDE:

    1. Create a makefile project in Visual Studio that uses your existing makefile to configure a .vcxproj file that Visual Studio will use for IntelliSense. (You won't have all the IDE features that you get with a native MSBuild project.) See To create a makefile project below.
    2. Use the Create New Project from Existing Code Files wizard to create a native MSBuild project from your source code. The original makefile won't be used anymore. For more information, see How to: Create a C++ Project from Existing Code.
    3. Visual Studio 2017 and later: Use the Open Folder feature to edit and build a makefile project as-is without any involvement of the MSBuild system. For more information, see Open Folder projects for C++.
    4. Visual Studio 2019 and later: Create a UNIX makefile project for Linux.

    Best Regards,
    Tianyu

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.