I am trying to add this header-only library to my project : https://github.com/CPPAlliance/url
My project structure :
├── build
│ ├── build.ninja
│ ├── CMakeCache.txt
│ ├── CMakeFiles
│ │ ├── 3.18.0-rc1
│ │ │ ├── CMakeCCompiler.cmake
│ │ │ ├── CMakeCXXCompiler.cmake
│ │ │ ├── CMakeDetermineCompilerABI_C.bin
│ │ │ ├── CMakeDetermineCompilerABI_CXX.bin
│ │ │ ├── CMakeSystem.cmake
│ │ │ ├── CompilerIdC
│ │ │ └── CompilerIdCXX
│ │ ├── cmake.check_cache
│ │ ├── CMakeError.log
│ │ ├── CMakeOutput.log
│ │ ├── CMakeTmp
│ │ ├── cmake.verify_globs
│ │ ├── hftbot.dir
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── CXX.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ └── src
│ │ ├── Makefile2
│ │ ├── Progress
│ │ │ ├── 1
│ │ │ └── count.txt
│ │ ├── progress.marks
│ │ ├── rules.ninja
│ │ ├── TargetDirectories.txt
│ │ └── VerifyGlobs.cmake
│ ├── cmake_install.cmake
│ ├── compile_commands.json
│ ├── details.json
│ ├── external
│ │ ├── json
│ │ │ ├── CMakeFiles
│ │ │ └── cmake_install.cmake
│ │ └── url
│ │ ├── CMakeFiles
│ │ └── cmake_install.cmake
│ ├── hftbot
│ ├── Makefile
│ └── src
│ ├── CMakeFiles
│ │ ├── CMakeDirectoryInformation.cmake
│ │ └── progress.marks
│ ├── cmake_install.cmake
│ └── Makefile
├── build.sh
├── CMakeLists.txt
├── configure.sh
├── details.json
├── external
│ └── urlib
│ ├── build
│ │ └── Jamfile
│ ├── cmake
│ │ ├── config.cmake.in
│ │ └── toolchains
│ ├── CMakeLists.txt
│ ├── doc
│ │ ├── images
│ │ ├── Jamfile
│ │ ├── javadoc.hpp
│ │ ├── qbk
│ │ ├── README.md
│ │ ├── tools
│ │ └── xsl
│ ├── extra
│ │ ├── include
│ │ └── test_main.cpp
│ ├── include
│ │ └── boost
│ ├── Jamfile
│ ├── LICENSE_1_0.txt
│ ├── meta
│ │ ├── explicit-failures-markup.xml
│ │ └── libraries.json
│ ├── README.md
│ ├── src
│ │ └── src.cpp
│ └── test
│ ├── CMakeLists.txt
│ ├── Jamfile
│ ├── limits
│ ├── unit
│ └── wpt
├── run.sh
└── src
├── CMakeLists.txt
├── httpClient.cpp
└── WebsocketClient.cpp
CMakeLists.txt in the root folder :
cmake_minimum_required(VERSION 3.18.0)
project(hftbot)
find_package(Boost 1.79.0 REQUIRED COMPONENTS system thread filesystem container)
find_package(Threads REQUIRED)
add_subdirectory(src)
include_directories(SYSTEM external/urlib/include)
set(URLIB_DIRECTORY "external/urlib/include")
set(URLIB_HEADERS ${URLIB_DIRECTORY}/boost/url.hpp ${URLIB_DIRECTORY}/boost/url/src.hpp)
set(SOURCES src/httpClient.cpp)
add_executable(${PROJECT_NAME} ${SOURCES} ${URLIB_HEADERS})
target_include_directories(${PROJECT_NAME} PRIVATE ${URLIB_DIRECTORY})
As you can see i used target_include_directories() to include header files into my project.
but it seems that something is wrong here.
#include <boost/url.hpp>
#include <boost/url/src.hpp>
When i try to include this one, it is showing me build error :
/usr/local/bin/cmake -S/home/user/Desktop/HFTBOT -B/home/user/Desktop/HFTBOT/build --check-build-system CMakeFiles/Makefile.cmake 0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/Desktop/HFTBOT/build
/usr/local/bin/cmake -E cmake_progress_start /home/user/Desktop/HFTBOT/build/CMakeFiles /home/user/Desktop/HFTBOT/build//CMakeFiles/progress.marks
make -s -f CMakeFiles/Makefile2 all
Scanning dependencies of target hftbot
CMake Error: Directory Information file not found
[ 50%] Building CXX object CMakeFiles/hftbot.dir/src/httpClient.cpp.o
/home/user/Desktop/HFTBOT/src/httpClient.cpp:11:10: fatal error: boost/url/src.hpp: No such file or directory
11 | #include "boost/url/src.hpp"
| ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/hftbot.dir/build.make:83: CMakeFiles/hftbot.dir/src/httpClient.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:116: CMakeFiles/hftbot.dir/all] Error 2
make: *** [Makefile:104: all] Error 2
I got a feeling that is it because of the location of executable that produce this error ?
Since your source is not in the project root but in src/ you might have to specify the relative path using ../external/url/include. A more typical approach in CMake is to use absolute paths:
set(URLIB_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/external/urlib/include")
I created a self-contained example with instructions to build here: https://github.com/sehe/BoostURLAsSubmodule/tree/main
BoostURLAsSubmodule
Steps to build:
git clone --recurse-submodules https://github.com/sehe/BoostURLAsSubmodule
cd BoostURLAsSubmodule/
cmake -B build .
make -C build/
If you need, override BOOST_ROOT:
BOOST_ROOT=~/custom/boost_1_79_0/ cmake -B build .
Related
Tree level overview of my project:
├── build
│ ├── build.ninja
│ ├── CMakeCache.txt
│ ├── CMakeFiles
│ │ ├── 3.18.0-rc1
│ │ ├── cmake.check_cache
│ │ ├── CMakeError.log
│ │ ├── CMakeOutput.log
│ │ ├── CMakeTmp
│ │ ├── cmake.verify_globs
│ │ ├── hftbot.dir
│ │ ├── Makefile2
│ │ ├── progress.marks
│ │ ├── rules.ninja
│ │ ├── TargetDirectories.txt
│ │ └── VerifyGlobs.cmake
│ ├── cmake_install.cmake
│ ├── compile_commands.json
│ ├── details.json
│ ├── external
│ │ └── json
│ ├── hftbot
│ ├── Makefile
│ └── src
│ ├── CMakeFiles
│ ├── cmake_install.cmake
│ └── Makefile
├── build.sh
├── CMakeLists.txt
├── configure.sh
├── details.json
├── external
│ ├── asio
│ │ ├── CMakeLists.txt
│ │ ├── doc
│ │ ├── example
│ │ ├── include
│ │ ├── index.html
│ │ ├── meta
│ │ ├── test
│ │ └── tools
│ ├── CMakeLists.txt
│ └── json
│ ├── bench
│ ├── build
│ ├── CHANGELOG.md
│ ├── check
│ ├── cmake
│ ├── CMakeLists.txt
│ ├── CONTRIBUTING.md
│ ├── doc
│ ├── example
│ ├── fuzzing
│ ├── include
│ ├── index.html
│ ├── Jamfile
│ ├── LICENSE_1_0.txt
│ ├── meta
│ ├── README.md
│ ├── src
│ └── test
├── run.sh
└── src
├── CMakeLists.txt
├── httpClient.cpp
└── WebsocketClient.cpp
https://github.com/boostorg/json
i cloned this project to "external/json" directory from root directory.
I added following commands in CMakeLists.txt in the root directory
target_include_directories(${PROJECT_NAME} PUBLIC "external/json/include")
target_link_libraries(${PROJECT_NAME} PUBLIC boost_json)
And when i add this :
#include <boost/json.hpp>
#include <boost/json/src.hpp>
it says that source boost/json.hpp and boost/json/src.hpp is not found.
I am using CLion to write a Cmake project. here is the tree view of the directory(files are ignored),where lemon-1.3-1 is the third party library.
├── cmake-build-debug
│ ├── CMakeFiles
│ │ ├── 3.15.3
│ │ │ ├── CompilerIdC
│ │ │ │ └── tmp
│ │ │ └── CompilerIdCXX
│ │ │ └── tmp
│ │ ├── CheckTypeSize
│ │ ├── CMakeTmp
│ │ ├── graph_partition_essay.dir
│ │ └── Progress
│ └── lemon-1.3.1
│ ├── cmake
│ ├── CMakeFiles
│ │ ├── check.dir
│ │ └── dist.dir
│ └── lemon
│ └── CMakeFiles
│ └── lemon.dir
│ └── bits
└── lemon-1.3.1
├── cmake
│ └── nsis
├── contrib
├── demo
├── doc
│ ├── html
│ │ └── search
│ └── images
├── lemon
│ ├── bits
│ └── concepts
├── scripts
├── test
└── tools
Also I write the following CMakeLists.txt. Using this file, the auto code completion can function normally.
cmake_minimum_required(VERSION 3.15)
project(graph_partition_essay)
set (LEMON_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/lemon-1.3.1)
add_subdirectory(lemon-1.3.1)
add_executable(graph_partition_essay main.cpp)
and the main.cpp
#include <iostream>
#include "lemon-1.3.1/lemon/list_graph.h"
using namespace lemon;
int main() {
ListDigraph g;
std::cout << "Hello, World!" << std::endl;
return 0;
}
But when I run the main function, I got the following error message.
In file included from F:\xxx\graph_partition_essay\main.cpp:2:
F:\xxx\graph_partition_essay\lemon-1.3.1/lemon/list_graph.h:26:10: fatal error: lemon/core.h: No such file or directory
26 | #include <lemon/core.h>
| ^~~~~~~~~~~~~~
compilation terminated.
How can I fix this problem?
I have been working on a C++ project which depends on RPLidar SDK. I have already installed the SDK as per the instructions in the README. (FYI: I couldn't install it in the /usr/local/ directory using sudo make install command). As per the SDK documentation:
When developing via RPLIDAR SDK, developers only need to include SDK’s
external header files (under sdk\include) into their own source code and link the
application with SDK’s static library (rplidar_driver.lib or rplidar_driver.a).
So, in my CMakeLists.txt, I have already added:
include_directories(/home/milan/rplidar_sdk/sdk/sdk/include/)
However, I couldn't find rplidar_driver.lib or rplidar_driver.h. Here, is the directory structure of the SDK:
.
├── docs
│ ├── ReleaseNote.v1.10.0.md
│ | ...
│ └── ReleaseNote.v1.9.1.md
├── LICENSE
├── README.md
├── sdk
│ ├── app
│ │ ├── frame_grabber
│ │ │ ├── AboutDlg.cpp
│ │ │ ├── AboutDlg.h
│ │ │ ├── drvlogic
│ │ │ │ ├── common.h
│ │ │ │ ├── lidarmgr.cpp
│ │ │ │ └── lidarmgr.h
│ │ │ ├── framegrabber.cpp
│ │ │ ├── framegrabber.h
│ │ │ ├── framegrabber.rc
│ │ │ ├── FreqSetDlg.cpp
│ │ │ ├── FreqSetDlg.h
│ │ │ ├── MainFrm.cpp
│ │ │ ├── MainFrm.h
│ │ │ ├── ref
│ │ │ │ └── wtl
│ │ │ │ ├── atlapp.h
│ │ │ │ ├── atlcrack.h
│ │ │ │ ├── atlctrls.h
│ │ │ │ ├── atlctrlw.h
│ │ │ │ ├── atlctrlx.h
│ │ │ │ ├── atlddx.h
│ │ │ │ ├── atldlgs.h
│ │ │ │ ├── atldwm.h
│ │ │ │ ├── atlfind.h
│ │ │ │ ├── atlframe.h
│ │ │ │ ├── atlgdi.h
│ │ │ │ ├── atlmisc.h
│ │ │ │ ├── atlprint.h
│ │ │ │ ├── atlresce.h
│ │ │ │ ├── atlres.h
│ │ │ │ ├── atlribbon.h
│ │ │ │ ├── atlscrl.h
│ │ │ │ ├── atlsplit.h
│ │ │ │ ├── atltheme.h
│ │ │ │ ├── atluser.h
│ │ │ │ ├── atlwince.h
│ │ │ │ └── atlwinx.h
│ │ │ ├── res
│ │ │ │ ├── rplidar.ico
│ │ │ │ └── Toolbar.bmp
│ │ │ ├── resource.h
│ │ │ ├── scanView.cpp
│ │ │ ├── scanView.h
│ │ │ ├── SerialSelDlg.cpp
│ │ │ ├── SerialSelDlg.h
│ │ │ ├── stdafx.cpp
│ │ │ ├── stdafx.h
│ │ │ ├── TcpChannelSelDlg.cpp
│ │ │ └── TcpChannelSelDlg.h
│ │ ├── Makefile
│ │ ├── simple_grabber
│ │ │ ├── main.cpp
│ │ │ └── Makefile
│ │ └── ultra_simple
│ │ ├── main.cpp
│ │ └── Makefile
│ ├── cross_compile.sh
│ ├── mak_common.inc
│ ├── mak_def.inc
│ ├── Makefile
│ ├── obj
│ │ └── Linux
│ │ └── Release
│ │ ├── sdk
│ │ │ └── src
│ │ │ ├── arch
│ │ │ │ └── linux
│ │ │ │ ├── net_serial.o
│ │ │ │ ├── net_socket.o
│ │ │ │ └── timer.o
│ │ │ ├── hal
│ │ │ │ └── thread.o
│ │ │ └── rplidar_driver.o
│ │ ├── simple_grabber
│ │ │ └── main.o
│ │ └── ultra_simple
│ │ └── main.o
│ ├── output
│ │ └── Linux
│ │ └── Release
│ │ ├── librplidar_sdk.a
│ │ ├── simple_grabber
│ │ └── ultra_simple
│ ├── sdk
│ │ ├── include
│ │ │ ├── rplidar_cmd.h
│ │ │ ├── rplidar_driver.h
│ │ │ ├── rplidar.h
│ │ │ ├── rplidar_protocol.h
│ │ │ └── rptypes.h
│ │ ├── Makefile
│ │ └── src
│ │ ├── arch
│ │ │ ├── linux
│ │ │ │ ├── arch_linux.h
│ │ │ │ ├── net_serial.cpp
│ │ │ │ ├── net_serial.h
│ │ │ │ ├── net_socket.cpp
│ │ │ │ ├── thread.hpp
│ │ │ │ ├── timer.cpp
│ │ │ │ └── timer.h
│ │ │ ├── macOS
│ │ │ │ ├── arch_macOS.h
│ │ │ │ ├── net_serial.cpp
│ │ │ │ ├── net_serial.h
│ │ │ │ ├── net_socket.cpp
│ │ │ │ ├── thread.hpp
│ │ │ │ ├── timer.cpp
│ │ │ │ └── timer.h
│ │ │ └── win32
│ │ │ ├── arch_win32.h
│ │ │ ├── net_serial.cpp
│ │ │ ├── net_serial.h
│ │ │ ├── net_socket.cpp
│ │ │ ├── timer.cpp
│ │ │ ├── timer.h
│ │ │ └── winthread.hpp
│ │ ├── hal
│ │ │ ├── abs_rxtx.h
│ │ │ ├── assert.h
│ │ │ ├── byteops.h
│ │ │ ├── event.h
│ │ │ ├── locker.h
│ │ │ ├── socket.h
│ │ │ ├── thread.cpp
│ │ │ ├── thread.h
│ │ │ ├── types.h
│ │ │ └── util.h
│ │ ├── rplidar_driver.cpp
│ │ ├── rplidar_driver_impl.h
│ │ ├── rplidar_driver_serial.h
│ │ ├── rplidar_driver_TCP.h
│ │ └── sdkcommon.h
│ └── workspaces
│ ├── vc10
│ │ ├── frame_grabber
│ │ │ ├── frame_grabber.vcxproj
│ │ │ └── frame_grabber.vcxproj.filters
│ │ ├── rplidar_driver
│ │ │ ├── rplidar_driver.vcxproj
│ │ │ └── rplidar_driver.vcxproj.filters
│ │ ├── sdk_and_demo.sln
│ │ ├── simple_grabber
│ │ │ ├── simple_grabber.vcxproj
│ │ │ └── simple_grabber.vcxproj.filters
│ │ └── ultra_simple
│ │ ├── ultra_simple.vcxproj
│ │ └── ultra_simple.vcxproj.filters
│ └── vc14
│ ├── frame_grabber
│ │ ├── frame_grabber.vcxproj
│ │ └── frame_grabber.vcxproj.filters
│ ├── rplidar_driver
│ │ ├── rplidar_driver.vcxproj
│ │ └── rplidar_driver.vcxproj.filters
│ ├── sdk_and_demo.sln
│ ├── simple_grabber
│ │ ├── simple_grabber.vcxproj
│ │ └── simple_grabber.vcxproj.filters
│ └── ultra_simple
│ ├── ultra_simple.vcxproj
│ └── ultra_simple.vcxproj.filters
└── tools
└── cp2102_driver
└── CP210x_Windows_Drivers.zip
Now, in my main.cpp, I have this line: #include <rplidar.h>. I can successfully run cmake .. command in the build directory of my project. However, upon running make command, it's giving me this error:
In file included from /home/milan/<project>/src/main.cpp:3:0:
/home/milan/rplidar_sdk/sdk/sdk/include/rplidar.h:38:10: fatal error: hal/types.h: No such file or directory
#include "hal/types.h"
^~~~~~~~~~~~~
compilation terminated.
CMakeFiles/<project>.dir/build.make:81: recipe for target 'CMakeFiles/<project>.dir/src/main.cpp.o' failed
make[2]: *** [CMakeFiles/<project>.dir/src/main.cpp.o] Error 1
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/<project>.dir/all' failed
make[1]: *** [CMakeFiles/<project>.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2
Here is my complete CMakeLists.txt:
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(<project>)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
include_directories(include)
include_directories(/home/milan/rplidar_sdk/sdk/sdk/include/)
add_executable(${PROJECT_NAME} src/main.cpp)
How can I fix this?
Since you already compiled the library, create an IMPORTED target that references the sdk/include and sdk/src directories as include path:
add_library(rplidar STATIC IMPORTED)
set_property(TARGET rplidar
PROPERTY IMPORTED_LOCATION /home/milan/rplidar_sdk/output/Linux/Release/librplidar_sdk.a)
target_include_directories(rplidar INTERFACE
/home/milan/rplidar_sdk/sdk/sdk/include/
/home/milan/rplidar_sdk/sdk/sdk/src/)
You may even need to add the sdk/arch/linux directory to the include path.
And now you can link that library to your main file by doing:
target_link_libraries(${PROJECT_NAME} rplidar)
If someone is directly looking for the updated CMakeLists.txt then here it is (special thanks to #Botje):
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
project(<project_name>)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
SET(CMAKE_CXX_FLAGS -pthread)
include_directories(include)
add_executable(${PROJECT_NAME} src/main.cpp src/another_src_file.cpp)
## RPLidar
# Update the following path variable as per the RPLidar SDK installation in your system!
set(RPLIDAR_SDK_PATH "/home/milan/rplidar_sdk/")
add_library(rplidar STATIC IMPORTED)
set_property(TARGET rplidar
PROPERTY IMPORTED_LOCATION ${RPLIDAR_SDK_PATH}/sdk/output/Linux/Release/librplidar_sdk.a)
target_include_directories(rplidar INTERFACE
${RPLIDAR_SDK_PATH}/sdk/sdk/include/
${RPLIDAR_SDK_PATH}/sdk/sdk/src/)
target_link_libraries(${PROJECT_NAME} rplidar)
Note: First, you have to build rplidar_sdk
I'm trying to write a CMakeLists.txt file for the test/ directory in a project I'm working on. The directory tree for test/ is
test/
├── CMakeLists.txt
├── data_handlers.o
├── Makefile
├── run_tests.cpp
├── test_data
│ ├── QLD.csv
│ └── SPY.csv
├── test_data_handler.cpp
├── test_data_reader.cpp
├── test_exec_handler.cpp
├── test_fill.cpp
├── test_instrument.cpp
├── test_market_bar.cpp
├── test_market_snapshot.cpp
├── test_order.cpp
├── test_pnl_calculator.cpp
├── test_portfolio.cpp
└── test_position_summary.cpp
The unusual thing that I'm doing is all of the source files that these tests are testing are not compiled as a library, and that directory has its own CMakeLists.txt, too. So this cmake file that belongs to test/ has to compile and link those guys too. However, I get a million undefined reference errors, and it can't find things that were defined outside of this test/ directory.
Here's test/CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(markets_tests)
set(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_COMPILER /usr/bin/g++-8)
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
find_package(UnitTest++ REQUIRED)
SET(GCC_COVERAGE_COMPILE_FLAGS "-no-pie")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
include_directories(
"${PROJECT_SOURCE_DIR}/../include"
${UTPP_INCLUDE_DIRS}
)
file(GLOB all_SRCS
"${PROJECT_SOURCE_DIR}/*.cpp"
"${PROJECT_SOURCE_DIR}/../src/data_handlers.cpp"
"${PROJECT_SOURCE_DIR}/../src/data_readers.cpp"
"${PROJECT_SOURCE_DIR}/../src/data_execution_handler.cpp"
"${PROJECT_SOURCE_DIR}/../src/fill.cpp"
"${PROJECT_SOURCE_DIR}/../src/instrument.cpp"
"${PROJECT_SOURCE_DIR}/../src/market_bar.cpp"
"${PROJECT_SOURCE_DIR}/../src/market_snapshot.cpp"
"${PROJECT_SOURCE_DIR}/../src/model_bank.cpp"
"${PROJECT_SOURCE_DIR}/../src/order.cpp"
"${PROJECT_SOURCE_DIR}/../src/pnl_calculator.cpp"
"${PROJECT_SOURCE_DIR}/../src/portfolio.cpp"
"${PROJECT_SOURCE_DIR}/../src/position_summary.cpp"
)
add_executable(run_tests ${all_SRCS})
target_link_libraries (run_tests Eigen3::Eigen stdc++fs UnitTest++)
Edit
Here is the tree for the overall project
t#t-XPS-13-9365:~/markets$ tree
.
├── build
│ ├── CMakeCache.txt
│ ├── CMakeFiles
│ │ ├── 3.10.2
│ │ │ ├── CMakeCCompiler.cmake
│ │ │ ├── CMakeCXXCompiler.cmake
│ │ │ ├── CMakeDetermineCompilerABI_C.bin
│ │ │ ├── CMakeDetermineCompilerABI_CXX.bin
│ │ │ ├── CMakeSystem.cmake
│ │ │ ├── CompilerIdC
│ │ │ │ ├── a.out
│ │ │ │ ├── CMakeCCompilerId.c
│ │ │ │ └── tmp
│ │ │ └── CompilerIdCXX
│ │ │ ├── a.out
│ │ │ ├── CMakeCXXCompilerId.cpp
│ │ │ └── tmp
│ │ ├── cmake.check_cache
│ │ ├── CMakeDirectoryInformation.cmake
│ │ ├── CMakeOutput.log
│ │ ├── CMakeTmp
│ │ ├── feature_tests.bin
│ │ ├── feature_tests.c
│ │ ├── feature_tests.cxx
│ │ ├── Makefile2
│ │ ├── Makefile.cmake
│ │ ├── progress.marks
│ │ ├── run_backtest.dir
│ │ │ ├── build.make
│ │ │ ├── cmake_clean.cmake
│ │ │ ├── CXX.includecache
│ │ │ ├── DependInfo.cmake
│ │ │ ├── depend.internal
│ │ │ ├── depend.make
│ │ │ ├── flags.make
│ │ │ ├── link.txt
│ │ │ ├── progress.make
│ │ │ └── src
│ │ │ ├── data_handlers.cpp.o
│ │ │ ├── data_readers.cpp.o
│ │ │ ├── execution_handler.cpp.o
│ │ │ ├── fill.cpp.o
│ │ │ ├── instrument.cpp.o
│ │ │ ├── main.cpp.o
│ │ │ ├── market_bar.cpp.o
│ │ │ ├── market_snapshot.cpp.o
│ │ │ ├── model_bank.cpp.o
│ │ │ ├── order.cpp.o
│ │ │ ├── pnl_calculator.cpp.o
│ │ │ ├── portfolio.cpp.o
│ │ │ └── position_summary.cpp.o
│ │ └── TargetDirectories.txt
│ ├── cmake_install.cmake
│ ├── Makefile
│ └── run_backtest
├── CMakeLists.txt
├── data
│ ├── QLD.csv
│ └── SPY.csv
├── include
│ ├── data_handlers.h
│ ├── data_readers.h
│ ├── execution_handler.h
│ ├── fill.h
│ ├── instrument.h
│ ├── market_bar.h
│ ├── market_snapshot.h
│ ├── model_bank.h
│ ├── order.h
│ ├── pnl_calculator.h
│ ├── portfolio.h
│ └── position_summary.h
├── README.md
├── scripts
│ └── download_raw_daily_data.r
├── src
│ ├── data_handlers.cpp
│ ├── data_readers.cpp
│ ├── execution_handler.cpp
│ ├── fill.cpp
│ ├── instrument.cpp
│ ├── main.cpp
│ ├── market_bar.cpp
│ ├── market_snapshot.cpp
│ ├── model_bank.cpp
│ ├── order.cpp
│ ├── pnl_calculator.cpp
│ ├── portfolio.cpp
│ └── position_summary.cpp
└── test
├── CMakeLists.txt
├── data_handlers.o
├── Makefile
├── run_tests.cpp
├── test_data
│ ├── QLD.csv
│ └── SPY.csv
├── test_data_handler.cpp
├── test_data_reader.cpp
├── test_exec_handler.cpp
├── test_fill.cpp
├── test_instrument.cpp
├── test_market_bar.cpp
├── test_market_snapshot.cpp
├── test_order.cpp
├── test_pnl_calculator.cpp
├── test_portfolio.cpp
└── test_position_summary.cpp
Edit 2
I've tried to take into account the solution proposed below by squareskittles. Here's my CMakeLists.txt in the top level directory:
cmake_minimum_required(VERSION 3.10)
project(markets)
set(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_COMPILER /usr/bin/g++-8)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
include_directories(
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src
)
file(GLOB all_SRCS
"${PROJECT_SOURCE_DIR}/include/*.h"
"${PROJECT_SOURCE_DIR}/src/*.cpp"
)
add_executable(run_backtest ${all_SRCS})
add_library(MarketLibrary ${all_SRCS})
add_subdirectory(test)
target_link_libraries (run_backtest Eigen3::Eigen stdc++fs)
When I try to cmake .. this, it just runs forever.
If your top-level CMakeLists.txt file creates the library (say, MarketLibrary), you can reference it and link it to your test executable in your other CMake files. This should help with the undefined reference errors:
CMakeLists.txt:
...
add_library(MarketLibrary
src/data_handlers.cpp
src/data_readers.cpp
...
)
...
add_subdirectory(test)
test/CMakeLists.txt (modify your target_link_libraries() command):
project(markets_tests)
...
add_executable(run_tests ${all_SRCS})
target_link_libraries(run_tests Eigen3::Eigen stdc++fs UnitTest++ MarketLibrary)
I recently migrated an ember app that I was compiling using bower to ember-cli. It had already grown pretty large, but I was running into issues with my current dev environment and ember-cli seems like the cleaner solution.
Unfortunately, after updating the files for the ember-cli interface, the build isn't working. I have left it running for 5 minutes at 100% CPU, and it reached two dots after Building.. and stopped.
I am using Sublime text, but I updated my preferences under http://www.ember-cli.com/#commonissues. I added broccoli-sass using npm and ember-data.model-fragments using ember install:addon. Below is my package.json
{
"name": "frontend",
"version": "0.0.0",
"description": "Small description for frontend goes here",
"private": true,
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"start": "ember server",
"build": "ember build",
"test": "ember test"
},
"repository": "",
"engines": {
"node": ">= 0.10.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^2.0.0",
"broccoli-sass": "git://github.com/aexmachina/broccoli-sass#sources-content",
"ember-cli": "0.1.11",
"ember-cli-6to5": "^3.0.0",
"ember-cli-app-version": "0.3.0",
"ember-cli-content-security-policy": "0.3.0",
"ember-cli-dependency-checker": "0.0.7",
"ember-cli-htmlbars": "^0.6.0",
"ember-cli-ic-ajax": "0.1.1",
"ember-cli-inject-live-reload": "^1.3.0",
"ember-cli-qunit": "0.3.0",
"ember-cli-uglify": "1.0.1",
"ember-data": "1.0.0-beta.14.1",
"ember-data-model-fragments": "0.2.7",
"ember-export-application-global": "^1.0.0",
"express": "^4.8.5",
"glob": "^4.0.5"
}
}
and here is my app file tree. I'm wondering if it has something to do with all the folders I added (objects, definitions, libraries, etc).
app
├── app.js
├── components
│ ├── dual-slider.js
│ ├── scroll-arrow.js
│ ├── single-slider.js
│ └── square-div.js
├── controllers
│ ├── application.js
│ ├── authentication
│ │ ├── login.js
│ │ └── signup.js
│ ├── demos
│ │ ├── derivatives.js
│ │ ├── integrals.js
│ │ └── revolutions.js
│ ├── flash.js
│ ├── index.js
│ ├── lessons
│ │ ├── index.js
│ │ ├── new
│ │ │ ├── create-step.js
│ │ │ ├── index.js
│ │ │ └── step.js
│ │ ├── new.js
│ │ ├── show
│ │ │ ├── index.js
│ │ │ └── step.js
│ │ └── show.js
│ └── subjects
│ ├── index.js
│ └── show.js
├── definitions
│ ├── animationKeys.js
│ ├── stepArray.js
│ └── typeKeys.js
├── helpers
│ ├── focus-input.js
│ └── slider-label-input.js
├── index.html
├── initializers
│ └── session-setup.js
├── libraries
│ └── mathAnimationLibrary
│ ├── dist
│ │ ├── display-library.js
│ │ └── vendor
│ │ ├── math.js
│ │ ├── three.js
│ │ ├── trackballControls.js
│ │ └── zgentilis_bold.typeface.js
│ └── src
│ ├── DisplayLibrary.js
│ └── functions
│ ├── create2DFunction.js
│ ├── createAxis.js
│ ├── createIntegralDisplay.js
│ ├── createRotationFunction.js
│ ├── createSurface.js
│ ├── mathEnvironment.js
│ └── showDerivative.js
├── mixins
│ └── animation.js
├── models
│ ├── animation-params.js
│ ├── animation.js
│ ├── choice.js
│ ├── equation-part.js
│ ├── equation.js
│ ├── explanation.js
│ ├── instruction.js
│ ├── lesson-step-type.js
│ ├── lesson-step.js
│ ├── lesson.js
│ ├── multiple-choice.js
│ ├── special-animation-params.js
│ ├── subject.js
│ └── user.js
├── objects
│ ├── flash-queue.js
│ ├── flash.js
│ └── session.js
├── router.js
├── routes
│ ├── index.js
│ ├── lessons
│ │ ├── index.js
│ │ ├── new
│ │ │ ├── create-step.js
│ │ │ ├── index.js
│ │ │ └── step.js
│ │ ├── new.js
│ │ ├── show
│ │ │ ├── index.js
│ │ │ └── step.js
│ │ └── show.js
│ ├── logout.js
│ └── subjects
│ ├── index.js
│ └── show.js
├── serializers
│ ├── application.js
│ └── lesson.js
├── styles
│ ├── app.scss
│ ├── reset.css
│ └── sass
│ ├── authentication
│ │ └── authentication.scss
│ ├── colors.scss
│ ├── components
│ │ ├── scroll-arrow.scss
│ │ ├── slider.scss
│ │ └── square-div.scss
│ ├── helpers
│ │ └── flash.scss
│ ├── lessons
│ │ ├── multiple-choice.scss
│ │ └── show.scss
│ ├── main.scss
│ ├── mixins.scss
│ └── root
│ ├── demos.scss
│ ├── header.scss
│ └── index.scss
├── templates
│ ├── about
│ │ └── index.hbs
│ ├── application.hbs
│ ├── backend.hbs
│ ├── components
│ │ ├── dual-slider.hbs
│ │ ├── scroll-arrow.hbs
│ │ ├── single-slider.hbs
│ │ └── square-div.hbs
│ ├── demos
│ │ ├── derivatives.hbs
│ │ ├── index.hbs
│ │ ├── integrals.hbs
│ │ └── revolutions.hbs
│ ├── index.hbs
│ ├── lessons
│ │ ├── equationViewer.hbs
│ │ ├── index.hbs
│ │ ├── multipleChoice.hbs
│ │ ├── new
│ │ │ ├── createStep.hbs
│ │ │ ├── index.hbs
│ │ │ └── step.hbs
│ │ ├── new.hbs
│ │ ├── show
│ │ │ ├── index.hbs
│ │ │ └── step.hbs
│ │ └── show.hbs
│ ├── login.hbs
│ ├── shared
│ ├── signup.hbs
│ └── subjects
│ ├── index.hbs
│ └── show.hbs
└── views
├── demos
│ ├── derivatives.js
│ ├── integrals.js
│ └── revolutions.js
├── flash.js
└── lessons
├── equationViewer.js
└── multipleChoice.js
It's also possible that I missed an import/export somewhere in the file transfer. Would this fail silently as I am seeing or would it raise an error?
I appreciate any insight that you might have.
So apparently there is already some discussion about this on the issues board. Particularly, ember-cli-6to5 is apparently messing with build times in the recent version of ember-cli. After removing that component (you lose functionality aside from modules) it builds much faster. See this discussion for more detail https://github.com/ember-cli/ember-cli/issues/3136.