commit c2eed67f2ead21146f0dbae5b51995ed8d172fad Author: C. J. Howard Date: Thu May 23 22:39:52 2019 +0800 Initial commit diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b1226ba --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "modules/entt"] + path = modules/entt + url = git@cjhoward.org:entt.git +[submodule "modules/vmq"] + path = modules/vmq + url = git@cjhoward.org:vmq.git +[submodule "modules/antkeeper-source"] + path = modules/antkeeper-source + url = git@cjhoward.org:antkeeper-source.git +[submodule "modules/antkeeper-data"] + path = modules/antkeeper-data + url = git@cjhoward.org:antkeeper-data.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d155639 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,142 @@ +# Prevent in-source builds +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds prohibited. Call cmake from the build directory.") +endif() + +cmake_minimum_required(VERSION 3.7) + +# Get software package name and version +include(${CMAKE_SOURCE_DIR}/modules/antkeeper-source/cmake/project.cmake) + +# Setup package variables +set(PACKAGE_NAME ${PROJECT_NAME}) +set(PACKAGE_VERSION ${PROJECT_VERSION}) +set(PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) +get_filename_component(PACKAGE_PLATFORM ${CMAKE_BINARY_DIR} NAME CACHE) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + set(PACKAGE_BUILD_TYPE debug) +else() + set(PACKAGE_BUILD_TYPE release) +endif() +set(PACKAGE_FILENAME ${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}) +set(PACKAGE_INSTALL_DIR ${CMAKE_SOURCE_DIR}/bin/${PACKAGE_BUILD_TYPE}/${PACKAGE_FILENAME}) +set(PACKAGE_DIST_DIR ${CMAKE_SOURCE_DIR}/dist/${PACKAGE_BUILD_TYPE}) + +# Check for architecture mismatches +if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4") + if (PACKAGE_PLATFORM MATCHES "64$") + message(FATAL_ERROR "Compiler architecture is 32-bit but target architecture is 64-bit.") + endif() +else() + if (PACKAGE_PLATFORM MATCHES "32$") + message(FATAL_ERROR "Compiler architecture is 64-bit but target architecture is 32-bit.") + endif() +endif() + +# Create superbuild project +project(${PACKAGE_NAME}-superbuild VERSION ${PACKAGE_VERSION}) + +# Options +set(INKSCAPE_PATH "inkscape" CACHE PATH "Path to the Inkscape binary") +set(BLENDER_PATH "blender" CACHE PATH "Path to the Blender binary") + +# Setup module directories +set(MODULE_SOURCE_DIR "${PROJECT_SOURCE_DIR}/modules") +set(MODULE_BUILD_DIR "${PROJECT_BINARY_DIR}/modules/build") +set(MODULE_INSTALL_DIR "${CMAKE_BINARY_DIR}/modules/install") + +# Include ExternalProject_Add macro +include(${CMAKE_ROOT}/Modules/ExternalProject.cmake) + +# Build vmq module +ExternalProject_Add(vmq + SOURCE_DIR ${MODULE_SOURCE_DIR}/vmq + BINARY_DIR ${MODULE_BUILD_DIR}/vmq + INSTALL_DIR ${MODULE_INSTALL_DIR} + CMAKE_ARGS + "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" + "-DCMAKE_INSTALL_PREFIX=${MODULE_INSTALL_DIR}" + "-DBUILD_EXAMPLES=OFF" + BUILD_ALWAYS 1) + +# Build antkeeper-source module +ExternalProject_Add(antkeeper-source + DEPENDS vmq + SOURCE_DIR ${MODULE_SOURCE_DIR}/antkeeper-source + BINARY_DIR ${MODULE_BUILD_DIR}/antkeeper-source + INSTALL_DIR ${PACKAGE_INSTALL_DIR} + CMAKE_ARGS + "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" + "-DCMAKE_INSTALL_PREFIX=${PACKAGE_INSTALL_DIR}" + "-DPACKAGE_PLATFORM=${PACKAGE_PLATFORM}" + "-DCMAKE_PREFIX_PATH=${MODULE_INSTALL_DIR}" + BUILD_ALWAYS 1) + +# Create install target +install(DIRECTORY "${PACKAGE_INSTALL_DIR}/" DESTINATION . COMPONENT "package" USE_SOURCE_PERMISSIONS FILES_MATCHING PATTERN "*") + +# Create clean-build target +add_custom_target(clean-build + COMMAND git clean -fdX + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}") + +# Create cpack target +add_custom_target(cpack + COMMAND "${CMAKE_COMMAND}" --build . --target package + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS antkeeper-source + VERBATIM) + +# Create dist target +add_custom_target(dist DEPENDS cpack) + +# Configure CPack variables +set(CPACK_PACKAGE_NAME "${PACKAGE_NAME}") +set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") +set(CPACK_PACKAGE_FILE_NAME "${PACKAGE_NAME}-${PACKAGE_VERSION}-${PACKAGE_PLATFORM}") +set(CPACK_PACKAGE_DESCRIPTION "") +set(CPACK_PACKAGE_CONTACT "Christopher J. Howard ") +set(CPACK_COMPONENTS_ALL "package") + +# Configure .tgz and .zip distribution packages +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +#set(CPACK_ARCHIVE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.zip") +#set(CPACK_ARCHIVE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.zip") + +# Configure .deb distribution package +set(CPACK_DEB_COMPONENT_INSTALL ON) +set(CPACK_DEBIAN_PACKAGE_PACKAGE_NAME "${CPACK_PACKAGE_NAME}") +set(CPACK_DEBIAN_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.deb") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "") + +# Configure NSIS installer package +#set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/data/icons/app-icon.ico") +#set(CPACK_PACKAGE_INSTALL_DIRECTORY "App") + +# Build distribution packages according to target platform +set(CPACK_GENERATOR "") +if(PACKAGE_PLATFORM MATCHES "linux") + set(CPACK_GENERATOR "TGZ;DEB") + add_custom_command(TARGET dist + COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIST_DIR} + COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_PACKAGE_FILE_NAME}-package.tar.gz" "${PACKAGE_DIST_DIR}/${PACKAGE_FILENAME}.tar.gz" + COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_DEBIAN_PACKAGE_FILE_NAME}" "${PACKAGE_DIST_DIR}") + +elseif(PACKAGE_PLATFORM MATCHES "win") + set(CPACK_GENERATOR "ZIP;NSIS") + add_custom_command(TARGET dist + COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIST_DIR} + COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_PACKAGE_FILE_NAME}-package.zip" "${PACKAGE_DIST_DIR}/${PACKAGE_FILENAME}.zip") +elseif(PACKAGE_PLATFORM MATCHES "osx") + set(CPACK_GENERATOR "ZIP;NSIS") + add_custom_command(TARGET dist + COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIST_DIR} + COMMAND ${CMAKE_COMMAND} -E copy "${CPACK_PACKAGE_FILE_NAME}-package.zip" "${PACKAGE_DIST_DIR}/${PACKAGE_FILENAME}.zip") +endif() + +# Include CPack macro +include(CPack) diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..e997933 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright © 2019 Christopher J. Howard + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0ee9e1c --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +# Antkeeper Superbuild + +## Download + +Use Git to download the `antkeeper-superbuild` repository and all of its submodules: + + git clone --recursive git@cjhoward.org:antkeeper-superbuild.git + +## Configuration & Building + +CMake is required to configure and build the application. Depending on the target build platform, CMake should be invoked from one of the following directories: + + build/linux32 // 32-bit GNU/Linux application + build/linux64 // 64-bit GNU/Linux application + build/win32 // 32-bit Windows application + build/win64 // 64-bit Windows application + +The following arguments may be passed to CMake during configuration: + + -DCMAKE_BUILD_TYPE // [Debug, Release] + +### GNU/Linux + +Building on GNU/Linux requires CMake, GCC, G++, and GNU Make. Open a terminal in the project root directory and run the following commands: + + cd build/linux64 + cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=... + cmake --build . + +### Windows + +Building on Windows requires CMake and Visual Studio 2017. Additionally, [NSIS](http://nsis.sourceforge.net/) is required if you want to build a distributable installer program. In order to correctly build for your target architecture, you must use the `x86 Native Tools Command Prompt` or the `x64 Native Tools Command Prompt` for 32-bit and 64-bit applications, respectively. Then navigate to the project root directory and run the following commands: + + cd build\win64 + cmake ..\.. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=... + cmake --build . + +## Testing + +After building, a standalone version of the application will be located somewhere in the `bin` directory according to the build type, build platform, and version string. This application can be executed with the following command: + + cmake --build . --target run + +## Distribution + +The built application can be packaged into a distributable format with the following command: + + cmake --build . --target dist + +The resulting package will be located in the `dist` directory. + +## Contributing + +If any changes have been made to the submodules, commit those first. Each submodule can then be updated to their latest commits with the following command: + + git submodule update --recursive --remote + +## License + +Antkeeper is made available under the MIT license. See [`LICENSE.md`](./LICENSE.md) for details. diff --git a/bin/.gitignore b/bin/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/bin/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/build/linux32/.gitignore b/build/linux32/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/build/linux32/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/build/linux64/.gitignore b/build/linux64/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/build/linux64/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/build/win32/.gitignore b/build/win32/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/build/win32/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/build/win64/.gitignore b/build/win64/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/build/win64/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/dist/.gitignore b/dist/.gitignore new file mode 100644 index 0000000..c96a04f --- /dev/null +++ b/dist/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore \ No newline at end of file diff --git a/modules/antkeeper-data b/modules/antkeeper-data new file mode 160000 index 0000000..eeb245d --- /dev/null +++ b/modules/antkeeper-data @@ -0,0 +1 @@ +Subproject commit eeb245dd186441c61be997491ec9b95aa4d3db75 diff --git a/modules/antkeeper-source b/modules/antkeeper-source new file mode 160000 index 0000000..03e321f --- /dev/null +++ b/modules/antkeeper-source @@ -0,0 +1 @@ +Subproject commit 03e321ffbef7da575ea74921df625743c3a5c70a diff --git a/modules/entt b/modules/entt new file mode 160000 index 0000000..09ff43e --- /dev/null +++ b/modules/entt @@ -0,0 +1 @@ +Subproject commit 09ff43ef0a9bc782eec42b8b2b10818ccc16f1e9 diff --git a/modules/vmq b/modules/vmq new file mode 160000 index 0000000..94352be --- /dev/null +++ b/modules/vmq @@ -0,0 +1 @@ +Subproject commit 94352be4df0b2d374293786ddf95420327ebdf93