forked from sofa-framework/MyAwesomeComponents
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (43 loc) · 1.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.1)
project(MyAwesomeComponents VERSION 1.0)
# SOFA packages containing our dependencies
find_package(SofaFramework REQUIRED) # Needed to use SofaCore, SofaHelper and SofaDefaultType
find_package(SofaGeneral REQUIRED) # Needed to use SofaBaseTopology
# Config files (tell SOFA this is a plugin)
set(CONFIG_FILES
src/MyAwesomeComponents/config.h
src/MyAwesomeComponents/initMyAwesomeComponents.cpp
)
# Our nice new SOFA Components
set(HEADER_FILES
src/MyAwesomeComponents/ExplicitBDFSolver.h
src/MyAwesomeComponents/FanForceField.h
src/MyAwesomeComponents/FanForceField.inl
)
set(SOURCE_FILES
src/MyAwesomeComponents/ExplicitBDFSolver.cpp
src/MyAwesomeComponents/FanForceField.cpp
)
# SOFA plugin are basically libraries
add_library(${PROJECT_NAME} SHARED ${CONFIG_FILES} ${HEADER_FILES} ${SOURCE_FILES})
# Dependencies
target_link_libraries(${PROJECT_NAME} PUBLIC
SofaCore
SofaHelper
SofaDefaultType
SofaBaseTopology
)
# Needed to build on Windows (dllimport/dllexport mechanism)
target_compile_definitions(${PROJECT_NAME} PRIVATE "-DSOFA_BUILD_MYAWESOMECOMPONENTS")
# Set include directories to be able to resolve "#include <MyAwesomeComponents/XXX.h>"
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>")
# Create package Config, Version & Target files.
# Deploy the headers, resources, scenes & examples.
sofa_generate_package(
NAME ${PROJECT_NAME}
TARGETS ${PROJECT_NAME}
VERSION ${PROJECT_VERSION}
INCLUDE_SOURCE_DIR src/MyAwesomeComponents
INCLUDE_INSTALL_DIR MyAwesomeComponents
)