-
-
Notifications
You must be signed in to change notification settings - Fork 529
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
base: main
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,34 @@ | |||
if (MSVC) | |||
set(SDL2_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE STRING "") |
There was a problem hiding this comment.
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.
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) |
There was a problem hiding this comment.
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
Old PR was this #517 - but I deleted the repo by accident.