-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.bat
More file actions
134 lines (112 loc) · 9.39 KB
/
build.bat
File metadata and controls
134 lines (112 loc) · 9.39 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@echo off
set PLATFORM=%1
if "%PLATFORM%"=="" set PLATFORM=windows
if "%PLATFORM%"=="clean" (
echo Cleaning...
del /s /q *.o xdjunx xdjunx.exe >nul 2>&1
exit /b 0
)
if "%ZIG%"=="" set ZIG=t:\zig\zig.exe
set CC=%ZIG% cc
set CXX=%ZIG% c++
echo [Building Asset Bundle...]
%CC% tools/bin2c.c -o tools/bin2c.exe
if exist src\ui\components\assets_bundle.h del src\ui\components\assets_bundle.h
echo #ifndef ASSETS_BUNDLE_H > src\ui\components\assets_bundle.h
echo #define ASSETS_BUNDLE_H >> src\ui\components\assets_bundle.h
".\tools\bin2c.exe" "assets\fonts\otfs\Font Awesome 5 Free-Solid-900.otf" src\ui\components\assets_bundle.h font_awesome_solid append
".\tools\bin2c.exe" "assets\fonts\otfs\Font Awesome 5 Free-Regular-400.otf" src\ui\components\assets_bundle.h font_awesome_regular append
".\tools\bin2c.exe" "assets\fonts\otfs\Font Awesome 5 Brands-Regular-400.otf" src\ui\components\assets_bundle.h font_awesome_brand append
".\tools\bin2c.exe" "assets\splash.png" src\ui\components\assets_bundle.h unx_logo append
".\tools\bin2c.exe" "assets\icons\crown.png" src\ui\components\assets_bundle.h icon_crown append
".\tools\bin2c.exe" "assets\icons\star.png" src\ui\components\assets_bundle.h icon_star append
%CC% tools/gen_splash_bundle.c -o tools/gen_splash_bundle.exe
echo [Generating Splash Bundle...]
.\tools\gen_splash_bundle.exe assets\splash src\ui\components\splash_bundle_tmp.h
type src\ui\components\splash_bundle_tmp.h >> src\ui\components\assets_bundle.h
del src\ui\components\splash_bundle_tmp.h
echo #endif >> src\ui\components\assets_bundle.h
set BACKEND=%2
if "%BACKEND%"=="" set BACKEND=drm
if "%PLATFORM%"=="linux" (
echo [Target: Linux ARM64 %BACKEND%]
:: Use -Wl,-z,origin to enable $ORIGIN and -Wl,-rpath,$ORIGIN/lib to set the search path
if "%BACKEND%"=="desktop" (
set TARGET_FLAGS=-target aarch64-linux-gnu.2.36 -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_ES2 -DKS_STR_ENCODING_NONE -Ilib/linux_arm64/include
set LDFLAGS=-Llib/linux_arm64 -Wl,-z,origin -Wl,-rpath,$ORIGIN/lib -lraylib_desktop -lGLESv2 -lEGL -lpthread -ldl -lm -lX11 -lXcursor -lXinerama -lXi -lXrandr -lxcb -lXau -lXdmcp -lxkbcommon
set OUT_DIR=build\linux_desktop
set TARGET=xdjunx_desktop
) else (
set TARGET_FLAGS=-target aarch64-linux-gnu.2.36 -DPLATFORM_DRM -DGRAPHICS_API_OPENGL_ES2 -DKS_STR_ENCODING_NONE -Ilib/linux_arm64/include
set LDFLAGS=-Llib/linux_arm64 -Wl,-z,origin -Wl,-rpath,$ORIGIN/lib -lraylib -lGLESv2 -lEGL -ldrm -lgbm -lpthread -ldl -lm
set OUT_DIR=build\linux_drm
set TARGET=xdjunx
)
) else (
echo [Target: Windows x64]
set TARGET_FLAGS=-target x86_64-windows -D_WIN32 -DKS_STR_ENCODING_WIN32API
set LDFLAGS=-Llib -lraylib -lgdi32 -lwinmm -lopengl32 -lpsapi -lsetupapi -lhid
set OUT_DIR=build\windows
set TARGET=xdjunx.exe
)
if not exist %OUT_DIR% mkdir %OUT_DIR%
set CFLAGS=-Wall -Wextra -Isrc -Isrc/core -Isrc/engine -Ilib -Ilib/soundtouch -O2 %TARGET_FLAGS%
set CXXFLAGS=-Wall -Wextra -Isrc -Isrc/core -Isrc/engine -Ilib -Ilib/soundtouch -Ilib/kaitai -Ilib/rekordbox-metadata -O2 -std=c++17 %TARGET_FLAGS%
echo Building C files...
for %%f in (src/main.c src/ui/components/theme.c src/ui/components/fonts.c src/ui/components/helpers.c src/ui/views/topbar.c src/ui/views/info.c src/ui/views/splash.c src/ui/views/settings.c src/ui/views/about.c src/ui/views/credits.c src/ui/views/mixer.c src/ui/views/pad.c src/ui/views/debug_ios.c src/ui/player/bottomstrip.c src/ui/player/beatfx.c src/ui/player/deckinfo.c src/ui/player/deckstrip.c src/ui/player/waveform.c src/ui/player/player.c src/input/keyboard.c src/ui/browser/browser.c src/core/logger.c src/core/memory_guard.c src/core/system_info.c src/core/audio_backend.c src/core/logic/quantize.c src/core/logic/sync.c src/core/logic/settings_io.c src/core/logic/control_object.c src/core/midi/midi_handler.c src/core/midi/midi_mapper.c src/core/midi/midi_translation.c src/core/midi/midi_scripts.c src/core/midi/midi_backend_win.c src/core/hid/hid_handler.c src/core/hid/hid_mapper.c src/core/hid/hid_backend_win.c) do (
%CC% %CFLAGS% -c %%f -o %%~pf%%~nf.o || exit /b 1
)
for %%f in (src/engine/fx/dsp_utils.c src/engine/fx/colorfx/space.c src/engine/fx/colorfx/dub_echo.c src/engine/fx/colorfx/sweep.c src/engine/fx/colorfx/noise.c src/engine/fx/colorfx/crush.c src/engine/fx/colorfx/filter.c src/engine/fx/colorfx/jet.c src/engine/fx/colorfx/colorfx_manager.c) do (
%CC% %CFLAGS% -c %%f -o %%~pf%%~nf.o || exit /b 1
)
for %%f in (src/engine/fx/beatfx/delay.c src/engine/fx/beatfx/echo.c src/engine/fx/beatfx/pingpong.c src/engine/fx/beatfx/spiral.c src/engine/fx/beatfx/roll.c src/engine/fx/beatfx/sliproll.c src/engine/fx/beatfx/reverb.c src/engine/fx/beatfx/helix.c src/engine/fx/beatfx/flanger.c src/engine/fx/beatfx/phaser.c src/engine/fx/beatfx/bfilter.c src/engine/fx/beatfx/trans.c src/engine/fx/beatfx/pitch.c src/engine/fx/beatfx/vinylbrake.c src/engine/fx/beatfx/beatfx_manager.c) do (
%CC% %CFLAGS% -c %%f -o %%~pf%%~nf.o || exit /b 1
)
echo Building C++ files...
%CXX% %CXXFLAGS% -c lib/kaitai/kaitai/kaitaistream.cpp -o lib/kaitai/kaitai/kaitaistream.o || exit /b 1
%CXX% %CXXFLAGS% -c lib/rekordbox-metadata/rekordbox_anlz.cpp -o lib/rekordbox-metadata/rekordbox_anlz.o || exit /b 1
%CXX% %CXXFLAGS% -c lib/rekordbox-metadata/rekordbox_pdb.cpp -o lib/rekordbox-metadata/rekordbox_pdb.o || exit /b 1
%CXX% %CXXFLAGS% -c lib/serato/serato_parser.cpp -o lib/serato/serato_parser.o || exit /b 1
%CXX% %CXXFLAGS% -c lib/serato/serato_waveform.cpp -o lib/serato/serato_waveform.o || exit /b 1
%CXX% %CXXFLAGS% -c lib/serato/serato_tags.cpp -o lib/serato/serato_tags.o || exit /b 1
for %%f in (src/library/rekordbox_reader.cpp src/library/serato_reader.cpp src/engine/util/engine_math.cpp src/audio/engine.cpp) do (
%CXX% %CXXFLAGS% -c %%f -o %%~pf%%~nf.o || exit /b 1
)
echo Building SoundTouch...
for %%f in (AAFilter BPMDetect FIFOSampleBuffer FIRFilter InterpolateCubic InterpolateLinear InterpolateShannon PeakFinder RateTransposer SoundTouch TDStretch cpu_detect_x86 mmx_optimized sse_optimized) do (
%CXX% %CXXFLAGS% -c lib/soundtouch/%%f.cpp -o lib/soundtouch/%%f.o || exit /b 1
)
if "%2"=="check" (
echo [Check Only] Compilation successful.
goto end
)
echo Linking...
set "SOUNDTOUCH_OBJS="
for %%f in (lib/soundtouch/*.cpp) do (
call set "SOUNDTOUCH_OBJS=%%SOUNDTOUCH_OBJS%% lib/soundtouch/%%~nf.o"
)
%CXX% %CXXFLAGS% src/main.o src/ui/components/theme.o src/ui/components/fonts.o src/ui/components/helpers.o src/ui/views/topbar.o src/ui/views/info.o src/ui/views/splash.o src/ui/views/settings.o src/ui/views/about.o src/ui/views/credits.o src/ui/views/mixer.o src/ui/views/pad.o src/ui/views/debug_ios.o src/ui/player/bottomstrip.o src/ui/player/beatfx.o src/ui/player/deckinfo.o src/ui/player/deckstrip.o src/ui/player/waveform.o src/ui/player/player.o src/audio/engine.o src/engine/util/engine_math.o src/engine/fx/dsp_utils.o src/engine/fx/colorfx/space.o src/engine/fx/colorfx/dub_echo.o src/engine/fx/colorfx/sweep.o src/engine/fx/colorfx/noise.o src/engine/fx/colorfx/crush.o src/engine/fx/colorfx/filter.o src/engine/fx/colorfx/jet.o src/engine/fx/colorfx/colorfx_manager.o src/engine/fx/beatfx/delay.o src/engine/fx/beatfx/echo.o src/engine/fx/beatfx/pingpong.o src/engine/fx/beatfx/spiral.o src/engine/fx/beatfx/roll.o src/engine/fx/beatfx/sliproll.o src/engine/fx/beatfx/reverb.o src/engine/fx/beatfx/helix.o src/engine/fx/beatfx/flanger.o src/engine/fx/beatfx/phaser.o src/engine/fx/beatfx/bfilter.o src/engine/fx/beatfx/trans.o src/engine/fx/beatfx/pitch.o src/engine/fx/beatfx/vinylbrake.o src/engine/fx/beatfx/beatfx_manager.o src/input/keyboard.o src/ui/browser/browser.o src/core/logger.o src/core/memory_guard.o src/core/system_info.o src/core/audio_backend.o src/core/logic/quantize.o src/core/logic/sync.o src/core/logic/settings_io.o src/core/logic/control_object.o src/core/midi/midi_handler.o src/core/midi/midi_mapper.o src/core/midi/midi_translation.o src/core/midi/midi_scripts.o src/core/midi/midi_backend_win.o src/core/hid/hid_handler.o src/core/hid/hid_mapper.o src/core/hid/hid_backend_win.o lib/kaitai/kaitai/kaitaistream.o lib/rekordbox-metadata/rekordbox_anlz.o lib/rekordbox-metadata/rekordbox_pdb.o lib/serato/serato_parser.o lib/serato/serato_waveform.o lib/serato/serato_tags.o src/library/rekordbox_reader.o src/library/serato_reader.o %SOUNDTOUCH_OBJS% %LDFLAGS% -o %OUT_DIR%\%TARGET% || exit /b 1
if "%PLATFORM%"=="windows" (
echo [Copying Dependencies...]
if exist lib\raylib.dll copy /y lib\raylib.dll %OUT_DIR% > nul
) else (
echo [Copying Linux Dependencies...]
if not exist %OUT_DIR%\lib mkdir %OUT_DIR%\lib
copy /y lib\linux_arm64\*.so* %OUT_DIR%\lib > nul
:: Explicitly copy sonames for stability
if exist lib\linux_arm64\libGLESv2.so copy /y lib\linux_arm64\libGLESv2.so %OUT_DIR%\lib\libGLESv2.so.2 > nul
if exist lib\linux_arm64\libEGL.so copy /y lib\linux_arm64\libEGL.so %OUT_DIR%\lib\libEGL.so.1 > nul
if exist lib\linux_arm64\libasound.so copy /y lib\linux_arm64\libasound.so %OUT_DIR%\lib\libasound.so.2 > nul
if exist lib\linux_arm64\libdrm.so copy /y lib\linux_arm64\libdrm.so %OUT_DIR%\lib\libdrm.so.2 > nul
if exist lib\linux_arm64\libgbm.so copy /y lib\linux_arm64\libgbm.so %OUT_DIR%\lib\libgbm.so.1 > nul
)
:end
if exist controllers (
xcopy controllers %OUT_DIR%\controllers /s /e /y /i
)
if "%BACKEND%"=="desktop" (
if exist assets (
xcopy assets %OUT_DIR%\assets /s /e /y /i
)
)
echo Done.