How to separate my project into multiple parts #2208
-
Hello, can anyone help, please? workspace "MyProject"
configurations { "Debug", "Release" }
location "build"
project "MyProject"
kind "ConsoleApp"
language "C++"
targetdir "build/bin/%{cfg.buildcfg}"
objdir "build/obj/%{cfg.buildcfg}"
files { "src/*.cpp", "include/*.hpp" }
includedirs { "include", "vendor/eigen", "vendor/viennaCL", "vendor/viennaCL/CL" }
defines { "VIENNACL_WITH_OPENCL" }
filter "configurations:Debug"
symbols "On"
optimize "Off"
filter "configurations:Release"
symbols "Off"
optimize "On"
filter {}
links { "OpenCL" } And I want to create a Even if I try to do it together and create it in the same file: project "Eigen"
kind "StaticLib"
language "C++"
includedirs { "vendor/eigen" } and call it in the project "MyProject":
The result is: ../src/main.cpp:1:10: fatal error: Eigen/Dense: No such file or directory
1 | #include <Eigen/Dense>
| ^~~~~~~~~~~~~ Edit: The project structure of this issue is here https://github.com/FranciscoOssian/cpp-template @:~/repos/cpp-template$ tree -L 2
.
├── include
│ └── test.hpp
├── premake.lua
├── src
│ ├── main.cpp
│ └── test.cpp
└── vendor
├── eigen
└── viennaCL The idea is simply to call the premake of the "X" dependency (creating file in "vendor/eigen") and configure it in the main premake, without writing details in the main premake. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Have you tried using absolute paths? You can get the workspace location from the |
Beta Was this translation helpful? Give feedback.
-
You might find that |
Beta Was this translation helpful? Give feedback.
-
I found an example of premake that deals with GLFW and OpenGL, and the approach used is different from what I was trying, maybe that's why I always made mistakes. For now, the way I managed to solve it was simply by creating a function in the separate file with the configurations I wanted. For third parties static dependencies, this will be useful. It raised other questions for me, but I'll save them to research, and if I can't find answers, I'll ask another question. Thanks to those who were willing to help. function useEigen()
includedirs { "vendor/eigen" }
end dofile "vendor/eigen/premake.lua"
project "Project"
useEigen() |
Beta Was this translation helpful? Give feedback.
I found an example of premake that deals with GLFW and OpenGL, and the approach used is different from what I was trying, maybe that's why I always made mistakes. For now, the way I managed to solve it was simply by creating a function in the separate file with the configurations I wanted. For third parties static dependencies, this will be useful. It raised other questions for me, but I'll save them to research, and if I can't find answers, I'll ask another question. Thanks to those who were willing to help.