diff --git a/CMakeLists.txt b/CMakeLists.txt index b183690..a260110 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,8 +51,8 @@ set(PHYSFS_ARCHIVE_QPAK OFF) set(PHYSFS_ARCHIVE_SLB OFF) set(PHYSFS_ARCHIVE_ISO9660 OFF) set(PHYSFS_ARCHIVE_VDF OFF) -add_subdirectory(third-party/physfs SYSTEM) -add_subdirectory(third-party/libxm SYSTEM) +add_subdirectory(third-party/physfs ${CMAKE_CURRENT_BINARY_DIR}/third-party/physfs SYSTEM) +add_subdirectory(third-party/libxm ${CMAKE_CURRENT_BINARY_DIR}/third-party/libxm SYSTEM) if(LINUX) diff --git a/apps/platformer/CMakeLists.txt b/apps/platformer/CMakeLists.txt index 1c3d3ec..9298f7a 100644 --- a/apps/platformer/CMakeLists.txt +++ b/apps/platformer/CMakeLists.txt @@ -6,10 +6,7 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() -# add root townengine cmake file -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - add_subdirectory(../../ ../../../.build) -endif() +add_subdirectory($ENV{TWNROOT} $ENV{TWNBUILDDIR}) set(SOURCE_FILES game.c diff --git a/apps/scenery/CMakeLists.txt b/apps/scenery/CMakeLists.txt index 2151142..7f7e4bb 100644 --- a/apps/scenery/CMakeLists.txt +++ b/apps/scenery/CMakeLists.txt @@ -6,10 +6,7 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() -# add root townengine cmake file -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - add_subdirectory(../../ ../../../.build) -endif() +add_subdirectory($ENV{TWNROOT} $ENV{TWNBUILDDIR}) set(SOURCE_FILES game.c diff --git a/apps/scenery/build.sh b/apps/scenery/build.sh deleted file mode 100755 index aefa755..0000000 --- a/apps/scenery/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/env sh - -if [ $1 = "web" ]; then - emcmake cmake -B .build-web "${@:2}" && cmake --build .build-web -else - cmake -B .build "$@" && cmake --build .build -fi diff --git a/apps/template/CMakeLists.txt b/apps/template/CMakeLists.txt index 3a34666..b8110d3 100644 --- a/apps/template/CMakeLists.txt +++ b/apps/template/CMakeLists.txt @@ -6,10 +6,7 @@ if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif() -# add root townengine cmake file -if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) - add_subdirectory(../../ ../../../.build) -endif() +add_subdirectory($ENV{TWNROOT} $ENV{TWNBUILDDIR}) set(SOURCE_FILES game.c diff --git a/apps/template/build.sh b/apps/template/build.sh deleted file mode 100755 index 45ab8a7..0000000 --- a/apps/template/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/env sh - -cmake -B .build "$@" && cmake --build .build diff --git a/apps/platformer/build.sh b/tools/build.sh similarity index 84% rename from apps/platformer/build.sh rename to tools/build.sh index aefa755..d7f57c9 100755 --- a/apps/platformer/build.sh +++ b/tools/build.sh @@ -1,6 +1,6 @@ #!/bin/env sh -if [ $1 = "web" ]; then +if [ "$1" = "web" ]; then emcmake cmake -B .build-web "${@:2}" && cmake --build .build-web else cmake -B .build "$@" && cmake --build .build diff --git a/tools/twn b/tools/twn new file mode 100755 index 0000000..cb70d7f --- /dev/null +++ b/tools/twn @@ -0,0 +1,15 @@ +#!/bin/env sh +# townengine tooling interface + +set +e + +toolpath="$(dirname -- "${BASH_SOURCE[0]}")" +export TWNROOT=$(realpath "$toolpath"/../) +export TWNBUILDDIR=$(realpath "$toolpath"/../.build) + +case "$1" in + build ) "$toolpath"/build.sh + ;; + * ) echo "Unknown command." + ;; +esac