CMakeLists.txt 1.07 KB
Newer Older
Janis Born's avatar
Janis Born committed
1
cmake_minimum_required(VERSION 3.1.0)
2

3
project(openmesh)
4

Isaak Lim's avatar
Isaak Lim committed
5
set(CMAKE_CXX_STANDARD 11)
6
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
7

8
add_subdirectory(OpenMesh)
9
add_subdirectory(pybind11)
10

Alexander Dielen's avatar
Alexander Dielen committed
11 12 13 14 15 16 17
if (NOT WIN32)
	set_target_properties(
		OpenMeshCore OpenMeshTools PROPERTIES
		EXCLUDE_FROM_ALL ON
		EXCLUDE_FROM_DEFAULT_BUILD ON
	)
endif ()
Alexander Dielen's avatar
Alexander Dielen committed
18

Alexander Dielen's avatar
Alexander Dielen committed
19 20 21
acg_append_files(HEADERS "src/*.hh" .)
acg_append_files(SOURCES "src/*.cc" .)

22
include_directories(${OPENMESH_INCLUDE_DIRS})
Alexander Dielen's avatar
Alexander Dielen committed
23
pybind11_add_module(openmesh ${HEADERS} ${SOURCES})
Alexander Dielen's avatar
Alexander Dielen committed
24 25 26 27 28 29 30 31 32 33

if (WIN32)
	target_link_libraries(openmesh PRIVATE OpenMeshCore)
	target_link_libraries(openmesh PRIVATE OpenMeshTools)
	target_compile_definitions(openmesh PRIVATE _USE_MATH_DEFINES)
else ()
	target_link_libraries(openmesh PRIVATE OpenMeshCoreStatic)
	target_link_libraries(openmesh PRIVATE OpenMeshToolsStatic)
endif ()

Alexander Dielen's avatar
Alexander Dielen committed
34 35 36
enable_testing()
add_test(
	NAME discover_tests
37
	COMMAND ${PYTHON_EXECUTABLE} -m unittest discover --failfast
Alexander Dielen's avatar
Alexander Dielen committed
38 39 40 41
	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tests
)
set_tests_properties(
	discover_tests PROPERTIES
42
	ENVIRONMENT "PYTHONPATH=$<TARGET_FILE_DIR:openmesh>"
Isaak Lim's avatar
Isaak Lim committed
43
)