From 06428fec464c8d219f7860a189f16190d02574cd Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Wed, 30 Sep 2020 13:48:31 -0500 Subject: [PATCH] Initial work on c++ builds --- .efrocachemap | 16 +- ballisticacore-cmake/.idea/.gitignore | 3 + ballisticacore-cmake/.idea/.name | 1 + .../.idea/ballisticacore-cmake.iml | 2 + .../.idea/codeStyles/Project.xml | 8 + .../.idea/codeStyles/codeStyleConfig.xml | 5 + .../.idea/dictionaries/ericf.xml | 954 ++++++++++++++++++ .../inspectionProfiles/Project_Default.xml | 60 ++ ballisticacore-cmake/.idea/misc.xml | 30 + ballisticacore-cmake/.idea/modules.xml | 8 + ballisticacore-cmake/.idea/vcs.xml | 6 + ballisticacore-cmake/CMakeLists.txt | 199 ++++ ballisticacore-cmake/src | 1 + tools/batools/updateproject.py | 45 +- tools/efrotools/efrocache.py | 15 - 15 files changed, 1317 insertions(+), 36 deletions(-) create mode 100644 ballisticacore-cmake/.idea/.gitignore create mode 100644 ballisticacore-cmake/.idea/.name create mode 100644 ballisticacore-cmake/.idea/ballisticacore-cmake.iml create mode 100644 ballisticacore-cmake/.idea/codeStyles/Project.xml create mode 100644 ballisticacore-cmake/.idea/codeStyles/codeStyleConfig.xml create mode 100644 ballisticacore-cmake/.idea/dictionaries/ericf.xml create mode 100644 ballisticacore-cmake/.idea/inspectionProfiles/Project_Default.xml create mode 100644 ballisticacore-cmake/.idea/misc.xml create mode 100644 ballisticacore-cmake/.idea/modules.xml create mode 100644 ballisticacore-cmake/.idea/vcs.xml create mode 100644 ballisticacore-cmake/CMakeLists.txt create mode 120000 ballisticacore-cmake/src diff --git a/.efrocachemap b/.efrocachemap index d5245ea1..4e10c4c6 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3932,14 +3932,14 @@ "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", - "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3f/99/9b94f7d478142a08e02c769b64ba", - "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0d/f0/aed2b96addcc73e2de400aed2bdf", - "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/88/6d/d27cadc6ba0745b031853f49fec5", - "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/b0/c7/1a695160656a97fa8bc014ccfa4c", - "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0b/b4/0714136fb2fe3a34f2954707e7de", - "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/99/80/50ddcc0240343e16517d9d065d18", - "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/a5/f6/f5491c01ddc1c299869612928093", - "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/fe/42/87a8426e9dd0d3842cd6f4dc9478", + "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ac/96/c3b9934061393fe09cc90ff24b8d", + "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/38/2b/5641b3b40846f74f232771ac0457", + "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/26/6c/76d9bd89859b444798fa5f150603", + "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/92/d3/dd71ceb73332e855a9e78edbae11", + "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/e6/34/66b7c424a1481b7cff545f16f0f4", + "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d6/5e/9f3bb3103d0bd8e8b24f331820d4", + "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/8c/7d/5c3af1223b81b267716d6697f3f6", + "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/58/7a/d60fbf3ec81b4083e75843824d63", "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/30/2c/3bc8f419c38188ad8bd3770814a0", "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/12/63/73b0c2c2cac9f96e210220c9d338", "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/5b/e6/476c447cc5887f414b0a62e8851b", diff --git a/ballisticacore-cmake/.idea/.gitignore b/ballisticacore-cmake/.idea/.gitignore new file mode 100644 index 00000000..0e40fe8f --- /dev/null +++ b/ballisticacore-cmake/.idea/.gitignore @@ -0,0 +1,3 @@ + +# Default ignored files +/workspace.xml \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/.name b/ballisticacore-cmake/.idea/.name new file mode 100644 index 00000000..5aa978d3 --- /dev/null +++ b/ballisticacore-cmake/.idea/.name @@ -0,0 +1 @@ +BallisticaCore \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/ballisticacore-cmake.iml b/ballisticacore-cmake/.idea/ballisticacore-cmake.iml new file mode 100644 index 00000000..f08604bb --- /dev/null +++ b/ballisticacore-cmake/.idea/ballisticacore-cmake.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/codeStyles/Project.xml b/ballisticacore-cmake/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..249efa28 --- /dev/null +++ b/ballisticacore-cmake/.idea/codeStyles/Project.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/codeStyles/codeStyleConfig.xml b/ballisticacore-cmake/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..79ee123c --- /dev/null +++ b/ballisticacore-cmake/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/dictionaries/ericf.xml b/ballisticacore-cmake/.idea/dictionaries/ericf.xml new file mode 100644 index 00000000..2467a179 --- /dev/null +++ b/ballisticacore-cmake/.idea/dictionaries/ericf.xml @@ -0,0 +1,954 @@ + + + + NOMINMAX + aabb + abcdefghijklmnopqrstuvwxyz + absval + accel + accountid + achs + acinstance + ack'ed + acked + acks + aclass + aclass's + activityplayer + addrs + adjoint + adminset + adreno + affx + affy + affz + aftx + afty + aftz + aint + airborn + alext + alibaba + allocs + alot + alphaimg + alphapixels + alsa + alsoft + animcurve + aniso + apientry + appconfig + appname + appnameupper + asci + assigninput + athome + attrobj + audiocache + automagically + autoselect + avel + avels + axismotion + backgrounded + backgrounding + backtraces + ballistica + ballisticacore + barebones + basetype + basicsize + bastd + bbbb + bbbbb + bbbbbb + bbbbbbb + bcfn + bezanson + bgra + bigendian + bilinear + binpow + bitcount + bitdepth + bitlength + bitmask + bitpos + bitval + blitters + blitting + blockadr + blockheight + blockwidth + bluetooth + blurscale + bname + bodyid + bodypart + bodyptr + bookmarkable + bools + boolval + boostrapping + bootconfig + bootstrappy + bouyancy + bppv + bresult + bridgit + broadcom + bsac + bscfg + bsgaps + bsgdps + bsivu + bsmhi + bsstd + bsuuid + bufs + buildconfig + buildnumber + buttondown + buttonmouse + buttonup + buttonwidget + bwst + calced + calcing + calcs + caled + callargs + callbackobj + camalign + camelback + camerashake + capitan + cargs + ccdd + ccontext + ccylinder + centiseconds + cfgdir + changeme + charn + charnum + charstr + chatmessage + checkboxwidget + chrono + cjief + classdict + clientid + clientinfo + cmath + cmds + cmdvals + codewarrior + codewarrior's + cofnodes + collapseable + collidable + collider + columnwidget + connectattr + containerwidget + controlfp + cooldown + coopscore + coreaudio + coulda + cout + cpel + cpplint + cptr + cpuid + crashenv + crashlytics + crom + crosswire + crvel + csize + cspr + cstdint + cstdlib + cstring + ctargetref + cubemap + curtime + cutef + cvar + data + datadata + dataout + datas + datav + datavec + dbias + dcol + ddcaps + ddpf + ddpixelformat + ddscaps + ddsd + ddsx + deadcode + deallocated + deallocation + deek + deinit + deltaval + demangle + demangled + demangling + denom + dernit + dets + dfba + dfff + dfmt + diffbit + dirslash + dlfcn + dlife + dllpath + dname + dncm + dobell + doneptr + doraise + dosomething + dout + downsample + dpad + dpads + drpt + dsize + dsound + dstattr + dstnode + dstpath + dstr + dtest + dummyvalid + dxgi + dynamicdata + echidna + edef + efro + elems + elevenbase + elevenbits + emitfx + emojis + enablexinput + endcall + endl + endline + endtime + entrypoint + envval + ericf + ericsson + erroring + etcdec + etcpack + evals + ewww + ewwww + ewwwww + exctype + execinfo + exhash + exhashstr + expbool + expl + extrahash + extrascale + exts + facepts + farval + fastdot + fastldlt + fastlsolve + fastltsolve + fbos + fdata + fdirx + fdiry + fdirz + fenv + fesetround + ffff + ffffff + fffffff + fffffffffifff + fgets + fifteenbits + finishedptr + fjco + fjcoiwef + flipbit + flopsy + fname + fnode + fnumc + focuswindow + fopen + fourcc + fovs + fovx + fovy + framebuffers + framedef + frameldefs + framerates + fread + freeform + freeifaddrs + freqs + froemling + frompos + frontmost + ftos + ftou + fullpath + funcname + fval + fvals + gamecenter + gamedata + gamepacket + gamepackets + gameplay + gameplayer + gapless + gasmsg + gbus + gcc's + gearvr + getactivity + getattro + getattrofunc + getbasetime + getbit + getbits + getbitshigh + getcollidemodel + getdata + getifaddrs + getinputdevice + getline + getlog + getmodel + getname + getnodes + getnodetype + getpackagecollidemodel + getpackagedata + getpackagemodel + getpackagesound + getpackagetexture + getpublicpartyenabled + getpublicpartymaxsize + getqrcodetexture + getsession + getsound + gettexture + gettotalrefcount + gles + glext + gpgs + gqualstr + grav + grisha + gstate + gthm + guiddef + gusl + gvrrts + hacky + haha + halign + handlemessage + hatmotion + haveint + havn't + havnt + healthcare + hexval + highp + highquality + hitchy + hmmm + homebrew + hostactivity + hostcmd + hostinfo + hotkeys + hotplug + hscrollwidget + htonf + htonl + htons + ibuf + icloud + iconscale + ieeefp + ifaddr + ifaddrs + ifdebug + iiarcade + iiiiisss + illum + ilock + imagewidget + incentivized + inet + inides + initguid + inittab + inputdevice + insta + intercollide + internalformat + interuptions + invote + iserverget + iserverput + isinst + isn' + isosplayingmusic + isutf + itemsize + itri + itsclass + itunes + ival + ivals + ized + jackmorgan + jacobian + janktastic + janky + jaxis + jcjwf + jmessage + keepalives + keycode + keysyms + keywds + khronos + kickable + kickee + killable + killcount + kmod + kronk + kwds + kxyz + lantinga + largeish + lasti + lastline + lastvalid + leaderboard + leaderboards + lgui + lhalf + libutf + lightshad + linearsize + listobj + llock + logmsg + logpath + logprefix + logput + logsuffix + lorient + lowp + lpos + lpsockaddr + lrintf + lscope + lstr + lsync + lvec + lvoid + macmusicappgetlibrarysource + macmusicappgetplaylists + macmusicappgetvolume + macmusicappinit + macmusicappplayplaylist + macmusicappsetvolume + macmusicappstop + macos + magoogan + magua + mainmenu + mallocs + maskhigh + maskuv + maximus + maxwidth + mediump + memalign + memchr + memcpy + meshdata + messagebox + meth + mhbegin + mhend + mikirog + millisecs + minelem + minsdl + mipmapcount + mipmaps + mmask + mmdevapi + modder + modelview + moduletype + momemtary + mqrspec + msaa + mult + multing + multipass + multisample + multitouch + multiway + musicplayerplay + musicplayersetvolume + musicplayershutdown + musicplayerstop + mutli + mybuf + mycallback + mynode + mystatspage + mywidget + ndebug + nearval + needwindow + negativex + negativey + negativez + nemanja + ness + netclient + netplay + newactivity + newchild + newimg + newitem + newname + newnode + nextchar + nitpicky + nlpos + nmemb + nodetype + nofilename + noglobs + nointhash + nominmax + noninfringement + nonlint + noone + nothin + nptr + nsize + ntoa + ntohl + numargs + numc + numentries + numlock + nvidia + nyffenegger + objexists + objid + obstack + obvs + oculus + oiffsss + oldname + oooo + ooooooo + ooooooooo + oooooooooo + oooooooooooo + ooooooooooooo + ooooooooooooooo + oooooooooooooooo + ooooooooooooooooo + oooooooooooooooooo + ooooooooooooooooooooooooooooooo + ooooooooooooooooooooooooooooooooooo + ooooooooooooooooooooooooooooooooooooo + opcode + openal + opengl + opensl + oper + opmode + opposingbody + opposingnode + optin + ortho + osis + osssssssssss + ostype + ourself + ourstanding + outval + ouya + parameteriv + passcode + pausable + pdst + persp + pflag + pflags + pgmout + pixelformat + playpause + playsound + plen + pname + podcast + podcasts + portaudio + positivex + positivey + positivez + postinit + powerup + precalc + predeclare + prefs + preloaded + preloads + premult + printf + printnodes + printobjects + priv + profilers + prog + proj + prolly + psmx + pspec + psps + psrc + pton + ptrs + ptype + pulseaudio + punchmomentumlinear + punchthrough + pushcall + putbits + putbitshigh + pval + pvrtc + pycommand + pyconfig + pycontext + pyexctype + pyhome + pylib + pyobj + pyobjs + pytype + qerr + qrcode + qrel + qrencode + qrinput + qrspec + quadtreespace + qual + qualcomm + radiusm + raii + raspbian + rasterizer + reaaaly + readset + realloc + reallocations + realtimers + recalc + recvfrom + redundants + refcounted + refl + rehel + reloadmedia + rendererdata + renormalize + rené + reprfunc + rerase + resends + resetinput + resync + retval + rezing + rgui + richcompare + rigth + rootwidget + rowwidget + rresize + rresult + rscode + rsgc + runnables + rvec + rvel + safecolor + samsung + sapspace + scancode + scenetime + screenmessage + scrollwidget + sdl's + sdlk + seqlen + serv + serverget + serverput + sessiondata + sessionglobals + sessionplayer + sessionteam + sessiontype + setactivity + setattro + setattrofunc + setdata + setname + setnode + setpublicpartyenabled + setpublicpartymaxsize + setpublicpartyname + setpublicpartystatsurl + setschedparam + setsockopt + sgis + sharedobj + shhh + shifthigh + shouldnt + shufflable + signsubscale + simd + sisssssssss + sixteenbits + smoothering + smoothstep + sndio + snorm + sockaddr + soffs + solaris + sourcenode + spaz + spead + sphrand + spivak + srcattr + srcpath + srcsz + sresult + sscanf + ssize + sssi + sssisisis + sssissss + ssss + sssss + sssssi + sssssss + sssssssd + sssssssi + ssssssssssss + standin + startedptr + startpos + starttime + startx + starty + staticdata + stdint + stepfast + stephane + stepnum + stepsize + strcasecmp + strchr + strcpy + strdup + stringi + strlen + strtof + subclsssing + subentities + subitems + subplatform + subscale + subscr + sval + symbolification + syscalls + talloc + tegra + telefonaktiebolaget + teleported + teleporting + tempvec + testint + testnode + texel + texqualstr + textcolor + textwidget + thang + thecommand + theres + threadname + threadtype + tiltage + timedisplay + timeformat + timerlist + timestep + timetype + timetypes + tmpmat + tomer + topos + touchpad + toucs + toutf + tracebacks + tracestr + trackpad + trackpads + tradeoff + trailcolor + transobj + treturn + trifunovic + trilinear + trimesh + trimeshes + tval + tvos + tweakage + twotimer + twst + typeobj + typestr + uber + uibounds + uiid + unblessed + uncas + unchecking + underrun + unformatted + unichar + unichars + uninited + unmanaged + unpaused + unplayed + unpremultiply + unsignaled + unstuff + unsynchronized + userspace + uther + uuids + uxxxx + uxxxxxxxx + valign + valobj + vals + valtab + valuedouble + valueint + valuestring + varyings + vbos + vbuf + vcache + vdynamic + vertout + verts + vidia + vmag + vorbis + vorbisfile + vparallel + vprintf + vsync + vsyncing + vtable + vtangential + vulkan + waaah + wack + wakeups + walisser + wasdebug + watte + wdeprecated + weakref + weakthis + welp + whaaaaaaa + wheee + wheeee + wiimote + wiimotes + windowshade + winmm + winsock + wofocj + wonkiness + worldspace + wunused + xclamped + xdiff + xdist + xinput + xmax + xmin + xmmintrin + xoffset + yclamped + ydiff + ydist + ymax + ymin + yoffs + yooooooo + zmax + zmin + zoffset + zomg + zoomable + zrot + + + \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/inspectionProfiles/Project_Default.xml b/ballisticacore-cmake/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..4db46f7f --- /dev/null +++ b/ballisticacore-cmake/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,60 @@ + + + + \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/misc.xml b/ballisticacore-cmake/.idea/misc.xml new file mode 100644 index 00000000..acadce39 --- /dev/null +++ b/ballisticacore-cmake/.idea/misc.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/modules.xml b/ballisticacore-cmake/.idea/modules.xml new file mode 100644 index 00000000..5fb34ea8 --- /dev/null +++ b/ballisticacore-cmake/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/vcs.xml b/ballisticacore-cmake/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/ballisticacore-cmake/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/ballisticacore-cmake/CMakeLists.txt b/ballisticacore-cmake/CMakeLists.txt new file mode 100644 index 00000000..888fee8c --- /dev/null +++ b/ballisticacore-cmake/CMakeLists.txt @@ -0,0 +1,199 @@ +cmake_minimum_required(VERSION 3.12) +project(BallisticaCore) +include(CheckIncludeFile) + +option(HEADLESS "build headless server" OFF) +option(TEST_BUILD "include testing features" OFF) + +# Requiring minimum of C++17 currently. +set(CMAKE_CXX_STANDARD 17) + +if (APPLE) + # Seems as of Mojave we need to explicitly pull in /usr/local stuff. + include_directories("/usr/local/include") + link_directories("/usr/local/lib") + + # On Mac with homebrew it seems that Requesting 3.7 when we've got + # 3.8 installed will point us at the 3.8 framework but will attempt + # to load a 3.7 library from within it which doesn't exist. So we need + # to be a bit more explicit telling it where to look. This is no longer + # necessary since we're using 3.8 now but may be once 3.9 becomes available + # through homebrew. + execute_process(COMMAND "python3.8-config" "--prefix" + OUTPUT_VARIABLE Python_ROOT_DIR + OUTPUT_STRIP_TRAILING_WHITESPACE) + +endif () +find_package (Python 3.8 REQUIRED EXACT COMPONENTS Development) + + +if (HEADLESS) + add_definitions(-DBA_HEADLESS_BUILD=1) + else () + find_package(SDL2 QUIET) + if (SDL2_FOUND) + # Getting complaint about space at the end of this on ubuntu16. + string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES) + else () + message(FATAL_ERROR "SDL2 not found") + endif () + find_package(OpenGL REQUIRED) + find_package(OpenAL REQUIRED) + if (APPLE) + # On mac this sets an include path that we don't need since + # we're using the system framework... should clean this up. + set(OPENAL_INCLUDE_DIR "") + endif () + find_library(OGG_LIBRARY ogg) + find_library(VORBISFILE_LIBRARY vorbisfile) + if (NOT OGG_LIBRARY) + message(FATAL_ERROR "ogg library not found") + endif () + if (NOT VORBISFILE_LIBRARY) + message(FATAL_ERROR "vorbisfile library not found") + endif () + set(EXTRA_INCLUDE_DIRS ${OPENGL_INCLUDE_DIRS} + ${OPENAL_INCLUDE_DIR} ${SDL2_INCLUDE_DIRS}) + set(EXTRA_LIBRARIES ogg vorbisfile ${OPENGL_LIBRARIES} ${OPENAL_LIBRARY}) +endif () + +if (TEST_BUILD) + add_definitions(-DBA_TEST_BUILD=1) +endif () + +# Currently seeing warnings about parameter order changing in GCC 7.1 +# on Raspberry Pi builds. We never need to care about C++ abi compatibility +# so just silencing them for now. Can maybe remove this later if they stop. +if (CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -Wno-psabi") +endif() + +# message("GOT SDL INC ${SDL2_INCLUDE_DIRS}") +# message(FATAL_ERROR "SO FAR SO GOOD") + +set(BA_SRC_ROOT src) +include_directories(${BA_SRC_ROOT}) +add_compile_options(-include ballistica/config/config_cmake.h) + +if (CMAKE_BUILD_TYPE MATCHES Debug) + add_definitions(-DBA_DEBUG_BUILD=1) +endif () + +set(ODE_SRC_ROOT ${BA_SRC_ROOT}/external/open_dynamics_engine-ef) + +add_library(ode + ${ODE_SRC_ROOT}/ode/IceAABB.cpp + ${ODE_SRC_ROOT}/ode/IceContainer.cpp + ${ODE_SRC_ROOT}/ode/IceHPoint.cpp + ${ODE_SRC_ROOT}/ode/IceIndexedTriangle.cpp + ${ODE_SRC_ROOT}/ode/IceMatrix3x3.cpp + ${ODE_SRC_ROOT}/ode/IceMatrix4x4.cpp + ${ODE_SRC_ROOT}/ode/IceOBB.cpp + ${ODE_SRC_ROOT}/ode/IcePlane.cpp + ${ODE_SRC_ROOT}/ode/IcePoint.cpp + ${ODE_SRC_ROOT}/ode/IceRandom.cpp + ${ODE_SRC_ROOT}/ode/IceRay.cpp + ${ODE_SRC_ROOT}/ode/IceRevisitedRadix.cpp + ${ODE_SRC_ROOT}/ode/IceSegment.cpp + ${ODE_SRC_ROOT}/ode/IceTriangle.cpp + ${ODE_SRC_ROOT}/ode/IceUtils.cpp + ${ODE_SRC_ROOT}/ode/ode.cpp + ${ODE_SRC_ROOT}/ode/ode_array.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_cylinder_box.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_cylinder_plane.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_cylinder_sphere.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_cylinder_trimesh.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_kernel.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_quadtreespace.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_sapspace.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_space.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_std.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_transform.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh_box.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh_ccylinder.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh_distance.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh_plane.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh_ray.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh_sphere.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_trimesh_trimesh.cpp + ${ODE_SRC_ROOT}/ode/ode_collision_util.cpp + ${ODE_SRC_ROOT}/ode/ode_error.cpp + ${ODE_SRC_ROOT}/ode/ode_export-diff.cpp + ${ODE_SRC_ROOT}/ode/ode_fastdot.cpp + ${ODE_SRC_ROOT}/ode/ode_fastldlt.cpp + ${ODE_SRC_ROOT}/ode/ode_fastlsolve.cpp + ${ODE_SRC_ROOT}/ode/ode_fastltsolve.cpp + ${ODE_SRC_ROOT}/ode/ode_joint.cpp + ${ODE_SRC_ROOT}/ode/ode_lcp.cpp + ${ODE_SRC_ROOT}/ode/ode_mass.cpp + ${ODE_SRC_ROOT}/ode/ode_mat.cpp + ${ODE_SRC_ROOT}/ode/ode_math.cpp + ${ODE_SRC_ROOT}/ode/ode_matrix.cpp + ${ODE_SRC_ROOT}/ode/ode_memory.cpp + ${ODE_SRC_ROOT}/ode/ode_misc.cpp + ${ODE_SRC_ROOT}/ode/ode_obstack.cpp + ${ODE_SRC_ROOT}/ode/ode_quickstep.cpp + ${ODE_SRC_ROOT}/ode/ode_rotation.cpp + ${ODE_SRC_ROOT}/ode/ode_step.cpp + ${ODE_SRC_ROOT}/ode/ode_stepfast.cpp + ${ODE_SRC_ROOT}/ode/ode_timer.cpp + ${ODE_SRC_ROOT}/ode/ode_util.cpp + ${ODE_SRC_ROOT}/ode/OPC_AABBCollider.cpp + ${ODE_SRC_ROOT}/ode/OPC_AABBTree.cpp + ${ODE_SRC_ROOT}/ode/OPC_BaseModel.cpp + ${ODE_SRC_ROOT}/ode/OPC_BoxPruning.cpp + ${ODE_SRC_ROOT}/ode/OPC_Collider.cpp + ${ODE_SRC_ROOT}/ode/OPC_HybridModel.cpp + ${ODE_SRC_ROOT}/ode/OPC_LSSCollider.cpp + ${ODE_SRC_ROOT}/ode/OPC_MeshInterface.cpp + ${ODE_SRC_ROOT}/ode/OPC_Model.cpp + ${ODE_SRC_ROOT}/ode/OPC_OBBCollider.cpp + ${ODE_SRC_ROOT}/ode/OPC_OptimizedTree.cpp + ${ODE_SRC_ROOT}/ode/OPC_PlanesCollider.cpp + ${ODE_SRC_ROOT}/ode/OPC_RayCollider.cpp + ${ODE_SRC_ROOT}/ode/OPC_SphereCollider.cpp + ${ODE_SRC_ROOT}/ode/OPC_SweepAndPrune.cpp + ${ODE_SRC_ROOT}/ode/OPC_TreeBuilders.cpp + ${ODE_SRC_ROOT}/ode/OPC_TreeCollider.cpp + ${ODE_SRC_ROOT}/ode/OPC_VolumeCollider.cpp + ${ODE_SRC_ROOT}/ode/Opcode.cpp + ) +target_include_directories(ode PRIVATE ${ODE_SRC_ROOT}) + +# EWWW; GCC gives us bad mesh collisions with -O3 (and maybe -O2) +# need to finally get to the bottom of this but limiting to -01 for now. +# (-O2 might be safe??... or what about -Os? Should test again.) +if (CMAKE_BUILD_TYPE MATCHES Release) + target_compile_options(ode PRIVATE -O1) +endif () + +# BallisticaCore binary. +add_executable(ballisticacore + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/bitstream.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/mask.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/mmask.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/mqrspec.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/qrencode.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/qrinput.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/qrspec.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/rscode.c + ${BA_SRC_ROOT}/external/qrencode-3.4.4/qrencode/split.c + # AUTOGENERATED_PUBLIC_BEGIN (this section is managed by the "update_project" tool) + ${BA_SRC_ROOT}/ballistica/app/app.cc + # AUTOGENERATED_PUBLIC_END + ) + +target_include_directories(ballisticacore PRIVATE + ${Python_INCLUDE_DIRS} + ${BA_SRC_ROOT}/external/open_dynamics_engine-ef + ${BA_SRC_ROOT}/external/qrencode-3.4.4 + ${EXTRA_INCLUDE_DIRS} + ) + +# NOTE: seems we need to add 'dl' here for raspberry pi with manually +# built Python 3.8. Might be able to remove later. +target_link_libraries(ballisticacore PRIVATE + ballisticacore_private ode pthread ${Python_LIBRARIES} + ${SDL2_LIBRARIES} ${EXTRA_LIBRARIES} dl) diff --git a/ballisticacore-cmake/src b/ballisticacore-cmake/src new file mode 120000 index 00000000..5cd551cf --- /dev/null +++ b/ballisticacore-cmake/src @@ -0,0 +1 @@ +../src \ No newline at end of file diff --git a/tools/batools/updateproject.py b/tools/batools/updateproject.py index eb4907ca..6ac8a2c1 100755 --- a/tools/batools/updateproject.py +++ b/tools/batools/updateproject.py @@ -145,6 +145,10 @@ class Updater: sys.exit(255) def _update_compile_commands_file(self) -> None: + # Only do this in private repo: + if self._public: + return + # Update our local compile-commands file based on any changes to # our cmake stuff. Do this at end so cmake changes already happened. if not self._check and os.path.exists('ballisticacore-cmake'): @@ -543,28 +547,43 @@ class Updater: if os.path.exists(fname): self._update_visual_studio_project(fname, '..\\..\\src') - def _update_cmake_file(self, fname: str) -> None: + def _is_public_source_file(self, filename: str) -> bool: + if filename == '/app/app.cc': + return True + return False + def _update_cmake_file(self, fname: str) -> None: with open(fname) as infile: lines = infile.read().splitlines() - auto_start = lines.index(' #AUTOGENERATED_BEGIN (this section' - ' is managed by the "update_project" tool)') - auto_end = lines.index(' #AUTOGENERATED_END') - our_lines = [ - ' ${BA_SRC_ROOT}/ballistica' + f - for f in sorted(self._source_files + self._header_files) - if not f.endswith('.mm') and not f.endswith('.m') - ] - filtered = lines[:auto_start + 1] + our_lines + lines[auto_end:] - self._file_changes[fname] = '\n'.join(filtered) + '\n' + + for section in ['PUBLIC', 'PRIVATE']: + # Public repo has no private section. + if self._public and section == 'PRIVATE': + continue + + auto_start = lines.index( + f' # AUTOGENERATED_{section}_BEGIN (this section' + f' is managed by the "update_project" tool)') + auto_end = lines.index(f' # AUTOGENERATED_{section}_END') + our_lines = [ + ' ${BA_SRC_ROOT}/ballistica' + f + for f in sorted(self._source_files + self._header_files) + if not f.endswith('.mm') and not f.endswith('.m') + and self._is_public_source_file(f) == (section == 'PUBLIC') + ] + lines = lines[:auto_start + 1] + our_lines + lines[auto_end:] + + self._file_changes[fname] = '\n'.join(lines) + '\n' def _update_cmake_files(self) -> None: + # Note: currently not updating cmake files at all in public builds; + # will need to get this working at some point... fname = 'ballisticacore-cmake/CMakeLists.txt' - if os.path.exists(fname): + if not self._public: self._update_cmake_file(fname) fname = ('ballisticacore-android/BallisticaCore' '/src/main/cpp/CMakeLists.txt') - if os.path.exists(fname): + if not self._public: self._update_cmake_file(fname) def _find_sources_and_headers(self, scan_dir: str) -> None: diff --git a/tools/efrotools/efrocache.py b/tools/efrotools/efrocache.py index 7b3a5296..01c4c404 100644 --- a/tools/efrotools/efrocache.py +++ b/tools/efrotools/efrocache.py @@ -25,8 +25,6 @@ if TYPE_CHECKING: BASE_URL = 'https://files.ballistica.net/cache/ba1/' TARGET_TAG = '#__EFROCACHE_TARGET__' -STRIP_BEGIN_TAG = '#__EFROCACHE_STRIP_BEGIN__' -STRIP_END_TAG = '#__EFROCACHE_STRIP_END__' CACHE_DIR_NAME = '.efrocache' CACHE_MAP_NAME = '.efrocachemap' @@ -142,19 +140,6 @@ def filter_makefile(makefile_dir: str, contents: str) -> str: lines = contents.splitlines() pcommand = 'tools/pcommand' - # Strip out parts they don't want. - while STRIP_BEGIN_TAG in lines: - index = lines.index(STRIP_BEGIN_TAG) - endindex = index - while lines[endindex] != STRIP_END_TAG: - endindex += 1 - - # If the line after us is blank, include it too to keep spacing clean. - if not lines[endindex + 1].strip(): - endindex += 1 - - del lines[index:endindex + 1] - # Replace cachable targets with cache lookups while TARGET_TAG in lines: index = lines.index(TARGET_TAG)