Skip to content

Commit

Permalink
Setup the submodules automaticilly
Browse files Browse the repository at this point in the history
Use system libraries on linux rather than included
  • Loading branch information
IssMneur committed Oct 11, 2016
1 parent 489856d commit 04a7a0d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "3rdparty"]
path = 3rdparty
url = git@github.com:wxLauncher/wxlauncher-3rdparty.git
url = https://github.com/wxLauncher/wxlauncher-3rdparty.git
[submodule "cmake/modules/sdl2-cmake-scripts"]
path = cmake/modules/sdl2-cmake-scripts
url = ssh://git@github.com/IssMneur/sdl2-cmake-scripts
url = https://github.com/IssMneur/sdl2-cmake-scripts.git
2 changes: 1 addition & 1 deletion 3rdparty
40 changes: 25 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,32 @@ if(NOT GIT_EXECUTABLE)
" - Call cmake with -DGIT_EXECUTABLE=<full path to git>")
endif()

# Special source directorys
if(NOT(DEFINED IS_WIN32 OR DEFINED IS_LINUX OR DEFINED IS_APPLE))
if(WIN32)
set(IS_WIN32 TRUE)
set(USE_3RDPARTY_DEFAULT ON)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(IS_APPLE TRUE)
set(USE_3RDPARTY_DEFAULT ON)
else()
set(IS_LINUX TRUE)
set(USE_3RDPARTY_DEFAULT OFF)
endif()
endif()

# Special source directories
set(LAUNCHER_CMAKE_SOURCE_DIR ${CMAKE_SOURCE_DIR}/cmake)
include(${LAUNCHER_CMAKE_SOURCE_DIR}/setup_submodules.cmake)
include(${LAUNCHER_CMAKE_SOURCE_DIR}/modules/modules.cmake)
list(INSERT CMAKE_MODULE_PATH 0 "${LAUNCHER_CMAKE_SOURCE_DIR}/include")
set(3RD_PARTY_SOURCE_DIR ${CMAKE_SOURCE_DIR}/3rdparty)


include(${LAUNCHER_CMAKE_SOURCE_DIR}/GetVersionFromGitTag.cmake)

message("--- Configuring wxLauncher ${wxlauncher_VERSION_STRING_FULL}")

if(NOT(DEFINED IS_WIN32 OR DEFINED IS_LINUX OR DEFINED IS_APPLE))
if(WIN32)
set(IS_WIN32 TRUE)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(IS_APPLE TRUE)
else()
set(IS_LINUX TRUE)
endif()
endif()

option(USE_3RDPARTY "Use the libraries in the 3rd party directory" ON)
option(USE_3RDPARTY "Use the libraries in the 3rd party directory"
${USE_3RDPARTY_DEFAULT})
if(USE_3RDPARTY)
message("--- Using 3rd party source directory")
execute_process(COMMAND ${CMAKE_COMMAND}
Expand Down Expand Up @@ -363,8 +367,14 @@ add_executable(wxlauncher WIN32 MACOSX_BUNDLE
${RESOURCE_FILES}
${CODE_FILES}
)
# C++11 is required for wxWidgets 3.0 and wxLauncher's new code
# (the auto_type specifically)
if (COMMAND target_compile_features)
target_compile_features(wxlauncher PRIVATE cxx_auto_type) # Enable C++11 because it is required for wxWidgets 3.0
# target_compile_features added in CMake 3.1
target_compile_features(wxlauncher PRIVATE cxx_auto_type)
else()
set_property(TARGET wxlauncher APPEND_STRING
PROPERTY COMPILE_FLAGS "-std=c++11")
endif()

set_target_properties(wxlauncher
Expand All @@ -388,7 +398,7 @@ foreach(temp_file ${helpmaker_temp_files})
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${temp_file})
endforeach(temp_file)

target_link_libraries(wxlauncher ${wxWidgets_LIBRARIES} ${SDL2_LIBRARIES})
target_link_libraries(wxlauncher ${wxWidgets_LIBRARIES} ${SDL2_LIBRARY})

# adapted from http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_apply_resources_on_Mac_OS_X_automatically.3F
# copies necessary resources (and frameworks, if needed) to .app bundle
Expand Down
14 changes: 14 additions & 0 deletions cmake/setup_submodules.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
set(STATUS)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule init
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE STATUS)
if(STATUS)
message(FATAL_ERROR "Failed to init submodules: ${STATUS}")
endif()
set(STATUS)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE STATUS)
if(STATUS)
message(FATAL_ERROR "Failed to update submodules: ${STATUS}")
endif()
4 changes: 0 additions & 4 deletions code/apis/resolution_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ void EnumerateGraphicsModes_sdl(
#endif
}

#if !HAS_SDL && !defined(WIN32)
#error No implementation of EnumerateGraphicsModes available
#endif

/** Get available graphics modes for API and return them sorted */
void ResolutionMan::EnumerateGraphicsModes(
ApiType type, ResolutionArray& out_modes,
Expand Down

0 comments on commit 04a7a0d

Please sign in to comment.