mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-03 04:05:49 +01:00
Use aliases in cmake to prevent mistakes. Fix g2 dependency mistake (#24213)
Move libopenrct2 cmake to libopenrct2 Revert using aliases for install
This commit is contained in:
@@ -391,22 +391,6 @@ if(NOT DISABLE_GUI)
|
||||
include("${ROOT_DIR}/src/openrct2-ui/CMakeLists.txt" NO_POLICY_SCOPE)
|
||||
endif()
|
||||
|
||||
# Defines
|
||||
target_compile_definitions(libopenrct2 PUBLIC
|
||||
$<$<BOOL:${USE_MMAP}>:USE_MMAP>
|
||||
$<$<BOOL:${DISABLE_NETWORK}>:DISABLE_NETWORK>
|
||||
$<$<BOOL:${DISABLE_HTTP}>:DISABLE_HTTP>
|
||||
$<$<BOOL:${DISABLE_TTF}>:DISABLE_TTF>
|
||||
$<$<BOOL:${DISABLE_VERSION_CHECKER}>:DISABLE_VERSION_CHECKER>
|
||||
$<$<BOOL:${ENABLE_SCRIPTING}>:ENABLE_SCRIPTING>
|
||||
)
|
||||
|
||||
target_compile_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_ASAN}>:-fsanitize=address>)
|
||||
target_link_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_ASAN}>:-fsanitize=address>)
|
||||
|
||||
target_compile_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_UBSAN}>:-fsanitize=undefined>)
|
||||
target_link_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_UBSAN}>:-fsanitize=undefined>)
|
||||
|
||||
# g2
|
||||
if (NOT (MACOS_BUNDLE AND (NOT CMAKE_OSX_ARCHITECTURES MATCHES "${SYSTEM_MACOS_ARCH}")))
|
||||
add_custom_command(
|
||||
@@ -414,7 +398,7 @@ if (NOT (MACOS_BUNDLE AND (NOT CMAKE_OSX_ARCHITECTURES MATCHES "${SYSTEM_MACOS_A
|
||||
COMMAND ./openrct2-cli sprite build ${CMAKE_BINARY_DIR}/g2.dat ${ROOT_DIR}/resources/g2/sprites.json
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
)
|
||||
add_custom_target(g2 DEPENDS openrct2 g2.dat)
|
||||
add_custom_target(g2 DEPENDS OpenRCT2::openrct2-cli g2.dat)
|
||||
else ()
|
||||
message("Skipping g2.dat generation in macOS cross-compile")
|
||||
endif ()
|
||||
|
||||
@@ -7,6 +7,8 @@ file(GLOB_RECURSE OPENRCT2_CLI_SOURCES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/*.hpp")
|
||||
|
||||
add_executable(openrct2-cli ${OPENRCT2_CLI_SOURCES})
|
||||
add_executable(OpenRCT2::openrct2-cli ALIAS openrct2-cli)
|
||||
|
||||
target_include_directories(openrct2-cli PRIVATE "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
ipo_set_target_properties(openrct2-cli)
|
||||
if (EMSCRIPTEN)
|
||||
|
||||
@@ -59,6 +59,8 @@ endif ()
|
||||
|
||||
# Outputs
|
||||
add_executable(openrct2 ${OPENRCT2_UI_SOURCES} ${OPENRCT2_UI_MM_SOURCES})
|
||||
add_executable(OpenRCT2::openrct2 ALIAS openrct2)
|
||||
|
||||
SET_CHECK_CXX_FLAGS(openrct2)
|
||||
ipo_set_target_properties(openrct2)
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ if (ENABLE_SCRIPTING)
|
||||
endif ()
|
||||
|
||||
add_library(libopenrct2 ${OPENRCT2_CORE_SOURCES} ${OPENRCT2_CORE_MM_SOURCES} ${OPENRCT2_DUKTAPE_SOURCES})
|
||||
add_library(OpenRCT2::libopenrct2 ALIAS libopenrct2)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "13")
|
||||
message(WARNING "Buggy GCC 12 detected! Disabling some warnings")
|
||||
set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/localisation/FormatCodes.cpp" PROPERTIES COMPILE_FLAGS "-Wno-restrict")
|
||||
@@ -281,6 +283,22 @@ if (UNIX)
|
||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||
endif ()
|
||||
|
||||
# Defines
|
||||
target_compile_definitions(libopenrct2 PUBLIC
|
||||
$<$<BOOL:${USE_MMAP}>:USE_MMAP>
|
||||
$<$<BOOL:${DISABLE_NETWORK}>:DISABLE_NETWORK>
|
||||
$<$<BOOL:${DISABLE_HTTP}>:DISABLE_HTTP>
|
||||
$<$<BOOL:${DISABLE_TTF}>:DISABLE_TTF>
|
||||
$<$<BOOL:${DISABLE_VERSION_CHECKER}>:DISABLE_VERSION_CHECKER>
|
||||
$<$<BOOL:${ENABLE_SCRIPTING}>:ENABLE_SCRIPTING>
|
||||
)
|
||||
|
||||
target_compile_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_ASAN}>:-fsanitize=address>)
|
||||
target_link_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_ASAN}>:-fsanitize=address>)
|
||||
|
||||
target_compile_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_UBSAN}>:-fsanitize=undefined>)
|
||||
target_link_options(libopenrct2 PUBLIC $<$<BOOL:${ENABLE_UBSAN}>:-fsanitize=undefined>)
|
||||
|
||||
if (CMAKE_LIBRARY_ARCHITECTURE MATCHES "arm-linux-gnueabihf")
|
||||
message(STATUS "Linking to armhf libs; adding libatomic")
|
||||
target_link_libraries(libopenrct2 atomic)
|
||||
|
||||
@@ -37,6 +37,8 @@ set(test_files
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/TileElementsView.cpp")
|
||||
|
||||
add_executable(OpenRCT2Tests ${test_files})
|
||||
add_executable(OpenRCT2::OpenRCT2Tests ALIAS OpenRCT2Tests)
|
||||
|
||||
target_link_libraries(OpenRCT2Tests GTest::gtest GTest::gtest_main libopenrct2)
|
||||
target_include_directories(OpenRCT2Tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../src")
|
||||
set_target_properties(OpenRCT2Tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||
|
||||
Reference in New Issue
Block a user