2023-10-16 08:14:43 +02:00
|
|
|
cmake_minimum_required(VERSION 3.0...3.5)
|
2021-08-27 12:29:41 +02:00
|
|
|
project(SpaceCadetPinball)
|
|
|
|
|
2021-09-09 10:40:54 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2021-08-27 12:29:41 +02:00
|
|
|
|
|
|
|
|
2021-09-09 10:40:54 +02:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
|
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
|
|
|
|
|
|
|
|
# On Windows, set paths to SDL-devel packages here
|
|
|
|
if(WIN32)
|
2021-10-07 11:53:56 +02:00
|
|
|
list(APPEND SDL2_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2")
|
|
|
|
list(APPEND SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2_mixer")
|
2021-09-09 10:40:54 +02:00
|
|
|
endif()
|
2021-08-27 12:29:41 +02:00
|
|
|
|
2021-10-07 15:47:07 +02:00
|
|
|
# Link mingw libs static
|
|
|
|
if(MINGW)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
|
|
|
|
endif()
|
|
|
|
|
2023-08-01 08:01:56 +02:00
|
|
|
if(APPLE)
|
|
|
|
set(MACOSX_RPATH)
|
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH true)
|
|
|
|
set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
|
|
|
|
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
|
|
|
|
list(APPEND SDL2_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs")
|
|
|
|
list(APPEND SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs")
|
|
|
|
endif()
|
|
|
|
|
2021-10-03 14:41:57 +02:00
|
|
|
# SDL2main is not needed
|
|
|
|
set(SDL2_BUILDING_LIBRARY ON)
|
|
|
|
|
2021-08-27 12:29:41 +02:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
FIND_PACKAGE(SDL2_mixer REQUIRED)
|
|
|
|
|
2021-09-09 10:40:54 +02:00
|
|
|
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR})
|
|
|
|
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
|
|
|
foreach(dir ${dirs})
|
|
|
|
message(STATUS "Include dir='${dir}'")
|
|
|
|
endforeach()
|
|
|
|
|
2021-08-27 12:29:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
set(SOURCE_FILES
|
|
|
|
SpaceCadetPinball/control.cpp
|
|
|
|
SpaceCadetPinball/control.h
|
2021-09-29 09:08:45 +02:00
|
|
|
SpaceCadetPinball/EmbeddedData.cpp
|
|
|
|
SpaceCadetPinball/EmbeddedData.h
|
2022-08-31 06:58:03 +02:00
|
|
|
SpaceCadetPinball/font_selection.cpp
|
|
|
|
SpaceCadetPinball/font_selection.h
|
2021-08-27 12:29:41 +02:00
|
|
|
SpaceCadetPinball/fullscrn.cpp
|
|
|
|
SpaceCadetPinball/fullscrn.h
|
|
|
|
SpaceCadetPinball/gdrv.cpp
|
|
|
|
SpaceCadetPinball/gdrv.h
|
2021-09-21 12:14:39 +02:00
|
|
|
SpaceCadetPinball/GroupData.cpp
|
|
|
|
SpaceCadetPinball/GroupData.h
|
2021-08-27 12:29:41 +02:00
|
|
|
SpaceCadetPinball/high_score.cpp
|
|
|
|
SpaceCadetPinball/high_score.h
|
|
|
|
SpaceCadetPinball/loader.cpp
|
|
|
|
SpaceCadetPinball/loader.h
|
|
|
|
SpaceCadetPinball/maths.cpp
|
|
|
|
SpaceCadetPinball/maths.h
|
|
|
|
SpaceCadetPinball/midi.cpp
|
|
|
|
SpaceCadetPinball/midi.h
|
|
|
|
SpaceCadetPinball/nudge.cpp
|
|
|
|
SpaceCadetPinball/nudge.h
|
|
|
|
SpaceCadetPinball/options.cpp
|
|
|
|
SpaceCadetPinball/options.h
|
|
|
|
SpaceCadetPinball/partman.cpp
|
|
|
|
SpaceCadetPinball/partman.h
|
|
|
|
SpaceCadetPinball/pb.cpp
|
|
|
|
SpaceCadetPinball/pb.h
|
|
|
|
SpaceCadetPinball/pch.h
|
|
|
|
SpaceCadetPinball/proj.cpp
|
|
|
|
SpaceCadetPinball/proj.h
|
|
|
|
SpaceCadetPinball/render.cpp
|
|
|
|
SpaceCadetPinball/render.h
|
|
|
|
SpaceCadetPinball/score.cpp
|
|
|
|
SpaceCadetPinball/score.h
|
|
|
|
SpaceCadetPinball/Sound.cpp
|
|
|
|
SpaceCadetPinball/Sound.h
|
|
|
|
SpaceCadetPinball/SpaceCadetPinball.cpp
|
|
|
|
SpaceCadetPinball/TBall.cpp
|
|
|
|
SpaceCadetPinball/TBall.h
|
|
|
|
SpaceCadetPinball/TBlocker.cpp
|
|
|
|
SpaceCadetPinball/TBlocker.h
|
|
|
|
SpaceCadetPinball/TBumper.cpp
|
|
|
|
SpaceCadetPinball/TBumper.h
|
|
|
|
SpaceCadetPinball/TCircle.cpp
|
|
|
|
SpaceCadetPinball/TCircle.h
|
|
|
|
SpaceCadetPinball/TCollisionComponent.cpp
|
|
|
|
SpaceCadetPinball/TCollisionComponent.h
|
|
|
|
SpaceCadetPinball/TComponentGroup.cpp
|
|
|
|
SpaceCadetPinball/TComponentGroup.h
|
|
|
|
SpaceCadetPinball/TDemo.cpp
|
|
|
|
SpaceCadetPinball/TDemo.h
|
|
|
|
SpaceCadetPinball/TDrain.cpp
|
|
|
|
SpaceCadetPinball/TDrain.h
|
|
|
|
SpaceCadetPinball/TEdgeBox.h
|
|
|
|
SpaceCadetPinball/TEdgeManager.cpp
|
|
|
|
SpaceCadetPinball/TEdgeManager.h
|
|
|
|
SpaceCadetPinball/TEdgeSegment.cpp
|
|
|
|
SpaceCadetPinball/TEdgeSegment.h
|
|
|
|
SpaceCadetPinball/TFlagSpinner.cpp
|
|
|
|
SpaceCadetPinball/TFlagSpinner.h
|
|
|
|
SpaceCadetPinball/TFlipper.cpp
|
|
|
|
SpaceCadetPinball/TFlipper.h
|
|
|
|
SpaceCadetPinball/TFlipperEdge.cpp
|
|
|
|
SpaceCadetPinball/TFlipperEdge.h
|
|
|
|
SpaceCadetPinball/TGate.cpp
|
|
|
|
SpaceCadetPinball/TGate.h
|
|
|
|
SpaceCadetPinball/THole.cpp
|
|
|
|
SpaceCadetPinball/THole.h
|
|
|
|
SpaceCadetPinball/timer.cpp
|
|
|
|
SpaceCadetPinball/timer.h
|
|
|
|
SpaceCadetPinball/TKickback.cpp
|
|
|
|
SpaceCadetPinball/TKickback.h
|
|
|
|
SpaceCadetPinball/TKickout.cpp
|
|
|
|
SpaceCadetPinball/TKickout.h
|
|
|
|
SpaceCadetPinball/TLight.cpp
|
|
|
|
SpaceCadetPinball/TLight.h
|
|
|
|
SpaceCadetPinball/TLightBargraph.cpp
|
|
|
|
SpaceCadetPinball/TLightBargraph.h
|
|
|
|
SpaceCadetPinball/TLightGroup.cpp
|
|
|
|
SpaceCadetPinball/TLightGroup.h
|
|
|
|
SpaceCadetPinball/TLightRollover.cpp
|
|
|
|
SpaceCadetPinball/TLightRollover.h
|
|
|
|
SpaceCadetPinball/TLine.cpp
|
|
|
|
SpaceCadetPinball/TLine.h
|
|
|
|
SpaceCadetPinball/TOneway.cpp
|
|
|
|
SpaceCadetPinball/TOneway.h
|
|
|
|
SpaceCadetPinball/TPinballComponent.cpp
|
|
|
|
SpaceCadetPinball/TPinballComponent.h
|
|
|
|
SpaceCadetPinball/TPinballTable.cpp
|
|
|
|
SpaceCadetPinball/TPinballTable.h
|
|
|
|
SpaceCadetPinball/TPlunger.cpp
|
|
|
|
SpaceCadetPinball/TPlunger.h
|
|
|
|
SpaceCadetPinball/TPopupTarget.cpp
|
|
|
|
SpaceCadetPinball/TPopupTarget.h
|
|
|
|
SpaceCadetPinball/TRamp.cpp
|
|
|
|
SpaceCadetPinball/TRamp.h
|
2022-08-31 06:58:03 +02:00
|
|
|
SpaceCadetPinball/translations.cpp
|
|
|
|
SpaceCadetPinball/translations.h
|
2021-08-27 12:29:41 +02:00
|
|
|
SpaceCadetPinball/TRollover.cpp
|
|
|
|
SpaceCadetPinball/TRollover.h
|
|
|
|
SpaceCadetPinball/TSink.cpp
|
|
|
|
SpaceCadetPinball/TSink.h
|
|
|
|
SpaceCadetPinball/TSoloTarget.cpp
|
|
|
|
SpaceCadetPinball/TSoloTarget.h
|
|
|
|
SpaceCadetPinball/TSound.cpp
|
|
|
|
SpaceCadetPinball/TSound.h
|
|
|
|
SpaceCadetPinball/TTableLayer.cpp
|
|
|
|
SpaceCadetPinball/TTableLayer.h
|
|
|
|
SpaceCadetPinball/TTextBox.cpp
|
|
|
|
SpaceCadetPinball/TTextBox.h
|
|
|
|
SpaceCadetPinball/TTextBoxMessage.cpp
|
|
|
|
SpaceCadetPinball/TTextBoxMessage.h
|
|
|
|
SpaceCadetPinball/TTimer.cpp
|
|
|
|
SpaceCadetPinball/TTimer.h
|
|
|
|
SpaceCadetPinball/TTripwire.cpp
|
|
|
|
SpaceCadetPinball/TTripwire.h
|
|
|
|
SpaceCadetPinball/TWall.cpp
|
|
|
|
SpaceCadetPinball/TWall.h
|
|
|
|
SpaceCadetPinball/winmain.cpp
|
|
|
|
SpaceCadetPinball/winmain.h
|
|
|
|
SpaceCadetPinball/zdrv.cpp
|
2021-09-05 09:47:05 +02:00
|
|
|
SpaceCadetPinball/zdrv.h
|
|
|
|
SpaceCadetPinball/imconfig.h
|
|
|
|
SpaceCadetPinball/imgui_internal.h
|
|
|
|
SpaceCadetPinball/imgui.cpp
|
|
|
|
SpaceCadetPinball/imgui.h
|
|
|
|
SpaceCadetPinball/imgui_sdl.cpp
|
|
|
|
SpaceCadetPinball/imgui_sdl.h
|
|
|
|
SpaceCadetPinball/imgui_draw.cpp
|
|
|
|
SpaceCadetPinball/imgui_widgets.cpp
|
|
|
|
SpaceCadetPinball/imgui_tables.cpp
|
|
|
|
SpaceCadetPinball/imgui_demo.cpp
|
|
|
|
SpaceCadetPinball/imgui_impl_sdl.cpp
|
|
|
|
SpaceCadetPinball/imgui_impl_sdl.h
|
2022-12-11 07:32:40 +01:00
|
|
|
SpaceCadetPinball/imgui_impl_sdlrenderer.h
|
|
|
|
SpaceCadetPinball/imgui_impl_sdlrenderer.cpp
|
2021-09-05 09:47:05 +02:00
|
|
|
SpaceCadetPinball/imstb_textedit.h
|
|
|
|
SpaceCadetPinball/imstb_rectpack.h
|
|
|
|
SpaceCadetPinball/imstb_truetype.h
|
2022-05-19 13:17:31 +02:00
|
|
|
SpaceCadetPinball/DebugOverlay.cpp
|
|
|
|
SpaceCadetPinball/DebugOverlay.h
|
2021-09-05 09:47:05 +02:00
|
|
|
)
|
2021-08-27 12:29:41 +02:00
|
|
|
|
2021-10-03 17:57:19 +02:00
|
|
|
# On Windows, include resource file with the icon
|
|
|
|
if(WIN32)
|
|
|
|
set_source_files_properties(SpaceCadetPinball/SpaceCadetPinball.rc LANGUAGE RC)
|
2022-08-31 06:58:03 +02:00
|
|
|
list(APPEND SOURCE_FILES SpaceCadetPinball/SpaceCadetPinball.rc)
|
2021-10-03 17:57:19 +02:00
|
|
|
endif(WIN32)
|
|
|
|
|
2021-08-27 12:29:41 +02:00
|
|
|
add_executable(SpaceCadetPinball ${SOURCE_FILES})
|
|
|
|
|
2021-09-15 11:20:57 +02:00
|
|
|
# Skip pch on foreign code
|
|
|
|
set_source_files_properties(
|
|
|
|
SpaceCadetPinball/imgui.cpp
|
|
|
|
SpaceCadetPinball/imgui_sdl.cpp
|
|
|
|
SpaceCadetPinball/imgui_draw.cpp
|
|
|
|
SpaceCadetPinball/imgui_widgets.cpp
|
|
|
|
SpaceCadetPinball/imgui_tables.cpp
|
|
|
|
SpaceCadetPinball/imgui_demo.cpp
|
|
|
|
SpaceCadetPinball/imgui_impl_sdl.cpp
|
2022-12-11 07:32:40 +01:00
|
|
|
SpaceCadetPinball/imgui_impl_sdlrenderer.cpp
|
2021-09-15 11:20:57 +02:00
|
|
|
PROPERTIES SKIP_PRECOMPILE_HEADERS 1
|
|
|
|
)
|
2021-10-17 06:52:05 +02:00
|
|
|
|
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER "3.16.0" OR ${CMAKE_VERSION} VERSION_EQUAL "3.16.0")
|
|
|
|
target_precompile_headers(SpaceCadetPinball
|
|
|
|
PUBLIC
|
|
|
|
SpaceCadetPinball/pch.h
|
|
|
|
)
|
|
|
|
endif()
|
2021-09-15 11:20:57 +02:00
|
|
|
|
2021-09-09 10:40:54 +02:00
|
|
|
target_link_libraries(SpaceCadetPinball ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY})
|
|
|
|
|
|
|
|
# On Windows, copy DLL to output
|
|
|
|
if(WIN32)
|
2021-10-07 15:47:07 +02:00
|
|
|
list(GET SDL2_LIBRARY -1 SDL2_DLL_PATH)
|
|
|
|
list(GET SDL2_MIXER_LIBRARY -1 SDL2_MIXER_DLL_PATH)
|
2021-10-07 11:53:56 +02:00
|
|
|
get_filename_component(SDL2_DLL_PATH ${SDL2_DLL_PATH} DIRECTORY)
|
|
|
|
get_filename_component(SDL2_MIXER_DLL_PATH ${SDL2_MIXER_DLL_PATH} DIRECTORY)
|
|
|
|
if(MINGW)
|
|
|
|
string(REGEX REPLACE "lib$" "bin" SDL2_DLL_PATH ${SDL2_DLL_PATH})
|
|
|
|
string(REGEX REPLACE "lib$" "bin" SDL2_MIXER_DLL_PATH ${SDL2_MIXER_DLL_PATH})
|
|
|
|
endif()
|
2021-09-09 10:40:54 +02:00
|
|
|
message(STATUS "copy paths='${SDL2_DLL_PATH}' '${SDL2_MIXER_DLL_PATH}'")
|
|
|
|
add_custom_command(TARGET SpaceCadetPinball POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}/SDL2.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_MIXER_DLL_PATH}/SDL2_mixer.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
|
|
|
|
)
|
2021-12-02 06:07:27 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(UNIX AND NOT APPLE)
|
2021-12-20 07:06:32 +01:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
2022-05-04 07:48:42 +02:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/Platform/Linux/${PROJECT_NAME}.desktop" DESTINATION "share/applications")
|
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/Platform/Linux/${PROJECT_NAME}.metainfo.xml" DESTINATION "share/metainfo")
|
2021-12-26 11:43:47 +01:00
|
|
|
foreach(S 16 32 48 128 192)
|
2022-05-04 07:48:42 +02:00
|
|
|
install(FILES "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Icon_${S}x${S}.png" DESTINATION
|
2021-12-26 11:43:47 +01:00
|
|
|
"share/icons/hicolor/${S}x${S}/apps" RENAME "${PROJECT_NAME}.png")
|
|
|
|
endforeach(S)
|
2021-12-02 06:07:27 +01:00
|
|
|
endif()
|