I currently want to add some self written classes ("mycode.cpp" and "mycode.hpp") to a big existing C++ project that is configured with Cmake. These classes are located in "myfolder" which is located in the "lib/pointrender" folder of the existing project (see dummy hierarchy below).
|- libs
| |- core
| | |- ...
| |- pointrender
| |- myfolder
| | |- mycode.cpp
| | |- mycode.hpp
| |- existingclasses.cpp
| |- existingclasses.hpp
| |- project.cmake
|- CMakeLists.txt
In the CMakesLists.txt the pointrender folder is declared as a subproject.
declare_subproject(libs/pointrender)
How do I best add my code to the existing cmake configuration? Do I add it as a subfolder in the project.cmake with a seperate CMakeLists.txt in myfolder? Or do I best add it as a subproject with a seperate project.cmake file? What's the difference?
This project.cmake is being include()d be some CMakeLists.txt and get's executed as part of it. Authors of project you are using rolled this out for some reason, so it's probably better to use their infrastructure to add custom code.
The usual way to do this is writing your own CMakeLists.txt and add_subdirectory()ing it from the upper level.
If you wish more details you should update your question with project.cmake contents.
Related
I have 3 layer architecture project for embedded
top layer - application
middle layer - middle(HAL Layer)
bottom layer - bottom(Driver layer)
I need to make a Makefile for the project with multiple source and header files which are in different directories.
For sake of understanding of makefile consider this as c project.
The issue I am facing is I am not able to generate the dependency files for the source files.
I have seen many tutorials but mostly in the example code of MAKEFILE, the header files are present in the same folder with the source files.
In my case the files are in the below structure.
project
|
|---- _build(DIR)
| --- Makefile
|
|---- application(DIR)
| inc/main.h
| src/main.c
|
|---- middle(DIR)
| inc/middle.h
| src/middle.c
|
|---- bottom(DIR)
| inc/bottom.h
| src/bottom.c
As the header files are in separate folder, I am not able to generate the dependency files(.d files).
Without including header files like
-I<header_files>
How to generate the dependency files?
http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
No Header file is included using -I options because source and header files are in same folder
Youtube example but same result, header and source in same folders.
https://www.youtube.com/watch?v=NPdagdEOBnI
My question is related to the structure or approach of Go applications. I have got the following application.
root
|- app
| |- services
| |- repositories
| |- handlers
| |- commands
|- go.mod
|- main.go
The Go files in the commands package are working independently. The rest of the packages are working for a web application. I start an HTTP web server in the main.go
So, I'd like to run the Go files in the commands packages in the crontab. But as I know, I'll build these whole packages into a single binary file. My question is how can I run the Go files in the commands packages independently in the crontab? I think I should separate them into 2 applications such as "web app" and "command app" but actually they are related to each other and I don't want to manage 2 apps differently. May I use commands Go files in the crontab and on the other hand start an HTTP web server in the main.go?
There's no reason why you can't import packages from your web application module into another one, but if you want to keep them together, you can just do what is quite common, and add additional main packages in specific directories, giving a directory structure like this:
root
|- app
| |-services
| |-...
|- cmd
| |- tools
| | |- main.go
|- main.go
You can build/install your CLI binary simply by running go build ./cmd/tools or go install ./cmd/tools
I'm following a YouTube tutorial on twilio sms service, and I came to a point where I have to create my own .rb file! My project directory at the moment looks something like this:
The tutorial uses atom my_ruby_file.rb in the terminal to create a new ruby file. However, I do not use atom and from what I understand rails have changed a lot since 2014 that the video was recorded!
So my question is: Where to create my custom ruby files for Rails 6.1.3.2? I have noticed in my directory that .rb files are used all over the place. For example controllers and models and more, but where do I have to set one created by me ?
Related Question:
Where to keep other custom files such as .js, .css, .png ? The way I did it is to create a new folder in the following directory project-name/app/javascript/my_custom_files/js/dial_codes.js and actually reference that in the project-name/app/javascript/packs/application.js using this command require("my_custom_files/js/dial_codes"). Is this the correct way of doing that for that specific rails version?
project-name
|
|- app
|- assets
|- channels (application_cable)
|- controllers (concerns) -> contains application_controller.rb, friends_controller.rb, home_controller.rb
|- helpers
|- javascript (channels, packs, my_custom_files) -> For custom JS, CSS, images using webpacker
|- jobs
|- mailers
|- models (concerns) -> contains application_record.rb, friend.rb, users.rb
|- views (divise, friends, home, layouts)
|- bin
|- config
|- environments
|- initializers
|- locales
|- webpack
|- db
|- lib
|- log
|- .node_modules
|- public
|- storage
|- test
|- tmp
|- vendor
Consider the following project structure as a Gradle build:
backend
|- adapters
|- adapter-common
|- bar-adapter
|- bar-entrypoint
|- bar-models
\- bar-services
\- foo-adapter
|- foo-entrypoint
|- foo-models
\- foo-services
|- backend-common
|- db-conn
|- backend-entrypoint
|- build.gradle
\- settings.gradle
The dependency structure is as follows:
foo-adapter depends on foo-entrypoint and adapter-common
foo-entrypoint depends on foo-services
foo-services depends on foo-models
adapter-common depends on backend-common & db-conn
Now I have a separate project api where I need foo-adapter as a dependency. I found this Q&A which seems to be the same situation but when I tried it I get errors about how none of the other projects (adapter-common, db-conn, etc.) are found.
Am I asking too much from Gradle by telling it to just import foo-adapter and then expecting it to pull in and resolve all the dependencies itself?
Is there any way to get this to work without declaring basically the whole backend project in my api settings file?
If your foo-adapter project use some classes from other projects it cannot be added without the others. Not matters it's a jar or just uncompiled stuff. You need the others too. It's a really bad approach to depend a project on another. Better you use only interfaces and put them into a separate project. Thus your projects can be compiled independently and you need just one configuration project that combines all that stuff.
I am having a hard time adding a Visual Studio Solution with multiple projects to my repo. I am using VisualSVN. Here is my directory structure
c:\-----
|
---Projects
|
--MyApp
|
---Project1 (The solution is in this project directory)
---Project2
---Project3
When I select "MyApp" as the working copy root, nothing is added. If I select one of the project folder, only 2 are added.
Here's the structure I use with success:
dev
|- Project root folder (solution file here is the key)
|- Class Project
|- Class Project
|- Web Project
|- References
|- Resources
What I'm suggesting is that you should move your .sln file to the top level then import.
Another advance approach.
Each project has it is own trunk with following structure
trunk
|- .sln
|- src
|- ClassProject
|- Web Project
Then in a separate svn directory create sub directory for every solution you need. For example you can have AllProjects, WebOnly, DALOnly.
And using svn:externals bring every project you need (ClassProject etc.) in given case.