aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt52
-rw-r--r--src/mock/CMakeLists.txt10
-rw-r--r--src/mock/wine/CMakeLists.txt33
3 files changed, 56 insertions, 39 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 72c4a76..de3d40c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,6 +1,14 @@
-set(C_STANDARD 99)
-set(MAINSOURCES
+find_package(Libcurl REQUIRED)
+find_package(JsonC REQUIRED)
+find_package(Libarchive REQUIRED)
+
+include_directories(${LIBCURL_INCLUDE_DIRS})
+include_directories(${JSONC_INCLUDE_DIRS})
+include_directories(${LIBARCHIVE_INCLUDE_DIRS})
+
+list(APPEND
+ CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/command.h
${CMAKE_CURRENT_SOURCE_DIR}/common.c
${CMAKE_CURRENT_SOURCE_DIR}/common.h
@@ -16,17 +24,20 @@ set(MAINSOURCES
if(ENABLE_DXVK)
add_compile_definitions(DXVK_ENABLED)
-set(MAINSOURCES
- ${MAINSOURCES}
+add_library(dxvk OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/dxvk.c
${CMAKE_CURRENT_SOURCE_DIR}/dxvk.h
)
+
+list(APPEND
+ SOURCES
+ $<TARGET_OBJECTS:dxvk>
+)
endif()
if(ENABLE_LUTRIS)
add_compile_definitions(LUTRIS_ENABLED)
-set(MAINSOURCES
- ${MAINSOURCES}
+add_library(lutris OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/lutris.c
${CMAKE_CURRENT_SOURCE_DIR}/lutris.h
${CMAKE_CURRENT_SOURCE_DIR}/lutris/array.h
@@ -35,21 +46,26 @@ set(MAINSOURCES
${CMAKE_CURRENT_SOURCE_DIR}/lutris/runner.h
${CMAKE_CURRENT_SOURCE_DIR}/lutris/task.h
)
+
+list(APPEND
+ SOURCES
+ $<TARGET_OBJECTS:lutris>
+)
endif()
if (ENABLE_WINE AND NOT WIN32)
add_compile_definitions(WINE_ENABLED)
-set(MAINSOURCES
- ${MAINSOURCES}
+add_library(wine OBJECT
${CMAKE_CURRENT_SOURCE_DIR}/wine.c
${CMAKE_CURRENT_SOURCE_DIR}/wine.h
)
-endif()
-find_package(Libcurl REQUIRED)
-find_package(JsonC REQUIRED)
-find_package(Libarchive REQUIRED)
+list(APPEND
+ SOURCES
+ $<TARGET_OBJECTS:wine>
+)
+endif()
set(CFLAGS
-Wall -Wextra -pedantic
@@ -62,15 +78,15 @@ set(CFLAGS
${LIBARCHIVE_CFLAGS}
)
-add_library(core OBJECT ${MAINSOURCES})
-
-target_include_directories(core PUBLIC ${LIBCURL_INCLUDE_DIRS})
-target_include_directories(core PUBLIC ${JSONC_INCLUDE_DIRS})
-target_include_directories(core PUBLIC ${LIBARCHIVE_INCLUDE_DIRS})
+add_library(core OBJECT ${CORE_SOURCES})
+list(APPEND
+ SOURCES
+ $<TARGET_OBJECTS:core>
+)
target_compile_options(core PUBLIC ${CFLAGS})
-add_executable(${CMAKE_PROJECT_NAME} $<TARGET_OBJECTS:core>)
+add_executable(${CMAKE_PROJECT_NAME} ${SOURCES})
target_link_libraries(${CMAKE_PROJECT_NAME} LINK_PUBLIC ${LIBCURL_LIBRARIES})
target_link_libraries(${CMAKE_PROJECT_NAME} LINK_PUBLIC ${JSONC_LIBRARIES})
diff --git a/src/mock/CMakeLists.txt b/src/mock/CMakeLists.txt
index 8c705e4..80f2eac 100644
--- a/src/mock/CMakeLists.txt
+++ b/src/mock/CMakeLists.txt
@@ -15,8 +15,8 @@ add_custom_command(
add_custom_target(wine_json ALL DEPENDS ${WINE_JSON_OUTFILE}.c ${WINE_JSON_OUTFILE}.h)
set(WINE_MOCK
- ${WINE_TAR_OUT}.c
- ${WINE_TAR_OUT}.h
+ ${WINE_MOCK_ARCHIVE_OUT}.c
+ ${WINE_MOCK_ARCHIVE_OUT}.h
)
file(TOUCH ${WINE_MOCK})
@@ -31,11 +31,11 @@ SET(MOCK_SOURCES
add_library(mock STATIC ${MOCK_SOURCES})
target_compile_options(mock PUBLIC ${CFLAGS})
target_include_directories(mock PUBLIC ${LIBCURL_INCLUDE_DIRS})
-add_dependencies(mock wine_tar wine_json)
-target_include_directories(mock PRIVATE ${WINE_TAR_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+add_dependencies(mock wine_mock_archive wine_json)
+target_include_directories(mock PRIVATE ${WINE_MOCK_ARCHIVE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
set(NAME ${CMAKE_PROJECT_NAME}_mock)
-add_executable(${NAME} $<TARGET_OBJECTS:core>)
+add_executable(${NAME} ${SOURCES})
target_link_libraries(${NAME} LINK_PUBLIC ${JSONC_LIBRARIES})
target_link_libraries(${NAME} LINK_PUBLIC ${LIBARCHIVE_LIBRARIES})
diff --git a/src/mock/wine/CMakeLists.txt b/src/mock/wine/CMakeLists.txt
index 8275b27..3418089 100644
--- a/src/mock/wine/CMakeLists.txt
+++ b/src/mock/wine/CMakeLists.txt
@@ -5,31 +5,32 @@ SET(WINE_SOURCES
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/mock/bin")
file(MAKE_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
-set(WINE_TAR_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-set(WINE_TAR_DIR "${WINE_TAR_DIR}" PARENT_SCOPE)
+set(WINE_MOCK_ARCHIVE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
+set(WINE_MOCK_ARCHIVE_DIR "${WINE_MOCK_ARCHIVE_DIR}" PARENT_SCOPE)
-add_executable(wine ${WINE_SOURCES})
-target_compile_options(wine PUBLIC ${CFLAGS})
+add_executable(wine_mock ${WINE_SOURCES})
+set_target_properties(wine_mock PROPERTIES OUTPUT_NAME "wine")
+target_compile_options(wine_mock PUBLIC ${CFLAGS})
-set(WINE_TAR_FILE_NAME "wine-mock.tar.xz")
-set(WINE_TAR_FILE "${WINE_TAR_DIR}/${WINE_TAR_FILE_NAME}")
-string(REGEX REPLACE "\\.| |-" "_" WINE_TAR_FILE_NAME ${WINE_TAR_FILE_NAME})
-set(WINE_TAR_OUT "${WINE_TAR_DIR}/${WINE_TAR_FILE_NAME}")
-set(WINE_TAR_OUT "${WINE_TAR_OUT}" PARENT_SCOPE)
+set(WINE_MOCK_ARCHIVE_FILE_NAME "wine-mock.tar.xz")
+set(WINE_MOCK_ARCHIVE_FILE "${WINE_MOCK_ARCHIVE_DIR}/${WINE_MOCK_ARCHIVE_FILE_NAME}")
+string(REGEX REPLACE "\\.| |-" "_" WINE_MOCK_ARCHIVE_FILE_NAME ${WINE_MOCK_ARCHIVE_FILE_NAME})
+set(WINE_MOCK_ARCHIVE_OUT "${WINE_MOCK_ARCHIVE_DIR}/${WINE_MOCK_ARCHIVE_FILE_NAME}")
+set(WINE_MOCK_ARCHIVE_OUT "${WINE_MOCK_ARCHIVE_OUT}" PARENT_SCOPE)
add_custom_command(
- OUTPUT ${WINE_TAR_FILE}
+ OUTPUT ${WINE_MOCK_ARCHIVE_FILE}
COMMAND
- ${CMAKE_COMMAND} -E tar "cfv" "${WINE_TAR_FILE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
- DEPENDS wine
+ ${CMAKE_COMMAND} -E tar "cfv" "${WINE_MOCK_ARCHIVE_FILE}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
+ DEPENDS wine_mock
)
add_custom_command(
- OUTPUT ${WINE_TAR_OUT}.c ${WINE_TAR_OUT}.h
+ OUTPUT ${WINE_MOCK_ARCHIVE_OUT}.c ${WINE_MOCK_ARCHIVE_OUT}.h
COMMAND ${CMAKE_COMMAND}
- "-Dbin_in=${WINE_TAR_FILE}"
+ "-Dbin_in=${WINE_MOCK_ARCHIVE_FILE}"
-P ${CMAKE_SOURCE_DIR}/cmake/FileEmbed.cmake
- DEPENDS ${WINE_TAR_FILE}
+ DEPENDS ${WINE_MOCK_ARCHIVE_FILE}
)
-add_custom_target(wine_tar ALL DEPENDS ${WINE_TAR_OUT}.c ${WINE_TAR_OUT}.h) \ No newline at end of file
+add_custom_target(wine_mock_archive ALL DEPENDS ${WINE_MOCK_ARCHIVE_OUT}.c ${WINE_MOCK_ARCHIVE_OUT}.h) \ No newline at end of file