Skip to content

Commit

Permalink
structure changed
Browse files Browse the repository at this point in the history
  • Loading branch information
SermetPekin committed Nov 5, 2024
1 parent d41cef1 commit b0daa52
Show file tree
Hide file tree
Showing 21 changed files with 139 additions and 266 deletions.
94 changes: 94 additions & 0 deletions --CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# CMake version requirement
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

project(evdscpp LANGUAGES CXX)

#=======================================================================================================================
# Set C++ compiler version
#=======================================================================================================================
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#=======================================================================================================================
# Define the source files
#=======================================================================================================================
set(source_files src/main.cpp) # Assuming main.cpp is in the src/ directory

#=======================================================================================================================
# Add the executable target
#=======================================================================================================================
add_executable(evdscpp ${source_files})

#=======================================================================================================================
# Dependencies
#=======================================================================================================================

include_directories("extern/dotenv")


# ----------> curl
find_package(CURL REQUIRED)
target_link_libraries(evdscpp PRIVATE CURL::libcurl)

# ----------> nlohmann-json
include_directories("extern/nlohmann")



#=======================================================================================================================
# Output directories for different types of build outputs
#=======================================================================================================================
include(GNUInstallDirs)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})

#=======================================================================================================================
# Enable testing
#=======================================================================================================================
enable_testing()

#=======================================================================================================================
# Test target
#=======================================================================================================================
add_executable(test_dataframe tests/test_dataframe.cpp)

# Link the test executable to the same libraries as the main executable
target_include_directories(test_dataframe PRIVATE extern/nlohmann)

#=======================================================================================================================
# Valgrind check target
#=======================================================================================================================
find_program(VALGRIND "valgrind")

if (VALGRIND)
add_custom_target(valgrind_check
COMMAND ${VALGRIND} --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose
$<TARGET_FILE:evdscpp>
COMMENT "Running Valgrind memory check on evdscpp"
DEPENDS evdscpp
)
else()
message(WARNING "Valgrind not found. 'valgrind_check' target will not be available.")
endif()



# Enable AddressSanitizer for memory error detection
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g")


#=======================================================================================================================
# Build instructions
#=======================================================================================================================
# To build and run the project:
# mkdir build
# cd build
# cmake ..
# make
# ./evdscpp
#
# To run Valgrind check:
# make valgrind_check

93 changes: 9 additions & 84 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,94 +1,19 @@
# CMake version requirement
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

cmake_minimum_required(VERSION 3.20)
project(evdscpp LANGUAGES CXX)

#=======================================================================================================================
# Set C++ compiler version
#=======================================================================================================================
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

#=======================================================================================================================
# Define the source files
#=======================================================================================================================
set(source_files src/main.cpp) # Assuming main.cpp is in the src/ directory

#=======================================================================================================================
# Add the executable target
#=======================================================================================================================
add_executable(evdscpp ${source_files})

#=======================================================================================================================
# Dependencies
#=======================================================================================================================

include_directories("extern/dotenv")


# ----------> curl
find_package(CURL REQUIRED)
target_link_libraries(evdscpp PRIVATE CURL::libcurl)

# ----------> nlohmann-json
include_directories("extern/nlohmann")



#=======================================================================================================================
# Output directories for different types of build outputs
#=======================================================================================================================
include(GNUInstallDirs)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR})

#=======================================================================================================================
# Enable testing
#=======================================================================================================================
enable_testing()

#=======================================================================================================================
# Test target
#=======================================================================================================================
add_executable(test_dataframe tests/test_dataframe.cpp)

# Link the test executable to the same libraries as the main executable
target_include_directories(test_dataframe PRIVATE extern/nlohmann)

#=======================================================================================================================
# Valgrind check target
#=======================================================================================================================
find_program(VALGRIND "valgrind")

if (VALGRIND)
add_custom_target(valgrind_check
COMMAND ${VALGRIND} --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose
$<TARGET_FILE:evdscpp>
COMMENT "Running Valgrind memory check on evdscpp"
DEPENDS evdscpp
)
else()
message(WARNING "Valgrind not found. 'valgrind_check' target will not be available.")
endif()


set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Enable AddressSanitizer for memory error detection
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer -g")
include_directories(include)
include_directories(extern/nlohmann) # External dependencies
include_directories(extern/dotenv) # External dependencies

find_package(CURL REQUIRED)

#=======================================================================================================================
# Build instructions
#=======================================================================================================================
# To build and run the project:
# mkdir build
# cd build
# cmake ..
# make
# ./evdscpp
#
# To run Valgrind check:
# make valgrind_check
add_subdirectory(src)

add_subdirectory(tests)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

set(SOURCES

main.cpp
main.cpp

)

add_library(evdscpp_lib ${SOURCES})

target_link_libraries(evdscpp_lib PRIVATE CURL::libcurl)

add_executable(evdscpp main.cpp)
target_link_libraries(evdscpp PRIVATE evdscpp_lib)
171 changes: 0 additions & 171 deletions src/main.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/response.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/test_.index

This file was deleted.

Loading

0 comments on commit b0daa52

Please sign in to comment.