Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMAKE: added cmake build support #559

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mgerhardy
Copy link

Old PR was this #517 - but I deleted the repo by accident.

@@ -0,0 +1,34 @@
if (MSVC)
set(SDL2_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE STRING "")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In WorldOfPadman we have solved this like this: https://github.com/PadWorld-Entertainment/worldofpadman/blob/main/libs/CMakeLists.txt#L10

if (UNIX)
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(SDL2 REQUIRED sdl2)
    add_library(SDL2_system INTERFACE)
    add_library(SDL2_main INTERFACE)
    target_include_directories(SDL2_system INTERFACE ${SDL2_INCLUDE_DIRS})
    target_link_libraries(SDL2_system INTERFACE ${SDL2_LINK_LIBRARIES})
    add_library(SDL2::SDL2 ALIAS SDL2_system)
    add_library(SDL2::SDL2main ALIAS SDL2_main)
else()
    set(OUTPUT_DIRECTORY "${ROOT_DIR}/${ENGINE_BINARY_DIR}")
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY}")
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}")
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${OUTPUT_DIRECTORY}")
    set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${OUTPUT_DIRECTORY}")
    set(SDL_CMAKE_DEBUG_POSTFIX "" CACHE STRING "Name suffix for debug builds")
    add_subdirectory(SDL2)
endif()

We have an SDL2 clone in our repository - which is a lot easier to update and maintain than building the needed libs each time.

@mgerhardy mgerhardy mentioned this pull request Feb 22, 2023
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set_property(SOURCE ${_file} APPEND PROPERTY COMPILE_DEFINITIONS idx64=1)
endif()
set_property(SOURCE ${_file} APPEND PROPERTY LANGUAGE ASM_MASM)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set_source_files_properties(${_file} PROPERTIES COMPILE_FLAGS "/safeseh")

is missing here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant