-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare.sh
executable file
·73 lines (58 loc) · 1.67 KB
/
prepare.sh
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
#!/usr/bin/env sh
STOP=
if ! dpkg -l | grep -q '^ii libglfw3-dev'; then
sudo apt-get install -y libglfw3-dev
fi
if [ ! -f "external/lua/onelua.c" ]; then
echo "Lua submodule is missing!"
exit 1
fi
cat >external/lua/CMakeLists.txt << EOF
file(GLOB LUA_SRC onelua.c)
add_library(lua \${LUA_SRC})
target_include_directories(lua PRIVATE ./)
target_compile_options(lua PRIVATE
-O3
-ldl -lreadline
-fno-stack-protector
-fno-common
-march=native
)
EOF
cat >external/imgui/CMakeLists.txt << EOF
file(GLOB IMGUI_RES ./*.cpp
./backends/imgui_impl_glfw.cpp
./backends/imgui_impl_opengl3.cpp)
add_library(imgui \${IMGUI_RES})
include_directories(./)
include_directories(./backends/)
# Find and link GLFW
find_package(glfw3 REQUIRED)
# For OpenGL on Linux
find_package(OpenGL REQUIRED)
target_link_libraries(imgui PRIVATE OpenGL::GL glfw)
# For OpenGL on macOS
if(APPLE)
target_link_libraries(imgui PRIVATE "-framework OpenGL")
find_library(COCOA_LIBRARY Cocoa)
find_library(IOKIT_LIBRARY IOKit)
find_library(COREVIDEO_LIBRARY CoreVideo)
target_link_libraries(imgui PRIVATE )
endif()
# Optional: Copy shader files to build directory
# configure_file(shader.vert shader.vert COPYONLY)
# configure_file(shader.frag shader.frag COPYONLY)
EOF
cat >external/tinyfiledialogs/CMakeLists.txt <<EOF
file(GLOB TFD_RES
tinyfiledialogs.c
more_dialogs/tinyfd_moredialogs.c
)
add_library(tfd \${TFD_RES})
include_directories(./)
include_directories(./more_dialogs)
EOF
echo "CMakeLists.txt files have been generated. Now comment out the main function in the lua.c"
echo "Press any key to open the text editor $STOP"
read STOP
${VISUAL-${EDITOR-nano}} external/lua/lua.c