Skip to content

Commit

Permalink
Use cmake target for include (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
aartiukh authored Nov 17, 2024
1 parent fda3510 commit 78f76b4
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 25 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /WX /wd4548 /wd4251 /wd4514 /wd4668 /wd4820 /wd4710 /wd4625 /wd4626 /wd4826 /wd4505")
endif()

include_directories(.)

# Third party folder
set(THIRDPARTY_DIR ${PROJECT_SOURCE_DIR}/thirdparty)

Expand Down
1 change: 1 addition & 0 deletions algorithms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ if(BUILD_UNIT_TESTS)
endif()

add_library(${ALGORITHMS_LIB_NAME} ${ALGORITHMS_SRC_LIST_INCLUDE} ${ALGORITHMS_SRC_LIST_SOURCE})
target_include_directories(${ALGORITHMS_LIB_NAME} PUBLIC "src")
2 changes: 2 additions & 0 deletions cmake/Modules/FindBuildGLFW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ ExternalProject_Add(glfw-external
set(GLFW_INCLUDE_DIR ${CMAKE_BINARY_DIR}/install/include)
set(GLFW_DEPS_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/thirdparty/glfw/deps)
set(GLFW_LIBRARY ${CMAKE_BINARY_DIR}/install/lib/${CMAKE_STATIC_LIBRARY_PREFIX}glfw3${CMAKE_STATIC_LIBRARY_SUFFIX})

file(COPY ${PROJECT_SOURCE_DIR}/thirdparty/glfw/deps/linmath.h DESTINATION ${CMAKE_BINARY_DIR}/install/include)
23 changes: 12 additions & 11 deletions demo/src/Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

#define GL_SILENCE_DEPRECATION

#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif

#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>

Expand All @@ -12,20 +18,15 @@
#include <stdlib.h>
#include <time.h>

#ifdef __APPLE__
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif

// include header with math functions
#define _USE_MATH_DEFINES
#include <math.h>

#include "algorithms/src/MarchingCubes.h"
#include "algorithms/src/Shapes.h"
#include "sph/src/Config.h"
#include "sph/src/SPH.h"
#include "MarchingCubes.h"
#include "Shapes.h"
#include "Config.h"
#include "SPH.h"


// Window dimensions
SPHSDK::FLOAT aspect_ratio = 1.;
Expand Down Expand Up @@ -182,7 +183,7 @@ void Draw::MainDraw(int argc, char** argv)
{
using namespace SPHSDK;

static const std::function<FLOAT(FLOAT, FLOAT, FLOAT)> obstacle = Shapes::Pawn;
static const std::function<SPHSDK::FLOAT(SPHSDK::FLOAT, SPHSDK::FLOAT, SPHSDK::FLOAT)> obstacle = Shapes::Pawn;
sph = SPH(&obstacle);

mesh = MarchingCubes::generateMesh(obstacle);
Expand Down
3 changes: 2 additions & 1 deletion sph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ if(BUILD_UNIT_TESTS)
endif()

add_library(${SPH_LIB_NAME} ${SPH_SRC_LIST_INCLUDE} ${SPH_SRC_LIST_SOURCE})
target_link_libraries(${SPH_LIB_NAME} algorithms)
target_link_libraries(${SPH_LIB_NAME} PUBLIC algorithms)
target_include_directories(${SPH_LIB_NAME} PUBLIC "src")
2 changes: 1 addition & 1 deletion sph/src/Collisions.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Collisions.h"

#include "Config.h"
#include "algorithms/src/Area.h"
#include "Area.h"


namespace SPHSDK
Expand Down
2 changes: 1 addition & 1 deletion sph/src/Collisions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define COLLISIONS_H_73C34465A6ED4DB9B9F2F4C3937BF5DC

#include "Particle.h"
#include "algorithms/src/Defines.h"
#include "Defines.h"

#include <functional>

Expand Down
2 changes: 1 addition & 1 deletion sph/src/Config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CONFIG_H_73C34465A6ED4DB9B9F2F4C3937BF5DC
#define CONFIG_H_73C34465A6ED4DB9B9F2F4C3937BF5DC

#include "algorithms/src/Point.h"
#include "Point.h"

#include <cstddef>

Expand Down
4 changes: 2 additions & 2 deletions sph/src/Particle.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#define PARTICLE_H_73C34465A6ED4DB9B9F2F4C3937BF5DC

#include "Config.h"
#include "algorithms/src/Defines.h"
#include "algorithms/src/Point.h"
#include "Defines.h"
#include "Point.h"

namespace SPHSDK
{
Expand Down
6 changes: 3 additions & 3 deletions sph/src/SPH.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

#include "Particle.h"

#include "algorithms/src/Area.h"
#include "algorithms/src/Defines.h"
#include "algorithms/src/NeighboursSearch.h"
#include "Area.h"
#include "Defines.h"
#include "NeighboursSearch.h"

#include <functional>

Expand Down
2 changes: 1 addition & 1 deletion sph/test/src/CollisionsTestSuite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "CollisionsTestSuite.h"

#include "Collisions.h"
#include "algorithms/src/Area.h"
#include "Area.h"

#include <gtest/gtest.h>

Expand Down
4 changes: 2 additions & 2 deletions sph/test/src/ForcesTestSuite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
**/

#include "ForcesTestSuite.h"
#include "algorithms/src/Area.h"
#include "algorithms/src/NeighboursSearch.h"
#include "Area.h"
#include "NeighboursSearch.h"

#include "Forces.h"

Expand Down

0 comments on commit 78f76b4

Please sign in to comment.