2020-08-22 22:30:12 -04:00
|
|
|
# Top Level CMakeLists.txt
|
2020-12-26 11:09:59 -05:00
|
|
|
if (UNIX)
|
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
else ()
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
endif ()
|
|
|
|
|
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-08-22 22:30:12 -04:00
|
|
|
|
2020-10-03 18:32:01 -04:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
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-12-02 19:51:42 -05:00
|
|
|
if (UNIX)
|
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 \
|
2020-12-02 19:51:42 -05:00
|
|
|
-Wno-cast-align \
|
2020-09-03 22:37:00 -04:00
|
|
|
-Wcast-qual \
|
|
|
|
-Wdisabled-optimization \
|
2020-12-02 19:51:42 -05:00
|
|
|
-Wformat \
|
2020-09-03 22:37:00 -04:00
|
|
|
-Wmissing-include-dirs \
|
|
|
|
-Woverloaded-virtual \
|
|
|
|
-Wredundant-decls \
|
2020-10-09 21:28:41 -04:00
|
|
|
-Wshadow \
|
|
|
|
-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-12-02 19:51:42 -05:00
|
|
|
endif (UNIX)
|
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
|
|
|
|
2021-01-03 12:31:42 -05:00
|
|
|
IF (ASAN_BUILD)
|
2021-01-04 23:32:51 -05:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -O1")
|
2021-01-03 12:31:42 -05:00
|
|
|
message(STATUS "Doing ASAN build")
|
|
|
|
ENDIF ()
|
|
|
|
|
2020-09-08 19:15:38 -04:00
|
|
|
option(CODE_COVERAGE "Enable Code Coverage Compiler Flags" OFF)
|
2020-11-21 12:52:38 -05:00
|
|
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/third-party/cmake/modules/)
|
2020-09-08 14:39:16 -04:00
|
|
|
|
2020-12-02 19:51:42 -05:00
|
|
|
if(UNIX 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(./)
|
|
|
|
|
2020-10-09 21:28:41 -04:00
|
|
|
include_directories(SYSTEM third-party/inja)
|
|
|
|
|
2021-01-06 12:16:39 -05:00
|
|
|
# build common library
|
|
|
|
add_subdirectory(common)
|
2020-10-31 14:07:43 -04:00
|
|
|
|
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-31 14:31:13 -04:00
|
|
|
# build zydis third party library for disassembling x86
|
|
|
|
option(ZYDIS_BUILD_TOOLS "" OFF)
|
|
|
|
option(ZYDIS_BUILD_EXAMPLES "" OFF)
|
2020-11-06 13:59:39 -05:00
|
|
|
option(ZYDIS_BUILD_SHARED_LIB "" ON)
|
2020-10-31 14:31:13 -04:00
|
|
|
add_subdirectory("third-party/zydis")
|
|
|
|
|
2020-11-06 13:59:39 -05:00
|
|
|
|
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)
|
2020-12-23 11:15:41 -05:00
|
|
|
ENDIF ()
|