forked from tyduptyler13/MyEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (65 loc) · 2.17 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
cmake_minimum_required(VERSION 3.9)
project(MyEngine)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#SET(CMAKE_VERBOSE_MAKEFILE ON)
include(node_modules/node-cmake/NodeJS.cmake)
nodejs_init()
add_subdirectory(deps/spdlog)
add_subdirectory(deps/bgfx.cmake)
set(MYENGINE_INCLUDE_DIR include)
set(BGFX_INCLUDES
deps/bgfx.cmake/bx/include
deps/bgfx.cmake/bgfx/include)
add_library(MyEngine
src/DefaultRenderer.cpp
src/Material.cpp
src/Math.cpp
src/SoundObject.cpp
src/Texture.cpp
src/Log.cpp)
target_include_directories(MyEngine PUBLIC ${MYENGINE_INCLUDE_DIR} ${BGFX_INCLUDES})
add_dependencies(MyEngine spdlog bgfx)
target_link_libraries(MyEngine spdlog)
file(GLOB NBIND_SOURCE_FILES node_modules/nbind/src/*.cc node_modules/nbind/src/v8/*.cc)
add_nodejs_module(MyEngine_node
${NBIND_SOURCE_FILES}
src/nbind/Geometries/BoxGeometry.cpp
src/nbind/Geometries/SphereGeometry.cpp
src/nbind/BufferGeometry.cpp
src/nbind/Camera.cpp
src/nbind/Geometry.cpp
src/nbind/Material.cpp
src/nbind/Mesh.cpp
src/nbind/Object3D.cpp
src/nbind/PerspectiveCamera.cpp
src/nbind/Renderer.cpp
src/nbind/Scene.cpp
src/nbind/SoundObject.cpp
src/nbind/Vector2.cpp
src/nbind/Vector3.cpp
src/nbind/Vector4.cpp)
target_include_directories(MyEngine_node BEFORE PUBLIC node_modules/nbind/include)
set_property(TARGET MyEngine_node PROPERTY CXX_STANDARD 14)
if (CMAKE_CXX_COMPILER MATCHES "/em\\+\\+(-[a-zA-Z0-9.])?$")
message(" * C++ compiler: Emscripten")
else ()
target_compile_definitions(MyEngine_node PRIVATE BUILDING_NODE_EXTENSION)
endif ()
target_link_libraries(MyEngine_node
MyEngine
${CMAKE_JS_LIB})
add_executable(BasicExample
test/core/BasicExample.cpp)
target_link_libraries(BasicExample
MyEngine)
add_executable(unitTests
test/unit/Box2.cc
test/unit/constants.cc
test/unit/constants.hpp
test/unit/Log.cc
test/unit/Matrix4.cc
test/unit/Vector2.cc
test/unit/Vector3.cc)
target_link_libraries(unitTests
MyEngine)