2020-08-22 22:30:12 -04:00
|
|
|
# Top Level CMakeLists.txt
|
2020-09-04 23:24:16 -04:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2020-08-22 22:30:12 -04:00
|
|
|
project(jak)
|
|
|
|
|
2020-10-03 09:39:04 -04:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE "Debug")
|
|
|
|
endif()
|
|
|
|
|
2020-09-12 20:41:12 -04:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2020-08-22 22:30:12 -04:00
|
|
|
|
2020-08-26 19:40:26 -04:00
|
|
|
# Set default compile flags for GCC
|
2020-09-03 22:24:50 -04:00
|
|
|
# optimization level can be set here. Note that game/ overwrites this for building game C++ code.
|
2020-09-06 16:58:25 -04:00
|
|
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
2020-08-26 19:40:26 -04:00
|
|
|
message(STATUS "GCC detected, adding compile flags")
|
2020-09-06 16:58:25 -04:00
|
|
|
set(CMAKE_CXX_FLAGS
|
2020-09-13 21:10:43 -04:00
|
|
|
"${CMAKE_CXX_FLAGS} \
|
2020-09-03 22:37:00 -04:00
|
|
|
-Wall \
|
2020-09-13 21:10:43 -04:00
|
|
|
-Winit-self \
|
|
|
|
-ggdb \
|
2020-09-03 22:37:00 -04:00
|
|
|
-Wextra \
|
|
|
|
-Wcast-align \
|
|
|
|
-Wcast-qual \
|
|
|
|
-Wdisabled-optimization \
|
|
|
|
-Wformat=2 \
|
|
|
|
-Wmissing-include-dirs \
|
|
|
|
-Woverloaded-virtual \
|
|
|
|
-Wredundant-decls \
|
|
|
|
-Wshadow \
|
2020-08-26 19:40:26 -04:00
|
|
|
-Wsign-promo")
|
2020-09-06 16:58:25 -04:00
|
|
|
else ()
|
|
|
|
set(CMAKE_CXX_FLAGS "/EHsc")
|
2020-09-12 20:41:12 -04:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10000000")
|
2020-09-06 16:58:25 -04:00
|
|
|
endif (CMAKE_COMPILER_IS_GNUCXX)
|
2020-08-22 22:30:12 -04:00
|
|
|
|
2020-08-26 22:23:16 -04:00
|
|
|
IF (WIN32)
|
2020-09-06 16:58:25 -04:00
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
ENDIF ()
|
2020-08-26 22:23:16 -04:00
|
|
|
|
2020-09-08 19:15:38 -04:00
|
|
|
option(CODE_COVERAGE "Enable Code Coverage Compiler Flags" OFF)
|
2020-09-08 14:39:16 -04:00
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
|
|
|
|
|
2020-09-08 19:15:38 -04:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX AND CODE_COVERAGE)
|
2020-09-08 16:19:05 -04:00
|
|
|
include(CodeCoverage)
|
|
|
|
append_coverage_compiler_flags()
|
2020-09-08 19:15:38 -04:00
|
|
|
message("Code Coverage build is enabled!")
|
|
|
|
else()
|
|
|
|
message("Code Coverage build is disabled!")
|
2020-09-08 16:19:05 -04:00
|
|
|
endif()
|
2020-08-26 22:23:16 -04:00
|
|
|
|
2020-08-22 22:30:12 -04:00
|
|
|
# includes relative to top level jak-project folder
|
|
|
|
include_directories(./)
|
|
|
|
|
|
|
|
# build asset packer/unpacker
|
|
|
|
add_subdirectory(asset_tool)
|
|
|
|
|
2020-09-17 21:47:52 -04:00
|
|
|
# build goos
|
|
|
|
add_subdirectory(common/goos)
|
|
|
|
|
2020-08-23 23:43:11 -04:00
|
|
|
# build type_system library for compiler/decompiler
|
|
|
|
add_subdirectory(common/type_system)
|
|
|
|
|
2020-09-09 00:54:16 -04:00
|
|
|
# build common_util library
|
|
|
|
add_subdirectory(common/util)
|
|
|
|
|
2020-09-07 19:59:44 -04:00
|
|
|
# build cross platform socket library
|
|
|
|
add_subdirectory(common/cross_sockets)
|
|
|
|
|
2020-08-22 22:30:12 -04:00
|
|
|
# build decompiler
|
|
|
|
add_subdirectory(decompiler)
|
|
|
|
|
|
|
|
# build the game code in C++
|
|
|
|
add_subdirectory(game)
|
|
|
|
|
|
|
|
# build the compiler
|
|
|
|
add_subdirectory(goalc)
|
|
|
|
|
|
|
|
# build the gtest libraries
|
|
|
|
add_subdirectory(third-party/googletest)
|
|
|
|
|
|
|
|
# build tests
|
2020-08-22 23:16:48 -04:00
|
|
|
add_subdirectory(test)
|
|
|
|
|
|
|
|
# build minilzo library
|
2020-08-23 23:43:11 -04:00
|
|
|
add_subdirectory(third-party/minilzo)
|
|
|
|
|
|
|
|
# build format library
|
2020-08-26 22:23:16 -04:00
|
|
|
add_subdirectory(third-party/fmt)
|
|
|
|
|
2020-10-03 09:39:04 -04:00
|
|
|
# build spdlog library
|
|
|
|
add_subdirectory(third-party/spdlog)
|
|
|
|
|
2020-08-26 22:23:16 -04:00
|
|
|
# windows memory management lib
|
|
|
|
IF (WIN32)
|
2020-09-06 16:58:25 -04:00
|
|
|
add_subdirectory(third-party/mman)
|
|
|
|
ENDIF ()
|