1
1
# This is only for compiling for native usage and test, not to be used to port WebAssembly
2
- cmake_minimum_required (VERSION 2.8 )
3
- project (webassembly_opengl )
4
-
5
- # Not sure if this is correct, but fixes c++ x64 arch issues with std
6
- set (CMAKE_CXX_STANDARD 11 )
7
- # includes cmake/FindSDL2.cmake
8
- set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR} /cmake )
9
-
10
- find_package (OpenGL REQUIRED )
11
- # @TODO switch SDL to GLFW
12
- find_package (SDL2 REQUIRED )
13
- find_package (GLEW REQUIRED )
14
- include_directories (${SDL2_INCLUDE_DIR} )
15
- include_directories (${OPENGL_INCLUDE_DIR} )
16
- include_directories (${GLEW_INCLUDE_DIR} )
17
- include_directories (deps/include )
18
-
19
- file (GLOB SOURCE_FILES src/*.cpp )
20
-
21
- add_executable (webassembly_opengl ${SOURCE_FILES} )
22
- target_link_libraries (webassembly_opengl ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLM_LIBRARIES} )
23
- target_compile_features (webassembly_opengl PRIVATE cxx_range_for )
2
+ cmake_minimum_required (VERSION 3.0 )
3
+ project (opie )
4
+
5
+ # GLFW Vendor
6
+ option (GLFW_BUILD_DOCS OFF )
7
+ option (GLFW_BUILD_EXAMPLES OFF )
8
+ option (GLFW_BUILD_TESTS OFF )
9
+ add_subdirectory (src/vendor/glfw )
10
+
11
+ # ASSIMP Vendor
12
+ option (ASSIMP_BUILD_ASSIMP_TOOLS OFF )
13
+ option (ASSIMP_BUILD_SAMPLES OFF )
14
+ option (ASSIMP_BUILD_TESTS OFF )
15
+ add_subdirectory (src/vendor/assimp )
16
+
17
+ # Bullet
18
+ option (BUILD_BULLET2_DEMOS OFF )
19
+ option (BUILD_CPU_DEMOS OFF )
20
+ option (BUILD_EXTRAS OFF )
21
+ option (BUILD_OPENGL3_DEMOS OFF )
22
+ option (BUILD_UNIT_TESTS OFF )
23
+ add_subdirectory (src/vendor/bullet3 )
24
+
25
+ # Platform check
26
+ if (MSVC )
27
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4" )
28
+ else ()
29
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -std=c++11" )
30
+ if (NOT WIN32 )
31
+ set (GLAD_LIBRARIES dl )
32
+ endif ()
33
+ endif ()
34
+
35
+ ## Include other vendors
36
+ include_directories (src/headers/
37
+ src/vendor/assimp/include/
38
+ src/vendor/bullet/src/
39
+ src/vendor/glad/include/
40
+ src/vendor/glfw/include/
41
+ src/vendor/glm/
42
+ src/vendor/stb/ )
43
+
44
+ # Glob together files
45
+ file (GLOB VENDORS_SOURCES src/vendor/glad/src/glad.c )
46
+ file (GLOB PROJECT_HEADERS src/headers/*.h )
47
+ file (GLOB PROJECT_SOURCES src/*.cpp )
48
+ file (GLOB PROJECT_SHADERS src/shaders/*.comp
49
+ src/shaders/*.frag
50
+ src/shaders/*.geom
51
+ src/shaders/*.vert )
52
+ file (GLOB PROJECT_CONFIGS CMakeLists.txt
53
+ Readme.md
54
+ .gitattributes
55
+ .gitignore
56
+ .gitmodules )
57
+
58
+ # Include sources
59
+ source_group ("Headers" FILES ${PROJECT_HEADERS} )
60
+ source_group ("Shaders" FILES ${PROJECT_SHADERS} )
61
+ source_group ("Sources" FILES ${PROJECT_SOURCES} )
62
+ source_group ("Vendors" FILES ${VENDORS_SOURCES} )
63
+
64
+ add_definitions (-DGLFW_INCLUDE_NONE
65
+ -DPROJECT_SOURCE_DIR=\" ${PROJECT_SOURCE_DIR} \" )
66
+ add_executable (${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS}
67
+ ${PROJECT_SHADERS} ${PROJECT_CONFIGS}
68
+ ${VENDORS_SOURCES} )
69
+ target_link_libraries (${PROJECT_NAME} assimp glfw
70
+ ${GLFW_LIBRARIES} ${GLAD_LIBRARIES}
71
+ BulletDynamics BulletCollision LinearMath )
72
+ set_target_properties (${PROJECT_NAME} PROPERTIES
73
+ RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} /${PROJECT_NAME} )
74
+
75
+ #
76
+ ## Not sure if this is correct, but fixes c++ x64 arch issues with std
77
+ #set (CMAKE_CXX_STANDARD 11)
78
+ ## includes cmake/FindSDL2.cmake
79
+ #set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
80
+ #
81
+ #find_package (OpenGL REQUIRED)
82
+ ## @TODO switch SDL to GLFW
83
+ #find_package(SDL2 REQUIRED)
84
+ #find_package(GLEW REQUIRED)
85
+ #include_directories(${SDL2_INCLUDE_DIR})
86
+ #include_directories(${OPENGL_INCLUDE_DIR})
87
+ #include_directories(${GLEW_INCLUDE_DIR})
88
+ #include_directories(deps/include)
89
+ #
90
+ #file(GLOB SOURCE_FILES src/*.cpp)
91
+ #
92
+ #add_executable(webassembly_opengl ${SOURCE_FILES} src/main.cpp)
93
+ #target_link_libraries(webassembly_opengl ${SDL2_LIBRARY} ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} ${GLM_LIBRARIES})
94
+ #target_compile_features(webassembly_opengl PRIVATE cxx_range_for)
0 commit comments