mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-17 15:05:05 -05:00
103 lines
4.4 KiB
CMake
103 lines
4.4 KiB
CMake
|
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
|
||
|
|
||
|
set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE)
|
||
|
set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use")
|
||
|
#set(CMAKE_C_STANDARD 11 CACHE STRING "The C standard to use")
|
||
|
set(CMAKE_C_STANDARD 11)
|
||
|
|
||
|
project(OTRExporter C CXX)
|
||
|
|
||
|
################################################################################
|
||
|
# Set target arch type if empty. Visual studio solution generator provides it.
|
||
|
################################################################################
|
||
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||
|
if(NOT CMAKE_VS_PLATFORM_NAME)
|
||
|
set(CMAKE_VS_PLATFORM_NAME "x64")
|
||
|
endif()
|
||
|
message("${CMAKE_VS_PLATFORM_NAME} architecture in use")
|
||
|
|
||
|
if(NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64"
|
||
|
OR "${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32"))
|
||
|
message(FATAL_ERROR "${CMAKE_VS_PLATFORM_NAME} arch is not supported!")
|
||
|
endif()
|
||
|
endif()
|
||
|
|
||
|
################################################################################
|
||
|
# Global configuration types
|
||
|
################################################################################
|
||
|
set(CMAKE_CONFIGURATION_TYPES
|
||
|
"Debug"
|
||
|
"Release"
|
||
|
CACHE STRING "" FORCE
|
||
|
)
|
||
|
|
||
|
################################################################################
|
||
|
# Global compiler options
|
||
|
################################################################################
|
||
|
if(MSVC)
|
||
|
# remove default flags provided with CMake for MSVC
|
||
|
set(CMAKE_C_FLAGS "")
|
||
|
set(CMAKE_C_FLAGS_DEBUG "")
|
||
|
set(CMAKE_C_FLAGS_RELEASE "")
|
||
|
set(CMAKE_CXX_FLAGS "")
|
||
|
set(CMAKE_CXX_FLAGS_DEBUG "")
|
||
|
set(CMAKE_CXX_FLAGS_RELEASE "")
|
||
|
endif()
|
||
|
|
||
|
################################################################################
|
||
|
# Global linker options
|
||
|
################################################################################
|
||
|
if(MSVC)
|
||
|
# remove default flags provided with CMake for MSVC
|
||
|
set(CMAKE_EXE_LINKER_FLAGS "")
|
||
|
set(CMAKE_MODULE_LINKER_FLAGS "")
|
||
|
set(CMAKE_SHARED_LINKER_FLAGS "")
|
||
|
set(CMAKE_STATIC_LINKER_FLAGS "")
|
||
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS}")
|
||
|
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS}")
|
||
|
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS}")
|
||
|
set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "${CMAKE_STATIC_LINKER_FLAGS}")
|
||
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS}")
|
||
|
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS}")
|
||
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS}")
|
||
|
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS}")
|
||
|
endif()
|
||
|
|
||
|
################################################################################
|
||
|
# Common utils
|
||
|
################################################################################
|
||
|
include(CMake/Utils.cmake)
|
||
|
|
||
|
################################################################################
|
||
|
# Additional Global Settings(add specific info there)
|
||
|
################################################################################
|
||
|
include(CMake/GlobalSettingsInclude.cmake OPTIONAL)
|
||
|
|
||
|
################################################################################
|
||
|
# Use solution folders feature
|
||
|
################################################################################
|
||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||
|
|
||
|
################################################################################
|
||
|
# Sub-projects
|
||
|
################################################################################
|
||
|
if (NOT TARGET libultraship)
|
||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship ${CMAKE_BINARY_DIR}/libultraship)
|
||
|
endif()
|
||
|
|
||
|
if (NOT TARGET ZAPD)
|
||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD)
|
||
|
endif()
|
||
|
|
||
|
if (NOT TARGET ZAPDUtils)
|
||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils)
|
||
|
endif()
|
||
|
|
||
|
add_subdirectory(OTRExporter)
|
||
|
|
||
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/extract_assets.py filedata)
|
||
|
string(REGEX REPLACE "../ZAPDTR/ZAPD.out" "${CMAKE_BINARY_DIR}/ZAPD/ZAPD.out" filedata "${filedata}")
|
||
|
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/extract_assets_cmake.py" "${filedata}")
|
||
|
file(CHMOD "${CMAKE_CURRENT_SOURCE_DIR}/extract_assets_cmake.py" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||
|
|