mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-29 15:32:38 +00:00
- put the project's name into a variable so that it doesn't have to be changed everywhere if needed.
This commit is contained in:
parent
5a853cb196
commit
6b0711ff0c
2 changed files with 26 additions and 25 deletions
|
@ -1,5 +1,6 @@
|
||||||
cmake_minimum_required( VERSION 3.1.0 )
|
cmake_minimum_required( VERSION 3.1.0 )
|
||||||
project(Demolition)
|
project(Demolition)
|
||||||
|
set ( PROJECT_NAME "demolition")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
@ -79,7 +80,7 @@ function( add_pk3 PK3_NAME PK3_DIR )
|
||||||
if( NOT COMPILE_OUTPUT_OLDSTYLE )
|
if( NOT COMPILE_OUTPUT_OLDSTYLE )
|
||||||
add_custom_command( OUTPUT ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME}
|
add_custom_command( OUTPUT ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME}
|
||||||
COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME} ${PK3_DIR}
|
COMMAND zipdir -udf ${PK3_ZIPDIR_OPTIONS} ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME} ${PK3_DIR}
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME} $<TARGET_FILE_DIR:demolition>/${PK3_NAME}
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME} $<TARGET_FILE_DIR:${PROJECT_NAME}>/${PK3_NAME}
|
||||||
DEPENDS zipdir )
|
DEPENDS zipdir )
|
||||||
else()
|
else()
|
||||||
add_custom_command( OUTPUT ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME}
|
add_custom_command( OUTPUT ${COMPILE_OUTPUT_DIECTRORY}/${PK3_NAME}
|
||||||
|
@ -141,7 +142,7 @@ IF( NOT CMAKE_BUILD_TYPE )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
set( COMPILE_OUTPUT_DIECTRORY ${CMAKE_BINARY_DIR} CACHE PATH "Directory where engine data and the executable will be created." )
|
set( COMPILE_OUTPUT_DIECTRORY ${CMAKE_BINARY_DIR} CACHE PATH "Directory where engine data and the executable will be created." )
|
||||||
set( COMPILE_EXE_NAME "demolition" CACHE FILEPATH "Name of the executable to create" )
|
set( COMPILE_EXE_NAME ${PROJECT_NAME} CACHE FILEPATH "Name of the executable to create" )
|
||||||
if( MSVC )
|
if( MSVC )
|
||||||
# Allow the user to use COMPILE_OUTPUT_DIECTRORY as a single release point.
|
# Allow the user to use COMPILE_OUTPUT_DIECTRORY as a single release point.
|
||||||
# Use different names for the various compile targets.
|
# Use different names for the various compile targets.
|
||||||
|
|
|
@ -526,7 +526,7 @@ elseif( APPLE )
|
||||||
|
|
||||||
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_POSIX_SOURCES} ${PLAT_OSX_SOURCES} )
|
set( SYSTEM_SOURCES ${SYSTEM_SOURCES} ${PLAT_POSIX_SOURCES} ${PLAT_OSX_SOURCES} )
|
||||||
|
|
||||||
##set_source_files_properties( posix/osx/demolition.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
##set_source_files_properties( posix/osx/${PROJECT_NAME}.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
|
||||||
##set_source_files_properties( posix/osx/iwadpicker_cocoa.mm PROPERTIES COMPILE_FLAGS -fobjc-exceptions )
|
##set_source_files_properties( posix/osx/iwadpicker_cocoa.mm PROPERTIES COMPILE_FLAGS -fobjc-exceptions )
|
||||||
else()
|
else()
|
||||||
#set( SYSTEM_SOURCES_DIR posix posix/sdl )
|
#set( SYSTEM_SOURCES_DIR posix posix/sdl )
|
||||||
|
@ -829,7 +829,7 @@ else()
|
||||||
set_source_files_properties( ${PCH_SOURCES} PROPERTIES COMPILE_FLAGS "-include g_pch.h" )
|
set_source_files_properties( ${PCH_SOURCES} PROPERTIES COMPILE_FLAGS "-include g_pch.h" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_executable( demolition WIN32 MACOSX_BUNDLE
|
add_executable( ${PROJECT_NAME} WIN32 MACOSX_BUNDLE
|
||||||
${HEADER_FILES}
|
${HEADER_FILES}
|
||||||
${NOT_COMPILED_SOURCE_FILES}
|
${NOT_COMPILED_SOURCE_FILES}
|
||||||
#__autostart.cpp
|
#__autostart.cpp
|
||||||
|
@ -859,7 +859,7 @@ if( UNIX )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries( demolition ${PROJECT_LIBRARIES} gdtoa lzma duke3d blood rr sw zmusic )
|
target_link_libraries( ${PROJECT_NAME} ${PROJECT_LIBRARIES} gdtoa lzma duke3d blood rr sw zmusic )
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
@ -893,23 +893,23 @@ include_directories(
|
||||||
#${SYSTEM_SOURCES_DIR}
|
#${SYSTEM_SOURCES_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_dependencies( demolition revision_check )
|
add_dependencies( ${PROJECT_NAME} revision_check )
|
||||||
|
|
||||||
# Due to some quirks, we need to do this in this order
|
# Due to some quirks, we need to do this in this order
|
||||||
if( NOT COMPILE_OUTPUT_OLDSTYLE )
|
if( NOT COMPILE_OUTPUT_OLDSTYLE )
|
||||||
# RUNTIME_OUTPUT_DIRECTORY does not exist in CMake 2.4.
|
# RUNTIME_OUTPUT_DIRECTORY does not exist in CMake 2.4.
|
||||||
# Linux distributions are slow to adopt 2.6. :(
|
# Linux distributions are slow to adopt 2.6. :(
|
||||||
set_target_properties( demolition PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${COMPILE_OUTPUT_DIECTRORY} )
|
set_target_properties( ${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${COMPILE_OUTPUT_DIECTRORY} )
|
||||||
set_target_properties( demolition PROPERTIES OUTPUT_NAME ${EXECUTABLE_NAME} )
|
set_target_properties( ${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} )
|
||||||
else()
|
else()
|
||||||
set_target_properties( demolition PROPERTIES
|
set_target_properties( ${PROJECT_NAME} PROPERTIES
|
||||||
RUNTIME_OUTPUT_NAME ${EXECUTABLE_NAME}
|
RUNTIME_OUTPUT_NAME ${PROJECT_NAME}
|
||||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${COMPILE_OUTPUT_DIECTRORY}
|
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${COMPILE_OUTPUT_DIECTRORY}
|
||||||
RUNTIME_OUTPUT_NAME_DEBUG ${EXECUTABLE_NAME}d
|
RUNTIME_OUTPUT_NAME_DEBUG ${PROJECT_NAME}d
|
||||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${COMPILE_OUTPUT_DIECTRORY}
|
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${COMPILE_OUTPUT_DIECTRORY}
|
||||||
RUNTIME_OUTPUT_NAME_MINSIZEREL ${EXECUTABLE_NAME}msr
|
RUNTIME_OUTPUT_NAME_MINSIZEREL ${PROJECT_NAME}msr
|
||||||
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${COMPILE_OUTPUT_DIECTRORY}
|
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${COMPILE_OUTPUT_DIECTRORY}
|
||||||
RUNTIME_OUTPUT_NAME_RELWITHDEBINFO ${EXECUTABLE_NAME}rd
|
RUNTIME_OUTPUT_NAME_RELWITHDEBINFO ${PROJECT_NAME}rd
|
||||||
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${COMPILE_OUTPUT_DIECTRORY}
|
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${COMPILE_OUTPUT_DIECTRORY}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -921,29 +921,29 @@ if( MSVC )
|
||||||
if( COMPILE_GENERATE_MAPFILE )
|
if( COMPILE_GENERATE_MAPFILE )
|
||||||
set( LINKERSTUFF "${LINKERSTUFF} /MAP" )
|
set( LINKERSTUFF "${LINKERSTUFF} /MAP" )
|
||||||
endif()
|
endif()
|
||||||
set_target_properties(demolition PROPERTIES LINK_FLAGS ${LINKERSTUFF})
|
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS ${LINKERSTUFF})
|
||||||
|
|
||||||
add_custom_command(TARGET demolition POST_BUILD
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\platform\\win32\\manifest.game.xml\" -outputresource:\"$<TARGET_FILE:demolition>\"\;\#1
|
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\platform\\win32\\manifest.game.xml\" -outputresource:\"$<TARGET_FILE:${PROJECT_NAME}>\"\;\#1
|
||||||
COMMENT "Adding manifest..."
|
COMMENT "Adding manifest..."
|
||||||
)
|
)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( NOT WIN32 AND NOT APPLE )
|
if( NOT WIN32 AND NOT APPLE )
|
||||||
FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/link-make "if [ ! -e ${COMPILE_OUTPUT_DIECTRORY}/${EXECUTABLE_NAME} ]; then ln -sf ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_NAME} ${COMPILE_OUTPUT_DIECTRORY}/${EXECUTABLE_NAME}; fi" )
|
FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/link-make "if [ ! -e ${COMPILE_OUTPUT_DIECTRORY}/${PROJECT_NAME} ]; then ln -sf ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} ${COMPILE_OUTPUT_DIECTRORY}/${PROJECT_NAME}; fi" )
|
||||||
add_custom_command( TARGET demolition POST_BUILD
|
add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make
|
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/link-make
|
||||||
COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make )
|
COMMAND /bin/sh -c ${CMAKE_CURRENT_BINARY_DIR}/link-make )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#add_custom_command(TARGET demolition POST_BUILD
|
#add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
# ${CMAKE_SOURCE_DIR}/soundfont/demolition.sf2 $<TARGET_FILE_DIR:demolition>/soundfonts/demolition.sf2
|
# ${CMAKE_SOURCE_DIR}/soundfont/${PROJECT_NAME}.sf2 $<TARGET_FILE_DIR:${PROJECT_NAME}>/soundfonts/${PROJECT_NAME}.sf2
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
# ${CMAKE_SOURCE_DIR}/fm_banks/GENMIDI.GS.wopl $<TARGET_FILE_DIR:demolition>/fm_banks/GENMIDI.GS.wopl
|
# ${CMAKE_SOURCE_DIR}/fm_banks/GENMIDI.GS.wopl $<TARGET_FILE_DIR:${PROJECT_NAME}>/fm_banks/GENMIDI.GS.wopl
|
||||||
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
# COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
# ${CMAKE_SOURCE_DIR}/fm_banks/gs-by-papiezak-and-sneakernets.wopn $<TARGET_FILE_DIR:demolition>/fm_banks/gs-by-papiezak-and-sneakernets.wopn
|
# ${CMAKE_SOURCE_DIR}/fm_banks/gs-by-papiezak-and-sneakernets.wopn $<TARGET_FILE_DIR:${PROJECT_NAME}>/fm_banks/gs-by-papiezak-and-sneakernets.wopn
|
||||||
#)
|
#)
|
||||||
|
|
||||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
if( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
|
@ -958,9 +958,9 @@ if( APPLE )
|
||||||
set( LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework QuartzCore" )
|
set( LINK_FRAMEWORKS "${LINK_FRAMEWORKS} -framework QuartzCore" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(demolition PROPERTIES
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
LINK_FLAGS "${LINK_FRAMEWORKS}"
|
LINK_FLAGS "${LINK_FRAMEWORKS}"
|
||||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/demolition-info.plist" )
|
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/posix/osx/${PROJECT_NAME}-info.plist" )
|
||||||
|
|
||||||
# Dymanic libraries like libvulkan.dylib or libMoltenVK.dylib will be loaded by dlopen()
|
# Dymanic libraries like libvulkan.dylib or libMoltenVK.dylib will be loaded by dlopen()
|
||||||
# if placed in the directory with the main executable
|
# if placed in the directory with the main executable
|
||||||
|
@ -972,7 +972,7 @@ if( WIN32 )
|
||||||
else()
|
else()
|
||||||
set( INSTALL_PATH bin CACHE STRING "Directory where the executable will be placed during install." )
|
set( INSTALL_PATH bin CACHE STRING "Directory where the executable will be placed during install." )
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS demolition
|
install(TARGETS ${PROJECT_NAME}
|
||||||
DESTINATION ${INSTALL_PATH}
|
DESTINATION ${INSTALL_PATH}
|
||||||
COMPONENT "Game executable")
|
COMPONENT "Game executable")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue