-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists_in_progress.txt
111 lines (80 loc) · 2.74 KB
/
CMakeLists_in_progress.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(PROJECT_NAME PhysicsEngine)
option(BUILD_DEMO "Build the demo program" ON)
# Uncomment if no console should be created
option(WINDOWS_NO_CONSOLE "Don't create a console when running the executable (only for demo)" OFF)
# Add your sources here (adding headers is optional, but helps some CMake generators)
set(ENGINE_SOURCE
"Collisions.cpp"
"Constraints.cpp"
"Shape.cpp"
"RigidBody.cpp"
"PhysicsEngineMath.cpp"
"PhysicsEngine.cpp"
)
set(FRAMEWORK_SOURCE
"BaseGame.cpp"
"SDL2Extras.cpp"
"Colour.cpp"
"Input.cpp"
)
set(DEMO_SOURCE
"Demo.cpp"
"Game.cpp"
"Constants.cpp"
)
project(${PROJECT_NAME})
list(TRANSFORM ENGINE_SOURCE PREPEND src/PhysicsEngine/)
list(TRANSFORM FRAMEWORK_SOURCE PREPEND src/Framework/)
list(TRANSFORM DEMO_SOURCE PREPEND src/Demo/)
set(PROJECT_DISTRIBS LICENSE README.md)
set(LIBRARY_SOURCE ${ENGINE_SOURCE})
set(DEMO_SOURCES ${FRAMEWORK_SOURCE};${DEMO_SOURCE})
add_library(${PROJECT_NAME} STATIC ${LIBRARY_SOURCE})
include_directories(${PROJECT_SOURCE_DIR}/include/External)
include_directories(${PROJECT_SOURCE_DIR}/include/PhysicsEngine)
if (BUILD_DEMO)
include_directories(${PROJECT_SOURCE_DIR}/include/Demo)
include_directories(${PROJECT_SOURCE_DIR}/include/Framework)
if (WINDOWS_NO_CONSOLE)
set(CONSOLE_FLAG WIN32)
endif()
add_executable(${PROJECT_NAME}Demo ${CONSOLE_FLAG} MACOSX_BUNDLE ${DEMO_SOURCES})
include(get_sdl2.cmake)
endif()
#target_include_directories(PHYSICS_ENGINE PUBLIC src)
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
if (BUILD_DEMO)
# Link
target_link_libraries(${PROJECT_NAME}Demo SDL2::SDL2main SDL2::SDL2 SDL2::image)
# Setup release packages
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin
BUNDLE DESTINATION bin
)
install(FILES ${PROJECT_DISTRIBS} DESTINATION .)
if (NOT EMSCRIPTEN)
# Install dependencies
set(DEP_SEARCH_DIRS)
# We built these, so we're installing them
if(TARGET SDL2)
list(APPEND DEP_SEARCH_DIRS $<TARGET_FILE_DIR:SDL2>)
endif()
if(TARGET SDL2_image)
list(APPEND DEP_SEARCH_DIRS $<TARGET_FILE_DIR:SDL2_image> $<TARGET_FILE_DIR:png> $<TARGET_FILE_DIR:zlib>)
endif()
set(EXE_SUFFIX)
if(APPLE)
set(EXE_SUFFIX ".app")
endif()
install(CODE "
include(BundleUtilities)
fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:${PROJECT_NAME}>${EXE_SUFFIX}\" \"\" \"${DEP_SEARCH_DIRS}\")
")
endif()
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_GENERATOR "ZIP" "TGZ")
include(CPack)
endif()